GB: Fix sram if GBLoadSave is not called
Jeffrey Pfau jeffrey@endrift.com
Tue, 23 Feb 2016 23:01:51 -0800
2 files changed,
3 insertions(+),
2 deletions(-)
M
src/gb/gb.c
→
src/gb/gb.c
@@ -102,8 +102,6 @@ if (vf->size(vf) < 0x20000) {
vf->truncate(vf, 0x20000); } gb->memory.sram = vf->map(vf, 0x20000, MAP_WRITE); - } else { - gb->memory.sram = anonymousMemoryMap(0x20000); } return gb->memory.sram; }
M
src/gb/memory.c
→
src/gb/memory.c
@@ -108,6 +108,9 @@ gb->memory.wram = anonymousMemoryMap(GB_SIZE_WORKING_RAM);
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;