mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-27 10:38:46 -04:00
78bec7b55e
Two generic explicit cull-site kinds for native-wide titles whose screen-X rejects the existing keys cannot express exactly: - bgez_sites: `bgez SX, keep` in a signed per-vertex left-edge chain (`bgez x0,keep; ...; bltz xN,reject`). Emitted through psx_ws_cull_bgez (keep while SX >= -margin). bltz_sites alone still rejects a primitive whose first vertices sit in the revealed band; with both kinds the chain rejects exactly when every vertex is left of -margin. - clip_edge_x_load_sites (+ clip_edge_width, default screen_w_imms[0]): lh/lhu/lw of a clip-rectangle X bound. psx_ws_clip_edge_x moves a loaded 0 to -margin and a loaded width to width+margin and leaves interior bounds (mirrors, split-screen halves) unchanged. xclip_load_sites is lw-only and upper-bound-only, so it cannot express this. Both are identity at 4:3, emit nothing when empty, and fail main-EXE generation on an opcode mismatch (overlay variants stay vanilla). They enter the overlay-cache hash only when non-empty, so every existing title keeps its hash (pinned in the test against the previous layout). Interpreter parity: the dirty-RAM interpreter now also honours explicit bltz_sites, bgez_sites, branch_keep_sites and clip_edge_x_load_sites. Its explicit site lists are stored sorted (binary-search lookup), the cap rises from 64 to 256 per key, and an over-long list is logged instead of being silently truncated. Shared math lives in runtime/include/ws_cull_edge.h. New ctest ws_cull_edge_codegen_test covers parsing, hash identity, emitted code, the opcode guards and the helper math. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>