Skip to content

Commit

Permalink
SNES: Set internal palette address to 0 when outputting bg color (whe…
Browse files Browse the repository at this point in the history
…n no layers have visible pixels)

This fixes regressions in PGA Tour Golf and Mini Yonku Shining Scorpion. These games attempt to write to CGRAM during rendering, but at a time where the background color is being rendered, so the writes overwrite address 0 in CGRAM. Without this fix, the last non-transparent pixel's color address was being used, causing it to corrupt the wrong color in CGRAM (which caused the glitches)
  • Loading branch information
SourMesen committed Dec 25, 2024
1 parent 30d28c8 commit 0ab6e92
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Core/SNES/SnesPpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,10 +925,12 @@ void SnesPpu::RenderBgColor()
uint8_t pixelFlags = (_state.ColorMathEnabled & 0x20) ? PixelFlags::AllowColorMath : 0;
for(int x = _drawStartX; x <= _drawEndX; x++) {
if((_mainScreenFlags[x] & 0x0F) == 0) {
_state.InternalCgramAddress = 0;
_mainScreenBuffer[x] = _cgram[0];
_mainScreenFlags[x] = pixelFlags;
}
if(_subScreenPriority[x] == 0) {
_state.InternalCgramAddress = 0;
_subScreenBuffer[x] = _cgram[0];
}
}
Expand Down

0 comments on commit 0ab6e92

Please sign in to comment.