aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortwinaphex2014-10-30 23:27:44 +0100
committertwinaphex2014-10-30 23:27:44 +0100
commit42cd1b4bc90873d421e20e4cf69077394565aa67 (patch)
treeda8d78727066a8d0cc7d25795becd5568081f477
parent1038f9e48249d9d5d550c32a64b7f3ad7574b9ca (diff)
downloadsnesemu-42cd1b4bc90873d421e20e4cf69077394565aa67.tar.gz
snesemu-42cd1b4bc90873d421e20e4cf69077394565aa67.tar.bz2
snesemu-42cd1b4bc90873d421e20e4cf69077394565aa67.zip
Refactor S9xSetSuperFX the same way as SNES9x Next code
-rw-r--r--source/ppu.c18
1 files changed, 7 insertions, 11 deletions
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;
}
/******************************************************************************/