diff options
| author | gbc dev <gbc@localhost> | 2026-07-15 01:32:57 +0200 |
|---|---|---|
| committer | gbc dev <gbc@localhost> | 2026-07-15 01:32:57 +0200 |
| commit | f36200458ef8d4c698c41c3543b51f3235a25d19 (patch) | |
| tree | f23cb54f6aa471eacb02e7759982a9081f5ed048 /gbctl | |
| parent | apu: register-level emulation of 0xFF10-0xFF3F (fixes music fades) (diff) | |
| download | sl0pboy-f36200458ef8d4c698c41c3543b51f3235a25d19.tar.gz sl0pboy-f36200458ef8d4c698c41c3543b51f3235a25d19.tar.xz sl0pboy-f36200458ef8d4c698c41c3543b51f3235a25d19.zip | |
tools: live debug HUD (gbhud.py) + 'gbctl hud'
Reads WRAM over the control socket, resolves addresses from pokeyellow.sym, and
pretty-prints game state (location, player pos/facing, movement+collision debug,
player name/money/badges, party nicknames/levels/HP bars) refreshing ~5Hz.
'gbctl hud' spawns it in a tmux split bound to the live instance.
Diffstat (limited to 'gbctl')
| -rwxr-xr-x | gbctl | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -284,6 +284,22 @@ def cmd_screen(argv): r = subprocess.run(args, capture_output=True, text=True) sys.stdout.write(r.stdout) +def cmd_hud(argv): + # spawn a tmux pane running the live debug HUD, bound to the resolved socket + sock_path = _resolve_sock(argv) + if "TMUX" not in os.environ: + die("not inside tmux; gbctl hud needs a tmux session") + hud = os.path.join(HERE, "tools", "gbhud.py") + split = "-h" + if "--split" in argv: + i = argv.index("--split"); split = {"h":"-h","v":"-v"}.get(argv[i+1],"-h") + cmd = "exec python3 %s --sock %s" % (_shquote(hud), _shquote(sock_path)) + r = subprocess.run(["tmux", "split-window", split, "-P", "-F", "#{pane_id}", cmd], + capture_output=True, text=True) + if r.returncode != 0: + die("tmux spawn failed: %s" % r.stderr.strip()) + print("hud pane=%s sock=%s" % (r.stdout.strip(), sock_path)) + def cmd_monitor(argv): secs = float(argv[0]) if argv and _isnum(argv[0]) else None if secs is not None: @@ -319,7 +335,7 @@ def _isnum(x): # main dispatch # --------------------------------------------------------------------------- LIFECYCLE = {"spawn": cmd_spawn, "list": cmd_list, "stop": cmd_stop, - "screen": cmd_screen, "monitor": cmd_monitor} + "screen": cmd_screen, "monitor": cmd_monitor, "hud": cmd_hud} # convenience aliases -> raw protocol verbs ALIASES = {"press": None, "tap": None, "hold": None, "buttons": None} |
