Skip to content

video/gcm: fix cellGcmGetTiledPitchSize ABI and flip/vblank handler dispatch - #29

Open
sp00nznet wants to merge 1 commit into
masterfrom
pr/gcm-render-fixes
Open

video/gcm: fix cellGcmGetTiledPitchSize ABI and flip/vblank handler dispatch#29
sp00nznet wants to merge 1 commit into
masterfrom
pr/gcm-render-fixes

Conversation

@sp00nznet

Copy link
Copy Markdown
Owner

Summary

Two GCM/RSX bugs found while bringing up You Don't Know Jack (BLUS30569) under the recompiler. Both prevented the title's RSX command stream from being issued correctly. With these fixes the title's own recompiled code reaches the FIFO and issues real NV4097_CLEAR_SURFACE commands (visible clears on screen via the D3D12 backend).

1. cellGcmGetTiledPitchSize had the wrong ABI

The real export is uint32_t cellGcmGetTiledPitchSize(uint32_t size)one argument, with the aligned tiled pitch returned in r3. The previous 2-arg form treated r4 as an out-pointer and wrote the pitch through it.

At the title's call site r4 still held the caller's CellVideoOutResolution* (left over from the preceding cellVideoOutGetResolution), so the write clobbered width/height with the pitch value. width became 0, and every downstream tile / display-buffer setup computed from garbage.

2. Flip/vblank handler callbacks dispatched through a clobbered OPD

Handlers were dispatched by re-resolving the handler OPD at tick time. The title's handler OPDs (0x530D70/78/80) have their code word clobbered in guest memory by a later lifted store, so re-resolving yields the TOC base instead of the real entry point.

Fix: capture the resolved {code, toc} at registration time and dispatch through a new ppu_guest_call_ct() (call-by-resolved-code/toc) in the PPU loader, which runs the real lifted handler regardless of the later OPD corruption.

Testing

  • ps3recomp_runtime builds clean (Release).
  • ydkj_boot.exe links clean end-to-end against the new cellGcmGetTiledPitchSize signature.
  • At runtime the title issues real CLEAR_SURFACE from its own recompiled code.

🤖 Generated with Claude Code

…ispatch

Two GCM bugs that prevented the title's RSX command stream from being
issued correctly.

1. cellGcmGetTiledPitchSize had the wrong ABI. The real export is
   uint32_t cellGcmGetTiledPitchSize(uint32_t size) -- one argument, the
   aligned tiled pitch returned in r3. The previous 2-arg form treated r4
   as an out-pointer and wrote the pitch through it. At the title's call
   site r4 still held the caller's CellVideoOutResolution* (left over from
   the preceding cellVideoOutGetResolution), so the write clobbered
   width/height with the pitch value -- width became 0 and every
   downstream tile / display-buffer setup computed from garbage.

2. Flip/vblank handler callbacks were dispatched by re-resolving the
   handler OPD at tick time. The title's handler OPDs (0x530D70/78/80)
   have their code word clobbered in guest memory by a later lifted store,
   so re-resolving yields the TOC base instead of the real entry. Capture
   the resolved {code,toc} at registration time and dispatch through the
   new ppu_guest_call_ct() (call-by-resolved-code/toc), which runs the
   real lifted handler regardless of the later OPD corruption.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant