mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 02:11:36 -04:00
e88e9a0233
Before: only sector 0 read succeeded; sector ≥1 reads aborted at 2 bytes
because mc_flag was loaded from mc_slots[].flag on every 0x81 select but
never saved back. The clear in MC_CMD lived only in the working static, so
every reselect re-loaded the stale 0x08 ("new card / changed battery") init
value, and the BIOS bailed every multi-sector op as "card was just inserted,
re-init."
After: BIOS shell memcard menu reads the full 15-sector directory area for
both slots. Real save filenames decode (e.g. "BISLPS-01234SAVE00") and per
card icons render in the bottom panes — the Phase 4 success criterion.
Also bundled this session:
- debug_server: B9D0..B9F0 added to always-on wtrace ranges; fn_dump_parse
default window scoped to 1M most-recent entries (filter scans against the
full 128M ring used to freeze the debug server thread for many seconds).
- ISSUES.md + diagnostic tools/*.py written during the audit.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
44 lines
1.0 KiB
Python
44 lines
1.0 KiB
Python
"""Probe the card txn ring directly via TCP. Server streams partial JSON."""
|
|
import socket, json, sys
|
|
|
|
count = int(sys.argv[1]) if len(sys.argv) > 1 else 16
|
|
host, port = '127.0.0.1', 4370
|
|
s = socket.create_connection((host, port))
|
|
s.settimeout(3.0)
|
|
s.sendall(json.dumps({'id': 1, 'cmd': 'card_txn_dump', 'count': count}).encode() + b'\n')
|
|
|
|
buf = b''
|
|
while True:
|
|
try:
|
|
chunk = s.recv(65536)
|
|
except socket.timeout:
|
|
break
|
|
if not chunk:
|
|
break
|
|
buf += chunk
|
|
# check brace balance (account for strings naively)
|
|
depth = 0
|
|
in_str = False
|
|
esc = False
|
|
for c in buf:
|
|
if esc:
|
|
esc = False
|
|
continue
|
|
if c == 0x5C:
|
|
esc = True
|
|
continue
|
|
if c == 0x22: # "
|
|
in_str = not in_str
|
|
continue
|
|
if in_str:
|
|
continue
|
|
if c == 0x7B: # {
|
|
depth += 1
|
|
elif c == 0x7D: # }
|
|
depth -= 1
|
|
if depth == 0 and buf.strip():
|
|
break
|
|
s.close()
|
|
|
|
print(buf.decode(errors='replace'))
|