diff --git a/src/gb/gb.c b/src/gb/gb.c index 83b17b86b..0ef8c855f 100644 --- a/src/gb/gb.c +++ b/src/gb/gb.c @@ -77,6 +77,9 @@ bool GBLoadROM(struct GB* gb, struct VFile* vf, struct VFile* sav, const char* f 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);