savestates works
authornotaz <notasas@gmail.com>
Mon, 29 Jan 2007 23:39:15 +0000 (23:39 +0000)
committernotaz <notasas@gmail.com>
Mon, 29 Jan 2007 23:39:15 +0000 (23:39 +0000)
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@26 be3aeb3a-fb24-0410-a615-afba39da0efa

gp2x/940ctl_ym2612.c
gp2x/emu.c
linux/940ctl_ym2612.c

index 1352172..63d1e48 100644 (file)
@@ -576,3 +576,22 @@ void mp3_start_play(FILE *f, int pos) // pos is 0-1023
 }\r
 \r
 \r
+int mp3_get_offset(void)\r
+{\r
+       int offs1024 = 0;\r
+       int cdda_on;\r
+\r
+       cdda_on = (PicoMCD & 1) && (currentConfig.EmuOpt&0x800) && !(Pico_mcd->s68k_regs[0x36] & 1) &&\r
+                       (Pico_mcd->scd.Status_CDC & 1) && loaded_mp3 && shared_ctl->mp3_offs < shared_ctl->mp3_len;\r
+\r
+       if (cdda_on) {\r
+               offs1024  = shared_ctl->mp3_offs << 7;\r
+               offs1024 /= shared_ctl->mp3_len;\r
+               offs1024 <<= 3;\r
+       }\r
+       printf("offs1024=%i (%i/%i)\n", offs1024, shared_ctl->mp3_offs, shared_ctl->mp3_len);\r
+\r
+       return offs1024;\r
+}\r
+\r
+\r
index 17e7028..633a780 100644 (file)
@@ -1264,7 +1264,6 @@ size_t gzWrite2(void *p, size_t _size, size_t _n, void *file)
        return gzwrite(file, p, _n);\r
 }\r
 \r
-typedef unsigned int (*STATE_SL_FUNC)(void *, unsigned int, unsigned int, void *);\r
 \r
 int emu_SaveLoadGame(int load, int sram)\r
 {\r
@@ -1326,6 +1325,7 @@ int emu_SaveLoadGame(int load, int sram)
                                areaRead  = gzRead2;\r
                                areaWrite = gzWrite2;\r
                                areaEof   = (areaeof *) gzeof;\r
+                               areaSeek  = (areaseek *) gzseek;\r
                                if(!load) gzsetparams(PmovFile, 9, Z_DEFAULT_STRATEGY);\r
                        } else\r
                                saveFname[strlen(saveFname)-3] = 0;\r
@@ -1335,18 +1335,23 @@ int emu_SaveLoadGame(int load, int sram)
                                areaRead  = (arearw *) fread;\r
                                areaWrite = (arearw *) fwrite;\r
                                areaEof   = (areaeof *) feof;\r
+                               areaSeek  = (areaseek *) fseek;\r
                        }\r
                }\r
                if(PmovFile) {\r
-                       PmovState(load ? 6 : 5, PmovFile);\r
-                       strcpy(noticeMsg, load ? "GAME LOADED  " : "GAME SAVED   ");\r
+                       ret = PmovState(load ? 6 : 5, PmovFile);\r
                        if(areaRead == gzRead2)\r
                                 gzclose(PmovFile);\r
                        else fclose ((FILE *) PmovFile);\r
                        PmovFile = 0;\r
                        if (!load) sync();\r
                        else Pico.m.dirtyPal=1;\r
-               } else {\r
+               }\r
+               else    ret = -1;\r
+               if (!ret)\r
+                       strcpy(noticeMsg, load ? "GAME LOADED  " : "GAME SAVED   ");\r
+               else\r
+               {\r
                        strcpy(noticeMsg, load ? "LOAD FAILED  " : "SAVE FAILED  ");\r
                        ret = -1;\r
                }\r
index 4458a2f..2cfa57b 100644 (file)
@@ -269,4 +269,8 @@ void mp3_start_play(FILE *f, int pos) // pos is 0-1023
 }
 
 
+int mp3_get_offset(void)
+{
+       return 0;
+}