From: notaz Date: Wed, 4 Apr 2007 19:20:47 +0000 (+0000) Subject: bugfix in bram code X-Git-Tag: v1.85~722 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18e95d7f8ad110d2d2f5c5b25fb997abf98da646;p=picodrive.git bugfix in bram code git-svn-id: file:///home/notaz/opt/svn/PicoDrive@89 be3aeb3a-fb24-0410-a615-afba39da0efa --- diff --git a/platform/gp2x/emu.c b/platform/gp2x/emu.c index 074d620f..eca0dc4d 100644 --- a/platform/gp2x/emu.c +++ b/platform/gp2x/emu.c @@ -1493,6 +1493,8 @@ int emu_SaveLoadGame(int load, int sram) if (sram_size) { sramFile = fopen(saveFname, truncate ? "wb" : "r+b"); + if (!sramFile) sramFile = fopen(saveFname, "wb"); // retry + if (!sramFile) return -1; ret = fwrite(sram_data, 1, sram_size, sramFile); ret = (ret != sram_size) ? -1 : 0; fclose(sramFile);