From 75c7dff48f4b3d1a74eb20716150012248fd6308 Mon Sep 17 00:00:00 2001 From: skidau Date: Fri, 22 May 2015 11:05:45 +0000 Subject: [PATCH] Save SRAM battery files as 8KB files. git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@1474 a31d4220-a93d-0410-bf67-fe4944624d44 --- src/gba/GBA.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gba/GBA.cpp b/src/gba/GBA.cpp index a5f32600..5454f766 100644 --- a/src/gba/GBA.cpp +++ b/src/gba/GBA.cpp @@ -1068,7 +1068,7 @@ bool CPUWriteBatteryFile(const char *fileName) return false; } } else { - if(fwrite(flashSaveMemory, 1, 0x10000, file) != 0x10000) { + if(fwrite(flashSaveMemory, 1, 0x8000, file) != 0x8000) { fclose(file); return false; } @@ -1335,12 +1335,17 @@ bool CPUReadBatteryFile(const char *fileName) return false; } flashSetSize(0x20000); - } else { + } else if(size == 0x10000) { if(fread(flashSaveMemory, 1, 0x10000, file) != 0x10000) { fclose(file); return false; } flashSetSize(0x10000); + } else if (size == 0x8000) { + if (fread(flashSaveMemory, 1, 0x8000, file) != 0x8000) { + fclose(file); + return false; + } } } fclose(file);