aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAutechre2020-10-18 16:48:15 +0200
committerGitHub2020-10-18 16:48:15 +0200
commit00d40e98c526234a36973b9814a2420eba5f7cbe (patch)
tree6f74382fda871adc6052d41479476b1d76b5c00b
parent08bdd822ac599f4127b1ea24d4b480941f855b07 (diff)
parent1975ec5934e08c073020ebc78b1230fb96196cad (diff)
downloadsnes9x2005-00d40e98c526234a36973b9814a2420eba5f7cbe.tar.gz
snes9x2005-00d40e98c526234a36973b9814a2420eba5f7cbe.tar.bz2
snes9x2005-00d40e98c526234a36973b9814a2420eba5f7cbe.zip
Merge pull request #78 from jdgleaver/save-state-fix
Snes9x2005 (Non-Plus): Fix save state audio
-rw-r--r--libretro.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libretro.c b/libretro.c
index 21d2c17..4c1e0c0 100644
--- a/libretro.c
+++ b/libretro.c
@@ -693,7 +693,7 @@ size_t retro_serialize_size(void)
return sizeof(CPU) + sizeof(ICPU) + sizeof(PPU) + sizeof(DMA) +
0x10000 + 0x20000 + 0x20000 + 0x8000 +
#ifndef USE_BLARGG_APU
- sizeof(APU) + sizeof(IAPU) + 0x10000 +
+ sizeof(APU) + sizeof(IAPU) + 0x10000 + sizeof(SoundData) +
#else
SPC_SAVE_STATE_BLOCK_SIZE +
#endif
@@ -736,6 +736,8 @@ bool retro_serialize(void* data, size_t size)
buffer += sizeof(IAPU);
memcpy(buffer, IAPU.RAM, 0x10000);
buffer += 0x10000;
+ memcpy(buffer, &SoundData, sizeof(SoundData));
+ buffer += sizeof(SoundData);
#else
S9xAPUSaveState(buffer);
buffer += SPC_SAVE_STATE_BLOCK_SIZE;
@@ -794,6 +796,8 @@ bool retro_unserialize(const void* data, size_t size)
IAPU.RAM = IAPU_RAM_current;
memcpy(IAPU.RAM, buffer, 0x10000);
buffer += 0x10000;
+ memcpy(&SoundData, buffer, sizeof(SoundData));
+ buffer += sizeof(SoundData);
#else
S9xAPULoadState(buffer);
buffer += SPC_SAVE_STATE_BLOCK_SIZE;
@@ -811,7 +815,6 @@ bool retro_unserialize(const void* data, size_t size)
IPPU.OBJChanged = true;
CPU.InDMA = false;
S9xFixColourBrightness();
- S9xSA1UnpackStatus();
#ifndef USE_BLARGG_APU
S9xAPUUnpackStatus();
S9xFixSoundAfterSnapshotLoad();