mirror of https://github.com/snes9xgit/snes9x.git
Adjust snapshot to load old DSP data.
This commit is contained in:
parent
410c52a7c9
commit
f1881a21fc
|
@ -350,7 +350,6 @@ void S9xAPULoadState(uint8 *block)
|
|||
|
||||
SNES::smp.load_state(&ptr);
|
||||
SNES::dsp.load_state(&ptr);
|
||||
|
||||
spc::reference_time = SNES::get_le32(ptr);
|
||||
ptr += sizeof(int32);
|
||||
spc::remainder = SNES::get_le32(ptr);
|
||||
|
|
23
snapshot.cpp
23
snapshot.cpp
|
@ -1576,11 +1576,30 @@ int S9xUnfreezeFromStream (STREAM stream)
|
|||
if (local_fillram)
|
||||
memcpy(Memory.FillRAM, local_fillram, 0x8000);
|
||||
|
||||
if(version < SNAPSHOT_VERSION_BAPU) {
|
||||
if (version < SNAPSHOT_VERSION_BAPU)
|
||||
{
|
||||
printf("Using Blargg APU snapshot loading (snapshot version %d, current is %d)\n...", version, SNAPSHOT_VERSION);
|
||||
S9xAPULoadBlarggState(local_apu_sound);
|
||||
} else
|
||||
}
|
||||
else if (version < 12)
|
||||
{
|
||||
printf("Adjusting old APU snapshot (snapshot version %d, current is %d)\n", version, SNAPSHOT_VERSION);
|
||||
const size_t spc_block_size = 65700;
|
||||
const size_t old_dsp_block_size = 514;
|
||||
const size_t added_bytes_v12 = 128;
|
||||
const size_t bytes_afterward = 16;
|
||||
// Shift end to make room for extra 128 bytes
|
||||
memmove(local_apu_sound + spc_block_size + old_dsp_block_size + added_bytes_v12,
|
||||
local_apu_sound + spc_block_size + old_dsp_block_size,
|
||||
bytes_afterward);
|
||||
// Copy saved internal registers to external registers
|
||||
memmove(local_apu_sound + spc_block_size + old_dsp_block_size, local_apu_sound + spc_block_size, added_bytes_v12);
|
||||
S9xAPULoadState(local_apu_sound);
|
||||
}
|
||||
else if (version >= 12)
|
||||
{
|
||||
S9xAPULoadState(local_apu_sound);
|
||||
}
|
||||
|
||||
struct SControlSnapshot ctl_snap;
|
||||
UnfreezeStructFromCopy(&ctl_snap, SnapControls, COUNT(SnapControls), local_control_data, version);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#define SNAPSHOT_VERSION_IRQ 7
|
||||
#define SNAPSHOT_VERSION_BAPU 8
|
||||
#define SNAPSHOT_VERSION_IRQ_2018 11 // irq changes were introduced earlier, since this we store NextIRQTimer directly
|
||||
#define SNAPSHOT_VERSION 11
|
||||
#define SNAPSHOT_VERSION 12
|
||||
|
||||
#define SUCCESS 1
|
||||
#define WRONG_FORMAT (-1)
|
||||
|
|
Loading…
Reference in New Issue