mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 02:11:36 -04:00
7a12a0baac
Switches diagnostic methodology from a single binary running both backends in lockstep (psx-beetleoracle.exe) to two independent processes: psx-runtime.exe (recomp only, port 4370) psx-beetle.exe (Beetle libretro only, port 4380) Both expose the same JSON wire protocol for the common debug commands (read_ram, press, set_input, clear_input, pad_status, screenshot_file, wtrace_*, fntrace_* on Beetle). Cross-process comparison is done by querying both ports from a tool, NOT by sharing input or memory. Why: the embedded-oracle setup required keyboard input to drive both backends in lockstep. Once their state diverged, the same keypress drove them to different screens and "compare on the same press" became unreliable. Two independent processes lets each backend be navigated to its own state and queried on its own timeline. Removed: - runtime/src/beetle_psx_bridge.cpp (cannibalised into beetle_libretro.cpp) - runtime/src/duckstation_bridge.cpp - runtime/src/psx_oracle_cmds.c - runtime/src/psx_oracle_stub.c - runtime/include/psx_oracle_backend.h - psx-beetleoracle and psx-dsoracle cmake targets - 22 dual-backend tools (emu_read_ram / find_first_divergence / etc) Added: - runtime/src/beetle_main.cpp (SDL window + libretro driver + keyboard) - runtime/src/beetle_libretro.cpp (libretro callbacks + wtrace/fntrace/sio rings) - runtime/src/beetle_debug_server.c (TCP server, port 4380, same wire protocol) - psx-beetle cmake target Also bumps tooling caps surfaced during modal investigation: - DIRTY_RAM_BLOCK_LOG_CAP: 16K -> 4M (28ms eviction -> ~7s retention) - WTRACE_MAX_RANGES: 16 -> 64 (boot defaults filled the prior cap) - DirtyRamBlockLogEntry: added a0/a1 fields for richer dispatch context CLAUDE.md section 16 rewritten for the new methodology. New memory note locks the direction so future sessions don't reach for the deleted embedded-oracle commands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
55 lines
2.1 KiB
Python
55 lines
2.1 KiB
Python
"""Sanity check: did recomp ever dispatch to the press-handler PCs we expect?
|
|
Query dirty_block_log for target ranges around Beetle's writer PCs.
|
|
|
|
Beetle writers seen on a working press:
|
|
0x8003A710 (main_state=4 entry — the FIRST press response write)
|
|
0x80046470/0x80046468 (SetStateForWidget)
|
|
0x8003ACE4 (cursor_mirror2 writer)
|
|
0x80032350 (cursor_mirror2 writer 2)
|
|
0x80039864/0x8003987C (case-A coordinator close)
|
|
|
|
dirty_block_log records (target, ra, frame). target is the RAM block PC
|
|
that recomp dispatched to. So if recomp ever ran the press-handler chain,
|
|
we should see hits in these ranges.
|
|
"""
|
|
import socket, json
|
|
def call(payload):
|
|
s = socket.create_connection(('127.0.0.1', 4370), timeout=10)
|
|
s.sendall((json.dumps(dict(payload, id=1))+'\n').encode())
|
|
buf = b''
|
|
while True:
|
|
c = s.recv(1<<20)
|
|
if not c: break
|
|
buf += c
|
|
if buf.endswith(b'\n'): break
|
|
s.close()
|
|
return json.loads(buf.decode())
|
|
|
|
WINDOWS = [
|
|
(0x8003A700, 0x8003A720, 'main_state=4 entry / writer at 0x8003A710'),
|
|
(0x80046460, 0x80046490, 'SetStateForWidget body (state_idx/widget writer)'),
|
|
(0x80039840, 0x800398A0, 'coordinator + case-A path'),
|
|
(0x8003C640, 0x8003C700, 'cursor_mirror2 writer 1'),
|
|
(0x80032300, 0x80032380, 'cursor_mirror2 writer 2'),
|
|
(0x8003ACE0, 0x8003AD00, 'cursor_mirror2 writer 3 (Beetle group B)'),
|
|
(0x800394B0, 0x800394C0, 'coordinator entry'),
|
|
(0x800321BC, 0x800321D0, 'modal stub'),
|
|
]
|
|
|
|
print("=== Recomp dirty_block_log: dispatches to press-handler windows ===\n")
|
|
for lo, hi, lbl in WINDOWS:
|
|
r = call({'cmd':'dirty_block_log',
|
|
'target_lo': f'0x{lo:08X}',
|
|
'target_hi': f'0x{hi:08X}',
|
|
'count': 8})
|
|
emitted = r.get('emitted', 0)
|
|
total = r.get('total', 0)
|
|
avail = r.get('available', 0)
|
|
entries = r.get('entries', [])
|
|
print(f"[{lo:08X}..{hi:08X}] {lbl}")
|
|
print(f" total log entries scanned={avail} (of {total} ever), emitted={emitted}")
|
|
if entries:
|
|
for e in entries[:3]:
|
|
print(f" seq={e.get('seq')} target=0x{int(e['target'],16):08X} ra=0x{int(e['ra'],16):08X} frame={e.get('frame')}")
|
|
print()
|