bugfix in bram code
authornotaz <notasas@gmail.com>
Wed, 4 Apr 2007 19:20:47 +0000 (19:20 +0000)
committernotaz <notasas@gmail.com>
Wed, 4 Apr 2007 19:20:47 +0000 (19:20 +0000)
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@89 be3aeb3a-fb24-0410-a615-afba39da0efa

platform/gp2x/emu.c

index 074d620..eca0dc4 100644 (file)
@@ -1493,6 +1493,8 @@ int emu_SaveLoadGame(int load, int sram)
 \r
                        if (sram_size) {\r
                                sramFile = fopen(saveFname, truncate ? "wb" : "r+b");\r
+                               if (!sramFile) sramFile = fopen(saveFname, "wb"); // retry\r
+                               if (!sramFile) return -1;\r
                                ret = fwrite(sram_data, 1, sram_size, sramFile);\r
                                ret = (ret != sram_size) ? -1 : 0;\r
                                fclose(sramFile);\r