mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-28 10:59:16 -04:00
d500554bd8
A plugin that draws its own overlay primitives needs to know where the right-hand edge of the screen is, and it cannot work that out for itself. GPUSTAT carries the horizontal-resolution bits, so a plugin can recover the coarse mode width, but the visible width also depends on the GP1(06h) X1/X2 range -- and that register is write-only and mirrored nowhere a plugin can read. Ape Escape is the worked example. It scans out 384 (368-mode, dot clock 7, horizontal range 539..3227) while its mode width is 368, and the usual assumption of 320 is wrong by 64. A HUD row right-aligned to 316 lands 68 pixels short of the edge, which is exactly what the Quick Gadget Select mod does today. psx_mod_display_width()/psx_mod_display_height() return what the presenter uses, straight from gpu_get_display_info(). Zero means the geometry is not established yet, and the header tells callers to skip drawing rather than substitute a guess -- an overlay in the wrong place is worse than an overlay that waits a frame. mod_runtime_test covers the passthrough with a stubbed GPU, including the 384-vs-368 case that motivates it and the zero case. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>