mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 10:19:47 -04:00
ec1fd76b56
Models the GTE command latency + stall-on-COP2-access, the next Stage-2 cycle component. Mirrors the mult/div completion-stall mechanism: - cpu->gte_ts_done (new CPUState field, appended): a GTE command sets it to psx_cycle_count + (cost-1); back-to-back commands serialize (psx_gte_set stalls to the prior deadline first). Any COP2 register access (MFC2/CFC2/MTC2/CTC2/LWC2/SWC2) calls psx_gte_stall, advancing guest cycles to the deadline if the op is still in flight. - Cost table (psx_cycles.c, psx_gte_cmd_latency): per-op cost-1, transcribed + verified from beetle-psx gte.cpp op returns (RTPS15 NCLIP8 MVMVA8 NCDS19 NCDT44 RTPT23 NCCT39 ... AVSZ4=5 not 6). cost-1 because the COP2 instruction's own +1 base is charged separately (Beetle GTE_Instruction returns ret-1). - Set armed in the shared gte_execute() (one site for both backends); stall emitted before every COP2 reg access in both emitters (code_generator, strict_translator) and the dirty interp. The compiled "+1 at top" vs interp "base after exec_one" offset cancels (same as muldiv). Validated EXACT on ruler #2 (new gte_rtps + gte_nclip loops): native +15/+8 == Beetle +15/+8. All other components unchanged (no regression); Tomba2 boots to FMV. Requires regen (emitters changed); runtime+BIOS+game regenerated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>