all repos — mgba @ 7b610da73563eda211aa3d453990b8c46f7e1ba7

mGBA Game Boy Advance Emulator

GB: Fix sram if GBLoadSave is not called
Jeffrey Pfau jeffrey@endrift.com
Tue, 23 Feb 2016 23:01:51 -0800
commit

7b610da73563eda211aa3d453990b8c46f7e1ba7

parent

05ef05317c2cb639e41648ddc74256b7977972eb

2 files changed, 3 insertions(+), 2 deletions(-)

jump to
M src/gb/gb.csrc/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.csrc/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;