aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortwinaphex2014-10-30 23:25:01 +0100
committertwinaphex2014-10-30 23:25:01 +0100
commit1038f9e48249d9d5d550c32a64b7f3ad7574b9ca (patch)
treee27ebbde79719020fa71c91c3e4400880d761c95
parentc78e8e29c83bb28352309250e8476ff4df47d490 (diff)
downloadsnesemu-1038f9e48249d9d5d550c32a64b7f3ad7574b9ca.tar.gz
snesemu-1038f9e48249d9d5d550c32a64b7f3ad7574b9ca.tar.bz2
snesemu-1038f9e48249d9d5d550c32a64b7f3ad7574b9ca.zip
Refactor code to function S9xSetSuperFX to make it more like
S9x Next codebase
-rw-r--r--source/ppu.c113
1 files changed, 60 insertions, 53 deletions
diff --git a/source/ppu.c b/source/ppu.c
index e0e451a..a72d9ab 100644
--- a/source/ppu.c
+++ b/source/ppu.c
@@ -200,6 +200,64 @@ void S9xFixColourBrightness()
}
}
+static void S9xSetSuperFX(uint8 Byte, uint16 Address)
+{
+ if (!Settings.SuperFX)
+ return;
+
+ switch (Address)
+ {
+ case 0x3030:
+ if ((Memory.FillRAM [0x3030] ^ Byte) & FLG_G)
+ {
+ Memory.FillRAM [Address] = Byte;
+ // Go flag has been changed
+ if (Byte & FLG_G)
+ S9xSuperFXExec();
+ else
+ FxFlushCache();
+ }
+ else
+ Memory.FillRAM [Address] = Byte;
+ break;
+
+ case 0x3031:
+ case 0x3033:
+ case 0x3037:
+ case 0x3039:
+ case 0x303a:
+ case 0x303f:
+ Memory.FillRAM [Address] = Byte;
+ break;
+ case 0x3034:
+ case 0x3036:
+ Memory.FillRAM [Address] = Byte & 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;
+
+ default:
+ Memory.FillRAM[Address] = Byte;
+ if (Address >= 0x3100)
+ FxCacheWriteAccess(Address);
+ break;
+ }
+ return;
+}
+
/******************************************************************************/
/* S9xSetPPU() */
/* This function sets a PPU Register to a specific byte */
@@ -879,60 +937,9 @@ void S9xSetPPU(uint8 Byte, uint16 Address)
S9xSetSRTC(Byte, Address);
else if (Address >= 0x3000 && Address < 0x3300)
{
- if (!Settings.SuperFX)
- return;
-
- switch (Address)
- {
- case 0x3030:
- if ((Memory.FillRAM [0x3030] ^ Byte) & FLG_G)
- {
- Memory.FillRAM [Address] = Byte;
- // Go flag has been changed
- if (Byte & FLG_G)
- S9xSuperFXExec();
- else
- FxFlushCache();
- }
- else
- Memory.FillRAM [Address] = Byte;
- break;
-
- case 0x3031:
- case 0x3033:
- case 0x3037:
- case 0x3039:
- case 0x303a:
- case 0x303f:
- Memory.FillRAM [Address] = Byte;
- break;
- case 0x3034:
- case 0x3036:
- Memory.FillRAM [Address] = Byte & 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;
-
- default:
- Memory.FillRAM[Address] = Byte;
- if (Address >= 0x3100)
- FxCacheWriteAccess(Address);
- break;
- }
+ S9xSetSuperFX(Byte, Address);
return;
+
}
}
Memory.FillRAM[Address] = Byte;