all repos — mgba @ 5d7a43639b444c14d98c92ea5e8a06f9059cd847

mGBA Game Boy Advance Emulator

GB: Make sure save files are large enough
Jeffrey Pfau jeffrey@endrift.com
Mon, 25 Jan 2016 22:20:18 -0800
commit

5d7a43639b444c14d98c92ea5e8a06f9059cd847

parent

61e7cc9556eaa118efa209c2b9cef2a550539bb7

1 files changed, 3 insertions(+), 0 deletions(-)

jump to
M src/gb/gb.csrc/gb/gb.c

@@ -77,6 +77,9 @@ gb->memory.romSize = gb->pristineRomSize;

gb->romCrc32 = doCrc32(gb->memory.rom, gb->memory.romSize); gb->sramVf = sav; if (sav) { + if (sav->size(sav) < 0x8000) { + sav->truncate(sav, 0x8000); + } gb->memory.sram = sav->map(sav, 0x8000, MAP_WRITE); } else { gb->memory.sram = anonymousMemoryMap(0x8000);