mirror of https://github.com/mgba-emu/mgba.git
GB: Make sure save files are large enough
This commit is contained in:
parent
61e7cc9556
commit
5d7a43639b
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue