mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 10:19:47 -04:00
8e81afd111
Recompiler bug fix: full_function_emitter treated conditional branch delay slots at function boundaries as fully resolved control flow, suppressing the fall-through tail call for the "not taken" path. This broke 15 cross-function fall-throughs across the BIOS, most critically the find-free-EvCB-slot function (BFC11800) whose search loop was silently skipped — causing OpenEvent to return garbage handles (0xF100E1E8) instead of valid slot indices (0xF1000000..0xF1000005). Fix: only suppress fall-through for unconditional flow (j/jr/jal/jalr/rfe). Conditional branches (beq/bne/blez/bgtz/bltz/bgez) now always emit `cpu->pc = next_addr; return;` for the not-taken path. Also included: - Tier 1 reverse debugger: 1M-entry write trace ring (32 MB), 64K-entry MMIO trace ring (2 MB), 8-slot multi-range address filtering, function attribution via g_debug_current_func_addr. 6 new TCP commands: wtrace_add/del/ranges/stats, mmio_dump/clear. - 3 new dispatch seeds for functions exposed by fall-through fix (SIO epilogue, exception chain walker, GTE init). - Diagnostic tools: analyze_sio_trace, decode_insn, decode_jt, mmio_tally. - Pattern 5 trampoline fix + PLAN.md Phase 4 status update. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
16 lines
714 B
Python
16 lines
714 B
Python
#!/usr/bin/env python3
|
|
"""Decode a jump table from hex dump."""
|
|
import sys
|
|
|
|
hex_str = "e0620380bc6303809863038044630380bc630380bc630380bc63038084630380d0620380b8620380bc6303801c630380bc63038008620380bc6303802c630380606203808c62038018620380bc630380586303807463038008630380ac630380"
|
|
data = bytes.fromhex(hex_str)
|
|
|
|
for i in range(24):
|
|
off = i * 4
|
|
val = int.from_bytes(data[off:off+4], 'little')
|
|
cmd = i + 2 # command code = index + 2
|
|
# Convert KSEG0 RAM addr to ROM addr: RAM 0x30000+ -> ROM 0x1FC18000+
|
|
phys = val & 0x1FFFFFFF
|
|
rom = 0xBFC00000 + (phys - 0x30000 + 0x18000) if 0x30000 <= phys <= 0x5AFFF else phys
|
|
print(f" [{i:2d}] cmd=0x{cmd:02X} target=0x{val:08X} ROM=0x{rom:08X}")
|