aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraliaspider2014-10-30 08:36:43 +0100
committeraliaspider2014-10-30 08:36:43 +0100
commitc78e8e29c83bb28352309250e8476ff4df47d490 (patch)
tree800e085c567b281f2a71a3966dd0d542ae4d7e05
parent9f4aec5c8e5c6c0689815d7f6f5c7b4694eb775c (diff)
downloadsnesemu-c78e8e29c83bb28352309250e8476ff4df47d490.tar.gz
snesemu-c78e8e29c83bb28352309250e8476ff4df47d490.tar.bz2
snesemu-c78e8e29c83bb28352309250e8476ff4df47d490.zip
improve serialization code, still unfinished.
-rw-r--r--libretro.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/libretro.c b/libretro.c
index ef3965c..92acc8d 100644
--- a/libretro.c
+++ b/libretro.c
@@ -559,7 +559,7 @@ size_t retro_serialize_size(void)
s += 0x20000;
s += 0x8000;
s += sizeof(APU);
- s += sizeof(IAPU.Registers);
+ s += sizeof(IAPU);
s += 0x10000;
s += sizeof(SA1);
s += sizeof(s7r);
@@ -606,8 +606,8 @@ bool retro_serialize(void* data, size_t size)
buffer += 0x8000;
memcpy(buffer, &APU, sizeof(APU));
buffer += sizeof(APU);
- memcpy(buffer, &IAPU.Registers, sizeof(IAPU.Registers));
- buffer += sizeof(IAPU.Registers);
+ memcpy(buffer, &IAPU, sizeof(IAPU));
+ buffer += sizeof(IAPU);
memcpy(buffer, IAPU.RAM, 0x10000);
buffer += 0x10000;
@@ -650,8 +650,8 @@ bool retro_unserialize(const void* data, size_t size)
buffer += 0x8000;
memcpy(&APU, buffer, sizeof(APU));
buffer += sizeof(APU);
- memcpy(&IAPU.Registers, buffer, sizeof(IAPU.Registers));
- buffer += sizeof(IAPU.Registers);
+ memcpy(&IAPU, buffer, sizeof(IAPU));
+ buffer += sizeof(IAPU);
memcpy(IAPU.RAM, buffer, 0x10000);
buffer += 0x10000;
@@ -662,23 +662,25 @@ bool retro_unserialize(const void* data, size_t size)
memcpy(&rtc_f9, buffer, sizeof(rtc_f9));
buffer += sizeof(rtc_f9);
- S9xFixCycles();
+// S9xFixCycles();
S9xFixSA1AfterSnapshotLoad();
-// FixROMSpeed();
-// IPPU.ColorsChanged = TRUE;
-// IPPU.OBJChanged = TRUE;
-// CPU.InDMA = FALSE;
-// S9xFixColourBrightness();
+ FixROMSpeed();
+ IPPU.ColorsChanged = TRUE;
+ IPPU.OBJChanged = TRUE;
+ CPU.InDMA = FALSE;
+ S9xFixColourBrightness();
// IPPU.RenderThisFrame = FALSE;
-// S9xFixSoundAfterSnapshotLoad();
-// ICPU.ShiftedPB = ICPU.Registers.PB << 16;
-// ICPU.ShiftedDB = ICPU.Registers.DB << 16;
-// S9xSetPCBase(ICPU.ShiftedPB + ICPU.Registers.PC);
-// S9xUnpackStatus();
-//// S9xFixCycles();
-// S9xReschedule();
+ S9xAPUUnpackStatus();
+ S9xSA1UnpackStatus();
+ S9xFixSoundAfterSnapshotLoad();
+ ICPU.ShiftedPB = ICPU.Registers.PB << 16;
+ ICPU.ShiftedDB = ICPU.Registers.DB << 16;
+ S9xSetPCBase(ICPU.ShiftedPB + ICPU.Registers.PC);
+ S9xUnpackStatus();
+ S9xFixCycles();
+ S9xReschedule();
return true;
#else