GB: Make sure save files are large enough
Jeffrey Pfau jeffrey@endrift.com
Mon, 25 Jan 2016 22:20:18 -0800
1 files changed,
3 insertions(+),
0 deletions(-)
jump to
M
src/gb/gb.c
→
src/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);