Skip to content

fix(gs): route GIF A+D 0x58 PMODE writes to the privileged register file - #401

Open
LeandroSSB wants to merge 1 commit into
ran-j:mainfrom
LeandroSSB:pr-07-pmode-0x58
Open

LeandroSSB wants to merge 1 commit into
ran-j:mainfrom
LeandroSSB:pr-07-pmode-0x58

Conversation

@LeandroSSB

Copy link
Copy Markdown

Root cause

The GS register funnel (writeRegisterUnlocked) applies A+D ids 0x59-0x5c (DISPFB1/DISPLAY1/DISPFB2/DISPLAY2) and 0x5f (BGCOLOR) to the privileged register bank — but 0x58 (PMODE) had no case and was silently dropped.

Games that build the display environment as a GIF packet (sceGsPutDispEnv / libgraph style) enable CRT1 exactly through that id. Without the case pmode stays 0, presentation resolves enableCrt1 = 0, and the frontend never presents — regardless of DISPFB/DISPLAY being correct.

Fix

case 0x58: in the funnel, beside the existing 0x59-0x5c: m_privRegs->pmode = value.

Test

ps2_gs_tests: pushes the full display environment through A+D (0x058..0x05c) and verifies each field in the privileged bank (the pre-existing ids act as guards for the new case).

Specification behavior (GS privileged registers, PMODE @ 0x12000000 via A+D id 0x58).

Related: #185 writes PMODE from sceGsResetGraph directly — a different route; the packet path through the GIF funnel is what this PR covers.

🤖 Generated with Claude Code

Suite evidence

Fresh configure+build of ps2x_tests on this branch (VS 2022, Release): 447/447 passed, 0 failed.

The GS privileged display registers 0x59-0x5c (DISPFB1/DISPLAY1/DISPFB2/
DISPLAY2) and 0x5f (BGCOLOR) were applied from A+D writes, but 0x58 (PMODE)
fell through the switch and was silently discarded. Games that build their
display env as GIF packets (libgraph PutDispEnv-style) enable CRT1 through
exactly that id, so the register file kept pmode=0 and the presentation
request decoded enableCrt1=0 no matter what the game wrote.

Guarded by a suite test that pushes the full env (0x58 PMODE, 0x59 DISPFB1,
0x5a DISPLAY1, 0x5b DISPFB2, 0x5c DISPLAY2) through writeRegister and checks
each lands in the privileged register file.

Suite: 460/460 (459 + 1 new) from the repo root.

Co-Authored-By: Claude Code <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