Fix save state error.

This commit is contained in:
Brandon Wright 2011-09-07 11:46:52 -05:00
parent 4fdc7af7da
commit 4668ae5850
4 changed files with 18 additions and 8 deletions

View File

@ -625,13 +625,9 @@ void S9xAPULoadState (uint8 *block)
{
uint8 *ptr = block;
S9xResetAPU();
SNES::smp.load_state (&ptr);
SNES::dsp.load_state (&ptr);
SNES::dsp.spc_dsp.set_output ((SNES::SPC_DSP::sample_t *) spc::landing_buffer, spc::buffer_size >> 1);
spc::reference_time = SNES::get_le32(ptr);
ptr += sizeof(int32);
spc::remainder = SNES::get_le32(ptr);
@ -655,7 +651,8 @@ bool8 S9xSPCDump (const char *filename)
SNES::smp.save_spc (buf);
ignore = fwrite(buf, SPC_FILE_SIZE, 1, fs);
if ((ignore = fwrite(buf, SPC_FILE_SIZE, 1, fs)) <= 0)
fprintf (stderr, "Couldn't write file %s.\n", filename);
fclose(fs);

View File

@ -44,7 +44,6 @@ void SMP::op_step() {
#define op_writeaddr(addr, data) op_write(addr, data)
#define op_readstack() op_read(0x0100 | ++regs.sp)
#define op_writestack(data) op_write(0x0100 | regs.sp--, data)
static unsigned rd, wr, dp, sp, ya, bit;
#if defined(CYCLE_ACCURATE)

View File

@ -50,6 +50,8 @@ public:
unsigned opcode_number;
unsigned opcode_cycle;
unsigned rd, wr, dp, sp, ya, bit;
struct Regs {
uint16 pc;
uint8 sp;

View File

@ -118,11 +118,17 @@ void SMP::save_state(uint8 **block) {
INT32(timer2.enable);
INT32(timer2.target);
INT32(timer2.stage1_ticks);
INT32(timer2.stage2_ticks);
INT32(timer2.stage3_ticks);
INT32(rd);
INT32(wr);
INT32(dp);
INT32(sp);
INT32(ya);
INT32(bit);
*block = ptr;
}
@ -174,11 +180,17 @@ void SMP::load_state(uint8 **block) {
INT32(timer2.enable);
INT32(timer2.target);
INT32(timer2.stage1_ticks);
INT32(timer2.stage2_ticks);
INT32(timer2.stage3_ticks);
INT32(rd);
INT32(wr);
INT32(dp);
INT32(sp);
INT32(ya);
INT32(bit);
*block = ptr;
}