mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-25 18:05:12 -04:00
c7ae3c86b2
docs/WIDESCREEN.md said every explicit screen-X cull kind rejects a wrong opcode at build time, but only slti, slti_lower, bgez and clip-edge sites did. A bltz_sites entry was used only when the word was bltz, and branch_keep_sites wrapped whatever branch was there, so a mistyped address generated silently and the edge stayed narrow. One check, CodeGenerator::check_explicit_branch_site, now covers the three branch kinds in the main EXE: bltz_sites needs bltz (REGIMM rt=0), bgez_sites bgez (REGIMM rt=1), branch_keep_sites a conditional branch (REGIMM, beq, bne, blez, bgtz). It runs in generate_branch_condition, in translate_instruction (non-branch words) and at the block exit, which also catches a jump at a listed address (jumps never reached either guard, for bgez_sites too). psxrecomp-game prints the site and exits 1; overlay variants stay vanilla as before. ws_cull_edge_codegen_test and recompiler_error_exit cover each kind on a wrong opcode, a non-branch and a jump, valid sites, and overlay variants; both fail against the previous emitter. The codegen test also pins that a matching overlay instruction emits the helpers (the preamble defines them). Docs list the required instruction per kind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>