PPU: Mosaic "start" scanline should not be reset when writing to the mosaic register while mosaic is already enabled

(Fixes FF3 battle mosaic)
This commit is contained in:
Sour 2019-07-10 23:13:06 -04:00
parent c6f8ab4276
commit f40b9527af

View file

@ -1786,15 +1786,18 @@ void Ppu::Write(uint32_t addr, uint8_t value)
_layerConfig[3].LargeTiles = (value & 0x80) != 0; _layerConfig[3].LargeTiles = (value & 0x80) != 0;
break; break;
case 0x2106: case 0x2106: {
//MOSAIC - Screen Pixelation //MOSAIC - Screen Pixelation
_mosaicSize = ((value & 0xF0) >> 4) + 1; _mosaicSize = ((value & 0xF0) >> 4) + 1;
_mosaicEnabled = value & 0x0F; uint8_t mosaicEnabled = value & 0x0F;
if(_mosaicEnabled) { if(!_mosaicEnabled && mosaicEnabled) {
//"If this register is set during the frame, the <20>starting scanline is the current scanline, otherwise it is the first visible scanline of the frame." //"If this register is set during the frame, the <20>starting scanline is the current scanline, otherwise it is the first visible scanline of the frame."
//This is only done when mosaic is turned on from an off state (FF3 mosaic effect looks wrong otherwise)
_mosaicStartScanline = _scanline; _mosaicStartScanline = _scanline;
} }
_mosaicEnabled = mosaicEnabled;
break; break;
}
case 0x2107: case 0x2108: case 0x2109: case 0x210A: case 0x2107: case 0x2108: case 0x2109: case 0x210A:
//BG 1-4 Tilemap Address and Size (BG1SC, BG2SC, BG3SC, BG4SC) //BG 1-4 Tilemap Address and Size (BG1SC, BG2SC, BG3SC, BG4SC)
@ -2157,7 +2160,7 @@ void Ppu::RenderTilemap()
template<uint8_t layerIndex, bool forMainScreen, bool processHighPriority> template<uint8_t layerIndex, bool forMainScreen, bool processHighPriority>
void Ppu::RenderTilemapMode7() void Ppu::RenderTilemapMode7()
{ {
bool applyMosaic = forMainScreen && ((_mosaicEnabled >> layerIndex) & 0x01) != 0; bool applyMosaic = ((_mosaicEnabled >> layerIndex) & 0x01) != 0;
if(applyMosaic) { if(applyMosaic) {
RenderTilemapMode7<layerIndex, forMainScreen, processHighPriority, true>(); RenderTilemapMode7<layerIndex, forMainScreen, processHighPriority, true>();