From 1de56c5e2ef2b8dcda4929ff3bd71bbfc0660b54 Mon Sep 17 00:00:00 2001 From: Souryo Date: Sun, 22 Jun 2014 01:15:34 -0400 Subject: [PATCH] Fix color glitches with soft X scroll (affected mario bros) --- Core/PPU.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/PPU.cpp b/Core/PPU.cpp index 5133801d..5b1aa3aa 100644 --- a/Core/PPU.cpp +++ b/Core/PPU.cpp @@ -414,7 +414,7 @@ void PPU::DrawPixel() uint32_t pixelColor = 0; if(useBackground) { // If we're grabbing the pixel from the high part of the shift register, use the previous tile's palette, not the current one - pixelColor = PPU_PALETTE_RGB[GetBGPaletteEntry(offset < 8 ? _previousTile.PaletteOffset : _currentTile.PaletteOffset, backgroundColor)]; + pixelColor = PPU_PALETTE_RGB[GetBGPaletteEntry(offset + ((_cycle - 1) % 8) < 8 ? _previousTile.PaletteOffset : _currentTile.PaletteOffset, backgroundColor)]; } else { pixelColor = PPU_PALETTE_RGB[GetSpritePaletteEntry(_spriteTiles[i].PaletteOffset, spriteColor)]; }