mirror of
https://github.com/Cogential/frametanium.git
synced 2026-10-17 17:00:37 +02:00
manager.py is a standard-library service on the Frame (port 8643). It lists each catalog port's releases, downloads the chosen asset (zip, or an AppImage it unpacks with --appimage-extract and gives a launcher), stages it next to ~/devkit-game/<gameid> and swaps it in, keeping ROMs placed next to run.sh and the previous install for rollback. It refuses while the game runs, fixes executable bits, registers the shortcut with Steam and adds library art. A token in the settings unlocks private repos. app/ is the controller-driven headset front end (C + SDL2, talks to the service over loopback with tab-separated replies); page.html is the browser one. deploy.sh installs both over SSH. Tested on the laptop against the real releases: install, version switch, ROM carry-over, rollback, the running-game guard, the AppImage path (under qemu), and both front ends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VHDaz86aayqMULHsjByEmT
54 lines
1.3 KiB
Python
54 lines
1.3 KiB
Python
"""Prints the Steam app id of a devkit shortcut, read from shortcuts.vdf. Usage: python3 - <DevkitGameID>"""
|
|
import glob
|
|
import os
|
|
import struct
|
|
import sys
|
|
|
|
want = sys.argv[1]
|
|
|
|
|
|
def parse(data):
|
|
pos = 0
|
|
|
|
def cstr():
|
|
nonlocal pos
|
|
end = data.index(b"\0", pos)
|
|
s = data[pos:end].decode("utf-8", "replace")
|
|
pos = end + 1
|
|
return s
|
|
|
|
def obj():
|
|
nonlocal pos
|
|
out = {}
|
|
while True:
|
|
t = data[pos]
|
|
pos += 1
|
|
if t == 8:
|
|
return out
|
|
key = cstr()
|
|
if t == 0:
|
|
out[key] = obj()
|
|
elif t == 1:
|
|
out[key] = cstr()
|
|
elif t == 2:
|
|
out[key] = struct.unpack("<I", data[pos:pos + 4])[0]
|
|
pos += 4
|
|
else:
|
|
raise ValueError(f"unknown type {t}")
|
|
|
|
pos = 1
|
|
cstr()
|
|
return obj()
|
|
|
|
|
|
for path in glob.glob(os.path.expanduser("~/.local/share/Steam/userdata/*/config/shortcuts.vdf")):
|
|
try:
|
|
shortcuts = parse(open(path, "rb").read())
|
|
except (OSError, ValueError, IndexError):
|
|
continue
|
|
for s in shortcuts.values():
|
|
if s.get("DevkitGameID") == want:
|
|
print(s.get("appid"))
|
|
sys.exit(0)
|
|
sys.exit(1)
|