From 42cd1b4bc90873d421e20e4cf69077394565aa67 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 30 Oct 2014 23:27:44 +0100 Subject: Refactor S9xSetSuperFX the same way as SNES9x Next code --- source/ppu.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'source') diff --git a/source/ppu.c b/source/ppu.c index a72d9ab..c9fe82e 100644 --- a/source/ppu.c +++ b/source/ppu.c @@ -202,13 +202,17 @@ void S9xFixColourBrightness() static void S9xSetSuperFX(uint8 Byte, uint16 Address) { + uint8 old_fill_ram; if (!Settings.SuperFX) return; + old_fill_ram = Memory.FillRAM[Address]; + Memory.FillRAM[Address] = Byte; + switch (Address) { case 0x3030: - if ((Memory.FillRAM [0x3030] ^ Byte) & FLG_G) + if ((old_fill_ram ^ Byte) & FLG_G) { Memory.FillRAM [Address] = Byte; // Go flag has been changed @@ -217,8 +221,6 @@ static void S9xSetSuperFX(uint8 Byte, uint16 Address) else FxFlushCache(); } - else - Memory.FillRAM [Address] = Byte; break; case 0x3031: @@ -227,35 +229,29 @@ static void S9xSetSuperFX(uint8 Byte, uint16 Address) case 0x3039: case 0x303a: case 0x303f: - Memory.FillRAM [Address] = Byte; break; case 0x3034: case 0x3036: - Memory.FillRAM [Address] = Byte & 0x7f; + Memory.FillRAM [Address] &= 0x7f; break; case 0x3038: - Memory.FillRAM [Address] = Byte; fx_dirtySCBR(); break; case 0x303b: break; case 0x303c: - Memory.FillRAM [Address] = Byte; fx_updateRamBank(Byte); break; case 0x301f: - Memory.FillRAM [Address] = Byte; Memory.FillRAM [0x3000 + GSU_SFR] |= FLG_G; S9xSuperFXExec(); - return; + break; default: - Memory.FillRAM[Address] = Byte; if (Address >= 0x3100) FxCacheWriteAccess(Address); break; } - return; } /******************************************************************************/ -- cgit v1.2.3