Files
psxrecomp/runtime
Matthew Stanley 3ed6646a24 fix(tomba2): frame-1997 exit — restore committed PC after a game-RFE longjmp at block-return pumps
ROOT (corrected): the game's HookEntryInt handler ReturnFromException longjmps back
to psx_check_interrupts, which restores GPRs and returns with cpu->pc=0. At the
local-flow internal pump that's fine (the loop continues on its local pc), but at the
BLOCK-RETURN pumps (outer 4096-insn pump + guard-yield pump) the block already
returned, so cpu->pc=0 propagates up the trampoline to the OUTERMOST dispatch and is
read as a clean 'execution completed' exit.

FIX: at those two pumps capture the committed guest PC before psx_check_interrupts;
if a handler RFE longjmp left cpu->pc=0, restore it so the trampoline re-dispatches
and the game resumes. Runtime-only, no regen.

RESULT: Tomba 2 runs past frame 1997 (Whoopee-Camp splash renders, frame climbs
steadily to 5500+, dirty_ram_aborts=0, restore fires ~once/22 frames). The async
EPC-sentinel scaffolding from the prior WIP is now dead (the bug was longjmp-landing
depth, not async) and will be cleaned up next.

VALIDATION PENDING: Beetle cascade direction + T1/MMX6/Ape regression (shared pump
path) before this is master-bound. wt/tomba2 only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 23:16:13 -07:00
..