mirror of https://github.com/mgba-emu/mgba.git
GB: Fix sram if GBLoadSave is not called
This commit is contained in:
parent
05ef05317c
commit
7b610da735
|
@ -102,8 +102,6 @@ bool GBLoadSave(struct GB* gb, struct VFile* vf) {
|
|||
vf->truncate(vf, 0x20000);
|
||||
}
|
||||
gb->memory.sram = vf->map(vf, 0x20000, MAP_WRITE);
|
||||
} else {
|
||||
gb->memory.sram = anonymousMemoryMap(0x20000);
|
||||
}
|
||||
return gb->memory.sram;
|
||||
}
|
||||
|
|
|
@ -108,6 +108,9 @@ void GBMemoryReset(struct GB* gb) {
|
|||
GBMemorySwitchWramBank(&gb->memory, 1);
|
||||
gb->memory.romBank = &gb->memory.rom[GB_SIZE_CART_BANK0];
|
||||
gb->memory.currentBank = 1;
|
||||
if (!gb->memory.sram) {
|
||||
gb->memory.sram = anonymousMemoryMap(0x20000);
|
||||
}
|
||||
gb->memory.sramCurrentBank = 0;
|
||||
gb->memory.sramBank = gb->memory.sram;
|
||||
|
||||
|
|
Loading…
Reference in New Issue