PPU: Fixed mosaic display when reading/writing to PPU registers in the middle of a scanline
This commit is contained in:
parent
1d27867ddd
commit
98fe9a85d6
1 changed files with 10 additions and 4 deletions
14
Core/Ppu.cpp
14
Core/Ppu.cpp
|
@ -949,7 +949,7 @@ void Ppu::RenderTilemap()
|
|||
|
||||
TileData* tileData = _layerData[layerIndex].Tiles;
|
||||
|
||||
uint8_t mosaicCounter = applyMosaic ? _state.MosaicSize - (_drawStartX % _state.MosaicSize) : 0;
|
||||
uint8_t mosaicCounter = applyMosaic ? (_drawStartX % _state.MosaicSize) : 0;
|
||||
|
||||
uint8_t lookupIndex;
|
||||
uint8_t chrDataOffset;
|
||||
|
@ -988,7 +988,7 @@ void Ppu::RenderTilemap()
|
|||
uint8_t priority = (tilemapData & 0x2000) ? highPriority : normalPriority;
|
||||
|
||||
if(applyMosaic) {
|
||||
if(mosaicCounter == _state.MosaicSize) {
|
||||
if(mosaicCounter == 0) {
|
||||
mosaicCounter = 1;
|
||||
if(hiResMode) {
|
||||
color = hiresSubColor;
|
||||
|
@ -997,6 +997,9 @@ void Ppu::RenderTilemap()
|
|||
_mosaicPriority[layerIndex] = priority;
|
||||
} else {
|
||||
mosaicCounter++;
|
||||
if(mosaicCounter == _state.MosaicSize) {
|
||||
mosaicCounter = 0;
|
||||
}
|
||||
color = _mosaicColor[layerIndex] & 0xFF;
|
||||
paletteIndex = _mosaicColor[layerIndex] >> 8;
|
||||
priority = _mosaicPriority[layerIndex];
|
||||
|
@ -1108,7 +1111,7 @@ void Ppu::RenderTilemapMode7()
|
|||
//Keep the "scanline" to what it was at the start of this mosaic block
|
||||
realY -= _state.MosaicSize - _mosaicScanlineCounter;
|
||||
}
|
||||
uint8_t mosaicCounter = applyMosaic ? _state.MosaicSize - (_drawStartX % _state.MosaicSize) : 0;
|
||||
uint8_t mosaicCounter = applyMosaic ? (_drawStartX % _state.MosaicSize) : 0;
|
||||
|
||||
int32_t xValue = (
|
||||
((_state.Mode7.Matrix[0] * clip(hScroll - centerX)) & ~63) +
|
||||
|
@ -1175,12 +1178,15 @@ void Ppu::RenderTilemapMode7()
|
|||
}
|
||||
|
||||
if(applyMosaic) {
|
||||
if(mosaicCounter == _state.MosaicSize) {
|
||||
if(mosaicCounter == 0) {
|
||||
mosaicCounter = 1;
|
||||
_mosaicColor[layerIndex] = colorIndex;
|
||||
_mosaicPriority[layerIndex] = priority;
|
||||
} else {
|
||||
mosaicCounter++;
|
||||
if(mosaicCounter == _state.MosaicSize) {
|
||||
mosaicCounter = 0;
|
||||
}
|
||||
colorIndex = _mosaicColor[layerIndex];
|
||||
priority = _mosaicPriority[layerIndex];
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue