diff --git a/gfx.cpp b/gfx.cpp index 6016c6b6..25a5c920 100644 --- a/gfx.cpp +++ b/gfx.cpp @@ -241,9 +241,9 @@ bool8 S9xGraphicsInit (void) GFX.InterlaceFrame = 0; GFX.RealPPL = GFX.Pitch >> 1; IPPU.OBJChanged = TRUE; - IPPU.DirectColourMapsNeedRebuild = TRUE; Settings.BG_Forced = 0; S9xFixColourBrightness(); + S9xBuildDirectColourMaps(); GFX.X2 = (uint16 *) malloc(sizeof(uint16) * 0x10000); GFX.ZERO = (uint16 *) malloc(sizeof(uint16) * 0x10000); @@ -336,8 +336,6 @@ void S9xBuildDirectColourMaps (void) for (uint32 p = 0; p < 8; p++) for (uint32 c = 0; c < 256; c++) DirectColourMaps[p][c] = BUILD_PIXEL(IPPU.XB[((c & 7) << 2) | ((p & 1) << 1)], IPPU.XB[((c & 0x38) >> 1) | (p & 2)], IPPU.XB[((c & 0xc0) >> 3) | (p & 4)]); - - IPPU.DirectColourMapsNeedRebuild = FALSE; } void S9xStartScreenRefresh (void) diff --git a/ppu.cpp b/ppu.cpp index f54b4132..39ac5828 100644 --- a/ppu.cpp +++ b/ppu.cpp @@ -365,9 +365,9 @@ void S9xSetPPU (uint8 Byte, uint16 Address) if (PPU.Brightness != (Byte & 0xf)) { IPPU.ColorsChanged = TRUE; - IPPU.DirectColourMapsNeedRebuild = TRUE; PPU.Brightness = Byte & 0xf; S9xFixColourBrightness(); + S9xBuildDirectColourMaps(); if (PPU.Brightness > IPPU.MaxBrightness) IPPU.MaxBrightness = PPU.Brightness; } @@ -1973,7 +1973,6 @@ void S9xSoftResetPPU (void) memset(&IPPU.Clip[c], 0, sizeof(struct ClipData)); IPPU.ColorsChanged = TRUE; IPPU.OBJChanged = TRUE; - IPPU.DirectColourMapsNeedRebuild = TRUE; memset(IPPU.TileCached[TILE_2BIT], 0, MAX_2BIT_TILES); memset(IPPU.TileCached[TILE_4BIT], 0, MAX_4BIT_TILES); memset(IPPU.TileCached[TILE_8BIT], 0, MAX_8BIT_TILES); @@ -2003,6 +2002,7 @@ void S9xSoftResetPPU (void) IPPU.FrameSkip = 0; S9xFixColourBrightness(); + S9xBuildDirectColourMaps(); for (int c = 0; c < 0x8000; c += 0x100) memset(&Memory.FillRAM[c], c >> 8, 0x100); diff --git a/ppu.h b/ppu.h index 1b902856..cff1e721 100644 --- a/ppu.h +++ b/ppu.h @@ -225,7 +225,6 @@ struct InternalPPU struct ClipData Clip[2][6]; bool8 ColorsChanged; bool8 OBJChanged; - bool8 DirectColourMapsNeedRebuild; uint8 *TileCache[7]; uint8 *TileCached[7]; uint16 VRAMReadBuffer; diff --git a/snapshot.cpp b/snapshot.cpp index 36905b2b..7f4ddd90 100644 --- a/snapshot.cpp +++ b/snapshot.cpp @@ -1789,6 +1789,7 @@ int S9xUnfreezeFromStream (STREAM stream) CPU.HDMARanInDMA = 0; S9xFixColourBrightness(); + S9xBuildDirectColourMaps(); IPPU.ColorsChanged = TRUE; IPPU.OBJChanged = TRUE; IPPU.RenderThisFrame = TRUE; diff --git a/tile.cpp b/tile.cpp index 29451927..92f4825c 100644 --- a/tile.cpp +++ b/tile.cpp @@ -720,8 +720,6 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic) #define SELECT_PALETTE() \ if (BG.DirectColourMode) \ { \ - if (IPPU.DirectColourMapsNeedRebuild) \ - S9xBuildDirectColourMaps(); \ GFX.RealScreenColors = DirectColourMaps[(Tile >> 10) & 7]; \ } \ else \ @@ -1064,8 +1062,6 @@ extern struct SLineMatrixData LineMatrixData[240]; \ if (DCMODE) \ { \ - if (IPPU.DirectColourMapsNeedRebuild) \ - S9xBuildDirectColourMaps(); \ GFX.RealScreenColors = DirectColourMaps[0]; \ } \ else \ @@ -1162,8 +1158,6 @@ extern struct SLineMatrixData LineMatrixData[240]; \ if (DCMODE) \ { \ - if (IPPU.DirectColourMapsNeedRebuild) \ - S9xBuildDirectColourMaps(); \ GFX.RealScreenColors = DirectColourMaps[0]; \ } \ else \