mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 02:11:36 -04:00
77a1f8bd6b
Completeness layer for the Tomba 2 FMV-freeze fix (the discovery/ownership side of "containment is not ownership, ownership is not entry legality"). In overlay discovery (main_psx.cpp --overlay), after walking the seed roots, every DIRECT CALL (jal) target that lands strictly INSIDE an already-discovered function is registered as an ALIAS ENTRY of that host via the existing alias machinery (materialize_alias_groups). So when a host's discovered range absorbs a separate routine (e.g. the crt0 `jal 0x50B08; break` falling through into the init-array at 0x89788), the host's entry-switch now routes a dispatch of that PC to the correct absorbed interior block and runs it NATIVE — instead of depending on the PC having been captured, or falling closed to the interpreter. Derived purely from static jal evidence (jal encodes a code target, so it never mints code from data); does not depend on execution capture. Preferred over an explicit range-clip because the absorbed code IS the right code — it just needed a routable entry. The static two-phase FunctionDiscovery already enforces hard_cap = next-entry, so only the overlay path needed this. VERIFIED: regenerated cache (codegen cg4_42de29a8) emits `case 0x80089788u` in func_800896E0; cps_probe for 0x89788 drops 1021 -> 0 (now main-chain native, not the broken CPS find-by-range default); freeze stays gone, 60fps sustained. Pairs with the fail-closed entry guard (bd60381), which remains the safety net for any genuinely-unrouted interior PC. Framework-wide: regression-test Tomba 1 / MMX6 / Ape before any master merge. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>