Files
psxrecomp/runtime
Matthew Stanley db159a1ea6 overlay loader: startup ABI batch-purge + cache-index cap 256->4096
Two defects found by the MMX6/Tomba2 pre-merge regression gate:

1. An ABI bump (v9->v10) invalidated every cached DLL, and the lazy path
   migrated them PER-DISPATCH (LoadLibrary -> reject -> DeleteFile -> retry)
   on the emulation thread that owns the window pump — a large cache
   presented as a "(Not Responding)" black window for minutes. Now a
   one-time preflight sweep at cache-scan enumerates the DIRECTORY, checks
   overlay_abi per DLL, purges mismatches (DLL + .ranges + index entry) in
   one pass, and writes a .abi_<tag>.ok marker so healthy caches skip the
   sweep on later boots. The per-load ABI gate stays as defense in depth.

2. CACHE_IDX_CAP was 256 and overflow was SILENT — Tomba2's 399-DLL cache
   truncated, leaving ~140 real DLLs invisible (their regions interpreted
   forever, no diagnostic). Cap raised to 4096 with a loud never-again
   loader_log on overflow.

Negative-tested: planted a v6 DLL under a valid name — swept on boot along
with 25 latent v9 orphans the lazy path had never touched; marker written;
game boots to title. Sweep enumerates the directory rather than the index
precisely because the index is capacity-bounded (bug 2 hid the plant on the
first test iteration).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 15:01:57 -07:00
..