mirror of https://github.com/snes9xgit/snes9x.git
Move color table generation out of tile renderer.
This commit is contained in:
parent
312075f280
commit
5285ec4e9d
4
gfx.cpp
4
gfx.cpp
|
@ -241,9 +241,9 @@ bool8 S9xGraphicsInit (void)
|
||||||
GFX.InterlaceFrame = 0;
|
GFX.InterlaceFrame = 0;
|
||||||
GFX.RealPPL = GFX.Pitch >> 1;
|
GFX.RealPPL = GFX.Pitch >> 1;
|
||||||
IPPU.OBJChanged = TRUE;
|
IPPU.OBJChanged = TRUE;
|
||||||
IPPU.DirectColourMapsNeedRebuild = TRUE;
|
|
||||||
Settings.BG_Forced = 0;
|
Settings.BG_Forced = 0;
|
||||||
S9xFixColourBrightness();
|
S9xFixColourBrightness();
|
||||||
|
S9xBuildDirectColourMaps();
|
||||||
|
|
||||||
GFX.X2 = (uint16 *) malloc(sizeof(uint16) * 0x10000);
|
GFX.X2 = (uint16 *) malloc(sizeof(uint16) * 0x10000);
|
||||||
GFX.ZERO = (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 p = 0; p < 8; p++)
|
||||||
for (uint32 c = 0; c < 256; c++)
|
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)]);
|
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)
|
void S9xStartScreenRefresh (void)
|
||||||
|
|
4
ppu.cpp
4
ppu.cpp
|
@ -365,9 +365,9 @@ void S9xSetPPU (uint8 Byte, uint16 Address)
|
||||||
if (PPU.Brightness != (Byte & 0xf))
|
if (PPU.Brightness != (Byte & 0xf))
|
||||||
{
|
{
|
||||||
IPPU.ColorsChanged = TRUE;
|
IPPU.ColorsChanged = TRUE;
|
||||||
IPPU.DirectColourMapsNeedRebuild = TRUE;
|
|
||||||
PPU.Brightness = Byte & 0xf;
|
PPU.Brightness = Byte & 0xf;
|
||||||
S9xFixColourBrightness();
|
S9xFixColourBrightness();
|
||||||
|
S9xBuildDirectColourMaps();
|
||||||
if (PPU.Brightness > IPPU.MaxBrightness)
|
if (PPU.Brightness > IPPU.MaxBrightness)
|
||||||
IPPU.MaxBrightness = PPU.Brightness;
|
IPPU.MaxBrightness = PPU.Brightness;
|
||||||
}
|
}
|
||||||
|
@ -1973,7 +1973,6 @@ void S9xSoftResetPPU (void)
|
||||||
memset(&IPPU.Clip[c], 0, sizeof(struct ClipData));
|
memset(&IPPU.Clip[c], 0, sizeof(struct ClipData));
|
||||||
IPPU.ColorsChanged = TRUE;
|
IPPU.ColorsChanged = TRUE;
|
||||||
IPPU.OBJChanged = TRUE;
|
IPPU.OBJChanged = TRUE;
|
||||||
IPPU.DirectColourMapsNeedRebuild = TRUE;
|
|
||||||
memset(IPPU.TileCached[TILE_2BIT], 0, MAX_2BIT_TILES);
|
memset(IPPU.TileCached[TILE_2BIT], 0, MAX_2BIT_TILES);
|
||||||
memset(IPPU.TileCached[TILE_4BIT], 0, MAX_4BIT_TILES);
|
memset(IPPU.TileCached[TILE_4BIT], 0, MAX_4BIT_TILES);
|
||||||
memset(IPPU.TileCached[TILE_8BIT], 0, MAX_8BIT_TILES);
|
memset(IPPU.TileCached[TILE_8BIT], 0, MAX_8BIT_TILES);
|
||||||
|
@ -2003,6 +2002,7 @@ void S9xSoftResetPPU (void)
|
||||||
IPPU.FrameSkip = 0;
|
IPPU.FrameSkip = 0;
|
||||||
|
|
||||||
S9xFixColourBrightness();
|
S9xFixColourBrightness();
|
||||||
|
S9xBuildDirectColourMaps();
|
||||||
|
|
||||||
for (int c = 0; c < 0x8000; c += 0x100)
|
for (int c = 0; c < 0x8000; c += 0x100)
|
||||||
memset(&Memory.FillRAM[c], c >> 8, 0x100);
|
memset(&Memory.FillRAM[c], c >> 8, 0x100);
|
||||||
|
|
1
ppu.h
1
ppu.h
|
@ -225,7 +225,6 @@ struct InternalPPU
|
||||||
struct ClipData Clip[2][6];
|
struct ClipData Clip[2][6];
|
||||||
bool8 ColorsChanged;
|
bool8 ColorsChanged;
|
||||||
bool8 OBJChanged;
|
bool8 OBJChanged;
|
||||||
bool8 DirectColourMapsNeedRebuild;
|
|
||||||
uint8 *TileCache[7];
|
uint8 *TileCache[7];
|
||||||
uint8 *TileCached[7];
|
uint8 *TileCached[7];
|
||||||
uint16 VRAMReadBuffer;
|
uint16 VRAMReadBuffer;
|
||||||
|
|
|
@ -1789,6 +1789,7 @@ int S9xUnfreezeFromStream (STREAM stream)
|
||||||
CPU.HDMARanInDMA = 0;
|
CPU.HDMARanInDMA = 0;
|
||||||
|
|
||||||
S9xFixColourBrightness();
|
S9xFixColourBrightness();
|
||||||
|
S9xBuildDirectColourMaps();
|
||||||
IPPU.ColorsChanged = TRUE;
|
IPPU.ColorsChanged = TRUE;
|
||||||
IPPU.OBJChanged = TRUE;
|
IPPU.OBJChanged = TRUE;
|
||||||
IPPU.RenderThisFrame = TRUE;
|
IPPU.RenderThisFrame = TRUE;
|
||||||
|
|
6
tile.cpp
6
tile.cpp
|
@ -720,8 +720,6 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic)
|
||||||
#define SELECT_PALETTE() \
|
#define SELECT_PALETTE() \
|
||||||
if (BG.DirectColourMode) \
|
if (BG.DirectColourMode) \
|
||||||
{ \
|
{ \
|
||||||
if (IPPU.DirectColourMapsNeedRebuild) \
|
|
||||||
S9xBuildDirectColourMaps(); \
|
|
||||||
GFX.RealScreenColors = DirectColourMaps[(Tile >> 10) & 7]; \
|
GFX.RealScreenColors = DirectColourMaps[(Tile >> 10) & 7]; \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
|
@ -1064,8 +1062,6 @@ extern struct SLineMatrixData LineMatrixData[240];
|
||||||
\
|
\
|
||||||
if (DCMODE) \
|
if (DCMODE) \
|
||||||
{ \
|
{ \
|
||||||
if (IPPU.DirectColourMapsNeedRebuild) \
|
|
||||||
S9xBuildDirectColourMaps(); \
|
|
||||||
GFX.RealScreenColors = DirectColourMaps[0]; \
|
GFX.RealScreenColors = DirectColourMaps[0]; \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
|
@ -1162,8 +1158,6 @@ extern struct SLineMatrixData LineMatrixData[240];
|
||||||
\
|
\
|
||||||
if (DCMODE) \
|
if (DCMODE) \
|
||||||
{ \
|
{ \
|
||||||
if (IPPU.DirectColourMapsNeedRebuild) \
|
|
||||||
S9xBuildDirectColourMaps(); \
|
|
||||||
GFX.RealScreenColors = DirectColourMaps[0]; \
|
GFX.RealScreenColors = DirectColourMaps[0]; \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
|
|
Loading…
Reference in New Issue