mirror of
https://github.com/libretro/RACE.git
synced 2024-11-23 08:59:49 +00:00
Cleanups
This commit is contained in:
parent
d2ea99caaf
commit
94eda9b212
88
state.c
88
state.c
@ -259,94 +259,6 @@ static int state_restore(race_state_t *rs)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int state_restore_0x10(FILE *stream)
|
||||
{
|
||||
struct race_state_0x10 rs;
|
||||
if (fread(&rs, sizeof(rs), 1, stream) < 1)
|
||||
return 0;
|
||||
|
||||
/* Verify state version */
|
||||
if (rs.state_version != 0x10)
|
||||
return 0;
|
||||
|
||||
/* Verify ROM signature */
|
||||
if (memcmp(mainrom, rs.rom_signature, sizeof(rs.rom_signature)) != 0)
|
||||
return 0;
|
||||
|
||||
/* TLCS-900h Registers */
|
||||
gen_regsPC = rs.pc;
|
||||
gen_regsSR = rs.sr;
|
||||
F2 = rs.f_dash;
|
||||
|
||||
int i = 0;
|
||||
gen_regsXWA0 = rs.gpr[i++];
|
||||
gen_regsXBC0 = rs.gpr[i++];
|
||||
gen_regsXDE0 = rs.gpr[i++];
|
||||
gen_regsXHL0 = rs.gpr[i++];
|
||||
|
||||
gen_regsXWA1 = rs.gpr[i++];
|
||||
gen_regsXBC1 = rs.gpr[i++];
|
||||
gen_regsXDE1 = rs.gpr[i++];
|
||||
gen_regsXHL1 = rs.gpr[i++];
|
||||
|
||||
gen_regsXWA2 = rs.gpr[i++];
|
||||
gen_regsXBC2 = rs.gpr[i++];
|
||||
gen_regsXDE2 = rs.gpr[i++];
|
||||
gen_regsXHL2 = rs.gpr[i++];
|
||||
|
||||
gen_regsXWA3 = rs.gpr[i++];
|
||||
gen_regsXBC3 = rs.gpr[i++];
|
||||
gen_regsXDE3 = rs.gpr[i++];
|
||||
gen_regsXHL3 = rs.gpr[i++];
|
||||
|
||||
gen_regsXIX = rs.gpr[i++];
|
||||
gen_regsXIY = rs.gpr[i++];
|
||||
gen_regsXIZ = rs.gpr[i++];
|
||||
gen_regsXSP = rs.gpr[i++];
|
||||
|
||||
gen_regsSP = rs.gpr[i++];
|
||||
gen_regsXSSP = rs.gpr[i++];
|
||||
gen_regsXNSP = rs.gpr[i++];
|
||||
|
||||
/* Z80 Registers */
|
||||
#ifdef CZ80
|
||||
extern cz80_struc *RACE_cz80_struc;
|
||||
extern s32 Z80_ICount;
|
||||
int size_of_z80 =
|
||||
(u32*)(&(RACE_cz80_struc->CycleSup)) - (u32*)(&(RACE_cz80_struc->BC));
|
||||
|
||||
memcpy(RACE_cz80_struc, &rs.RACE_cz80_struc, size_of_z80);
|
||||
Z80_ICount = rs.Z80_ICount;
|
||||
Cz80_Set_PC(RACE_cz80_struc, rs.PC_offset);
|
||||
#elif DRZ80
|
||||
extern Z80_Regs Z80;
|
||||
memcpy(&Z80, &rs.Z80, sizeof(Z80));
|
||||
#endif
|
||||
|
||||
/* Sound Chips */
|
||||
extern int sndCycles;
|
||||
sndCycles = rs.sndCycles;
|
||||
memcpy(&toneChip, &rs.toneChip, sizeof(SoundChip));
|
||||
memcpy(&noiseChip, &rs.noiseChip, sizeof(SoundChip));
|
||||
|
||||
/* Timers */
|
||||
timer0 = rs.timer0;
|
||||
timer1 = rs.timer1;
|
||||
timer2 = rs.timer2;
|
||||
timer3 = rs.timer3;
|
||||
|
||||
/* DMA */
|
||||
memcpy(&ldcRegs, &rs.ldcRegs, sizeof(ldcRegs));
|
||||
|
||||
/* Memory */
|
||||
memcpy(mainram, rs.ram, sizeof(rs.ram));
|
||||
memcpy(&mainram[0x20000], rs.cpuram, sizeof(rs.cpuram));
|
||||
|
||||
tlcs_reinit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int state_store_mem(void *state)
|
||||
{
|
||||
return state_store((race_state_t*)state);
|
||||
|
Loading…
Reference in New Issue
Block a user