mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-27 18:52:11 -04:00
aa6fa2c950
The static overlay path had no residency signal. overlay_page_gen only advances for pages set in overlay_watch_bitmap, and the sole callers of overlay_watch_set_range were the DLL loader's cand_register() and rebuild_lazy_manifest_index() -- both inert for an AOT-static title. So for a game dispatching through generated/overlays_static.c, every code range was unwatched, overlay_watch_pagegen_sum returned a constant, and the generation fast path in psx_overlay_static_code_matches answered every dispatch after the first from its cached result. The CRC gate was therefore consulted once per variant per process, not once per code change: the only thing that ever cleared the cache was a savestate restore. A band that swapped occupants kept dispatching the previously-validated variant. Arm the watch over a variant's ranges on the cold path, before hashing them. CD DMA reaches RAM word-by-word through psx_write_word, so an overlay load now advances the generation of every page it touches and the next dispatch re-hashes. Arming only sets bitmap bits and does not advance a generation, so the gen_sum already computed for the cache write stays valid. This is also the prerequisite for memoizing the resident variant per band: a generation change is the load event, and until now that event never fired. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>