mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 10:19:47 -04:00
c4474b9340
The depth-cue tail (INTPL/DPCS/DPCT/DPCL/NCDS/NCDT/CDP) and the lighting helpers (light_transform / light_color / color_output) hardcoded lm=1 on every IR write-back, clamping all negative components to zero. Crash Bash tweens its vertex animation through INTPL (cmd 0x0980011, lm=0): pose A in IR1-3, pose B in the far-color registers, blend in IR0. With lm forced on, every negative vertex component collapsed to 0 on tween frames, squashing characters onto their anchor point. At 10fps keyframes / 30fps renders that made the menu character strobe (2 of 3 renders flattened, so exactly one display buffer ever held a healthy pose) and in-game characters flatten. Beetle/hardware render the same frames correctly. depth_cue_from_ir is now the faithful hardware formula: base = IR<<12, step = lim(((FC<<12) - base) >> sf*12) with the forced-unsigned-off intermediate clamp, MAC = (base + IR0*step) >> sf*12, final IR clamp with lm from the instruction word. sf (bit 19) is honored instead of assuming 12. The lighting helpers take lm from the instruction too (games light with lm=1, so their behavior is unchanged). Observability (always-on, build-dbg commands): - GTE projection ring (gte_ring_dump): every RTPS/RTPT's V/RT/TR/H/OFX/OFY inputs and SXY/SZ/FLAG outputs, frame-stamped, with caller ra. - GTE INTPL ring (gte_intpl_dump): every INTPL's IR0/IR1-3/FC inputs (snapshotted pre-op) and MAC/IR/FLAG outputs, with frame filter AND offset paging so a whole frame is reachable. - gte_frame_stats: per-frame nproj/nsat/nflat/nintpl/nintpl_tiny — nintpl_tiny (all-tiny output from non-tiny input) is the collapse signature and pinned this bug to the INTPL math in one query. - gte_latch_dump: retained ring of saturated projections. Verified on Crash Bash SELECT GAME TYPE: nintpl_tiny 335-352/473 -> 0-3, vertex buffer at 0x80056AC8 no longer alternates healthy/collapsed, and a 20-shot jittered screenshot burst shows the character in every frame (was bimodal present/absent). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>