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>
43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Same as raw_tcp.py but with 30s timeout for large transfers."""
|
|
import socket, sys, json
|
|
|
|
if len(sys.argv) < 3:
|
|
print(__doc__); sys.exit(1)
|
|
|
|
port = int(sys.argv[1]); cmd = sys.argv[2]
|
|
req = {"id": 1, "cmd": cmd}
|
|
for kv in sys.argv[3:]:
|
|
k, v = kv.split("=", 1)
|
|
if v.startswith("0x") or v.startswith("0X"):
|
|
pass
|
|
else:
|
|
try: v = int(v)
|
|
except ValueError: pass
|
|
req[k] = v
|
|
|
|
s = socket.socket(); s.settimeout(30.0)
|
|
s.connect(("127.0.0.1", port))
|
|
s.sendall((json.dumps(req) + "\n").encode())
|
|
data = b""; depth_c = 0; depth_s = 0; in_str = False; esc = False; started = False; done = False
|
|
try:
|
|
while not done:
|
|
chunk = s.recv(65536)
|
|
if not chunk: break
|
|
for b in chunk:
|
|
data += bytes([b]); ch = chr(b)
|
|
if in_str:
|
|
if esc: esc = False
|
|
elif ch == "\\": esc = True
|
|
elif ch == '"': in_str = False
|
|
continue
|
|
if ch == '"': in_str = True
|
|
elif ch == "{": depth_c += 1; started = True
|
|
elif ch == "}": depth_c -= 1
|
|
elif ch == "[": depth_s += 1
|
|
elif ch == "]": depth_s -= 1
|
|
if started and depth_c == 0 and depth_s == 0: done = True; break
|
|
except socket.timeout: pass
|
|
s.close()
|
|
sys.stdout.write(data.decode("utf-8", errors="replace"))
|