mirror of
https://github.com/erickdavestech/ps5-dualsense-overlay.git
synced 2026-10-06 13:00:12 +02:00
On-screen DualSense controller overlay for a PS5 running homebrew. Derivative of Common FPS for PS5 v1.2.1 by porhe911 with the SimpleFPS patch by khalifa007, both GPL-3.0-or-later. Controller artwork by Zacksly, CC BY 3.0, modified. See CREDITS.md and CHANGELOG.md. Signed-off-by: erickdavestech <54048831+erickdavestech@users.noreply.github.com>
36 lines
1.0 KiB
Python
36 lines
1.0 KiB
Python
#!/usr/bin/env python3
|
|
"""Embed a binary file as a C++ byte array for the PS5 controller."""
|
|
|
|
from pathlib import Path
|
|
import sys
|
|
|
|
|
|
def main() -> int:
|
|
if len(sys.argv) != 3:
|
|
print(f"usage: {sys.argv[0]} INPUT OUTPUT.cpp", file=sys.stderr)
|
|
return 2
|
|
|
|
src = Path(sys.argv[1])
|
|
dst = Path(sys.argv[2])
|
|
data = src.read_bytes()
|
|
|
|
dst.parent.mkdir(parents=True, exist_ok=True)
|
|
with dst.open("w", encoding="utf-8", newline="\n") as out:
|
|
out.write("#include <cstddef>\n#include <cstdint>\n\n")
|
|
out.write("extern const std::uint8_t commonfps_shellui_elf[] = {\n")
|
|
for offset in range(0, len(data), 16):
|
|
chunk = data[offset:offset + 16]
|
|
out.write(" ")
|
|
out.write(", ".join(f"0x{b:02x}" for b in chunk))
|
|
out.write(",\n")
|
|
out.write("};\n\n")
|
|
out.write(
|
|
f"extern const std::size_t commonfps_shellui_elf_size = {len(data)}u;\n"
|
|
)
|
|
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|