Files
erickdavestech--ps5-dualsen…/include/common_fps/wire.hpp
T
erickdavestech ffcfa5d29b Normalize line endings to LF and enforce them with .gitattributes
CRLF line endings broke scripts/prepare_ps5_deps.sh in CI. Only line endings change; the build output is identical.

Signed-off-by: erickdavestech <54048831+erickdavestech@users.noreply.github.com>
2026-10-03 20:52:58 -04:00

55 lines
1.3 KiB
C++

/*
* Common FPS for PS5
* Copyright (C) 2026 porhe911
* Modifications Copyright (C) 2026 khalifa007 (SimpleFPS)
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
#include "common_fps/types.hpp"
#include <cstdint>
#include <optional>
namespace common_fps {
inline constexpr std::uint32_t kWireMagic = 0x53465043; // "CFPS"
inline constexpr std::uint32_t kWireShutdownMagic = 0x58465043; // "CFPX"
inline constexpr std::uint16_t kWireVersion = 1;
inline constexpr std::uint16_t kDefaultIpcPort = 39028;
#pragma pack(push, 1)
struct WirePacket {
std::uint32_t magic = kWireMagic;
std::uint16_t version = kWireVersion;
std::uint16_t size = sizeof(WirePacket);
std::uint64_t sequence = 0;
std::int32_t fps = 0;
std::uint8_t loading = 1;
std::uint8_t corner = 0; // TopLeft
std::uint16_t font_size = 24;
float margin_x = 10.0f;
float margin_y = 10.0f;
};
#pragma pack(pop)
WirePacket make_wire_packet(
const OverlayFrame& frame,
std::uint64_t sequence);
/* Reserved controller-to-ShellUI quiesce packet; v1.2.0 does not send it. */
WirePacket make_shutdown_wire_packet(std::uint64_t sequence);
[[nodiscard]] bool
is_shutdown_wire_packet(const WirePacket& packet) noexcept;
std::optional<OverlayFrame>
decode_wire_packet(const WirePacket& packet);
} // namespace common_fps