Skip to content

widescreen: stretch backdrop X-stores about screen centre in native-wide mode - #78

Merged
mstan merged 6 commits into
mstan:masterfrom
OpokXeno:fix/ws-backdrop-x-native-wide
Jul 26, 2026
Merged

widescreen: stretch backdrop X-stores about screen centre in native-wide mode#78
mstan merged 6 commits into
mstan:masterfrom
OpokXeno:fix/ws-backdrop-x-native-wide

Conversation

@OpokXeno

Copy link
Copy Markdown
Contributor

Problem

psx_ws_backdrop_x(), the transform applied at [widescreen.backdrop] x_sites
store PCs, is gated on ws_active(), which only covers the 4:3-squash path.
In native-wide mode the function is identity, so configured x_sites
silently do nothing and 4:3-authored 2D backdrops leave unpainted margins in
the widened frame.

Concrete case: Xenogears battle backdrops. The panels are POLY_FT4
quads with pre-calculated screen coordinates (they never touch the GTE),
written to the OT by main-EXE sh stores. Listing those PCs as x_sites had no
effect in native-wide because the hook returned the value unchanged.

Change

Add a native-wide branch to psx_ws_backdrop_x(): stretch the stored screenX
about the display centre by (disp_w + nw_extra) / disp_w, mirroring how the
existing squash branch scales about the same centre by the inverse factor.
13 lines, one function.

  • 4:3 / squash / boot / FMV paths unchanged (byte-identical output).
  • Stretch direction is the exact inverse of the squash branch's contract:
    a panel spanning [0, 320) on a 320px display with nw_extra = 106 now
    spans [-53, 373), covering the full 16:9 reveal.

Testing

  • Xenogears (SLUS-006.64) battle scenes: backdrop now covers the
    full wide frame, no sky-coloured margins; no distortion of the 3D terrain
    layer (GTE-projected, untouched by this path).
  • Verified end-to-end via the runtime debug server: OT writes at the four
    store sites observed before/after.

OpokXeno and others added 6 commits July 23, 2026 00:28
The FMV draw-area early-outs in gp0_exec_* reject prims against the
guest's authored 4:3 draw area before the renderer's wide mirror can
draw them. In native-wide mode every margin prim submitted through the
widened game culls ([widescreen.cull] hooks) is killed at the door, so
world and actor geometry pops in at the revealed edges. Reported on
Xenogears; affects any title using cull widening.

The mirror maps local_x = x - draw_area_left + offset and clips at
[0, disp_w + 2*offset), so the host-side check is only lossless when it
tests exactly that window. draw_area_cull_window() now computes
[left - off, max(right, left + disp_w) + off]: with native-wide
inactive the offset is 0 and the check is byte-identical to the
original optimization (4:3 / squash / FMV keep the host-side skip);
with native-wide active, margin prims pass while genuinely off-screen
prims are still culled host-side.
# Conflicts:
#	runtime/src/gpu.c
…ide mode

psx_ws_backdrop_x() was identity in native-wide (its ws_active() gate only covers the 4:3-squash path), so [widescreen.backdrop] x_sites did nothing there. Add a native-wide branch that stretches the stored screenX about the display centre by (disp_w + nw_extra)/disp_w, letting 4:3-authored 2D backdrops cover the widened frame. Verified on Xenogears battle mountain panels (POLY_FT4 quads with pre-calculated screen coords; main-EXE sh store sites 0x80027BE8/BEC/BF0/BF8, wtrace-evidenced).

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@mstan
mstan merged commit 0a8f8ac into mstan:master Jul 26, 2026
3 checks passed
@TechnicallyComputers TechnicallyComputers mentioned this pull request Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants