From: notaz Date: Wed, 4 Apr 2007 19:20:47 +0000 (+0000) Subject: bugfix in bram code X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ac747cb32039742c8bebb98db9fe7c39ceb6c6f;p=libpicofe.git bugfix in bram code git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@89 be3aeb3a-fb24-0410-a615-afba39da0efa --- diff --git a/gp2x/emu.c b/gp2x/emu.c index 074d620..eca0dc4 100644 --- a/gp2x/emu.c +++ b/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);