From c69642c80a8f3333354a589b5dabdb17f0f23e9b Mon Sep 17 00:00:00 2001 From: notaz Date: Sun, 30 Dec 2012 03:40:17 +0200 Subject: [PATCH] cdrom: keep savestate compat --- libpcsxcore/cdrom.c | 9 +++++++++ libpcsxcore/cdrom.h | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c index 6923c021..78db2914 100644 --- a/libpcsxcore/cdrom.c +++ b/libpcsxcore/cdrom.c @@ -1648,6 +1648,7 @@ int cdrFreeze(void *f, int Mode) { if (Mode == 0 && !Config.Cdda) CDR_stop(); + cdr.freeze_ver = 0x63647201; gzfreeze(&cdr, sizeof(cdr)); if (Mode == 1) { @@ -1672,6 +1673,14 @@ int cdrFreeze(void *f, int Mode) { if (!Config.Cdda) CDR_play(cdr.SetSectorPlay); } + + if ((cdr.freeze_ver & 0xffffff00) != 0x63647200) { + // old versions did not latch Reg2, have to fixup.. + if (cdr.Reg2 == 0) { + SysPrintf("cdrom: fixing up old savestate\n"); + cdr.Reg2 = 7; + } + } } return 0; diff --git a/libpcsxcore/cdrom.h b/libpcsxcore/cdrom.h index 7bca8119..541a12b9 100644 --- a/libpcsxcore/cdrom.h +++ b/libpcsxcore/cdrom.h @@ -60,7 +60,7 @@ typedef struct { } subq; unsigned char TrackChanged; unsigned char pad1[3]; - unsigned int pad3; + unsigned int freeze_ver; unsigned char Prev[4]; unsigned char Param[8]; -- 2.39.5