cdrom: keep savestate compat
authornotaz <notasas@gmail.com>
Sun, 30 Dec 2012 01:40:17 +0000 (03:40 +0200)
committernotaz <notasas@gmail.com>
Wed, 2 Jan 2013 23:06:43 +0000 (01:06 +0200)
libpcsxcore/cdrom.c
libpcsxcore/cdrom.h

index 6923c02..78db291 100644 (file)
@@ -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;
index 7bca811..541a12b 100644 (file)
@@ -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];