Sonic CD shows it's title screen
authornotaz <notasas@gmail.com>
Sun, 14 Jan 2007 19:27:47 +0000 (19:27 +0000)
committernotaz <notasas@gmail.com>
Sun, 14 Jan 2007 19:27:47 +0000 (19:27 +0000)
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@19 be3aeb3a-fb24-0410-a615-afba39da0efa

gp2x/emu.c

index 666537c..bea1569 100644 (file)
@@ -771,8 +771,6 @@ static void RunEvents(unsigned int which)
                }\r
                if (do_it) {\r
                        blit("", (which & 0x1000) ? "LOADING GAME" : "SAVING GAME");\r
-                       if(movie_data) {\r
-                       }\r
                        emu_SaveLoadGame(which & 0x1000, 0);\r
                }\r
 \r
@@ -1269,7 +1267,7 @@ int emu_SaveLoadGame(int load, int sram)
 \r
        // make save filename\r
        romfname_ext(saveFname, "");\r
-       if(sram) strcat(saveFname, ".srm");\r
+       if(sram) strcat(saveFname, (PicoMCD&1) ? ".brm" : ".srm");\r
        else {\r
                if(state_slot > 0 && state_slot < 10) sprintf(saveFname, "%s.%i", saveFname, state_slot);\r
                strcat(saveFname, ".mds");\r
@@ -1279,30 +1277,41 @@ int emu_SaveLoadGame(int load, int sram)
 \r
        if(sram) {\r
                FILE *sramFile;\r
-               int sram_size = SRam.end-SRam.start+1;\r
-               if(SRam.reg_back & 4) sram_size=0x2000;\r
-               if(!SRam.data) return 0; // SRam forcefully disabled for this game\r
+               int sram_size;\r
+               unsigned char *sram_data;\r
+               if (PicoMCD&1) {\r
+                       sram_size = 0x2000;\r
+                       sram_data = Pico_mcd->bram;\r
+               } else {\r
+                       sram_size = SRam.end-SRam.start+1;\r
+                       if(SRam.reg_back & 4) sram_size=0x2000;\r
+                       sram_data = SRam.data;\r
+               }\r
+               if(!sram_data) return 0; // SRam forcefully disabled for this game\r
+\r
                if(load) {\r
                        sramFile = fopen(saveFname, "rb");\r
                        if(!sramFile) return -1;\r
-                       fread(SRam.data, 1, sram_size, sramFile);\r
+                       fread(sram_data, 1, sram_size, sramFile);\r
                        fclose(sramFile);\r
                } else {\r
                        // sram save needs some special processing\r
                        // see if we have anything to save\r
                        for(; sram_size > 0; sram_size--)\r
-                               if(SRam.data[sram_size-1]) break;\r
+                               if(sram_data[sram_size-1]) break;\r
 \r
                        if(sram_size) {\r
                                sramFile = fopen(saveFname, "wb");\r
-                               ret = fwrite(SRam.data, 1, sram_size, sramFile);\r
+                               ret = fwrite(sram_data, 1, sram_size, sramFile);\r
                                ret = (ret != sram_size) ? -1 : 0;\r
                                fclose(sramFile);\r
                                sync();\r
                        }\r
                }\r
                return ret;\r
-       } else {\r
+       }\r
+       else\r
+       {\r
                void *PmovFile = NULL;\r
                // try gzip first\r
                if(currentConfig.EmuOpt & 8) {\r