all repos — mgba @ cd448324c5f837ff3eab5b87bda66bbaa44a7be6

mGBA Game Boy Advance Emulator

Fixed the first load from SRAM not returning a value
Jeffrey Pfau jeffrey@endrift.com
Sat, 26 Oct 2013 03:04:21 -0700
commit

cd448324c5f837ff3eab5b87bda66bbaa44a7be6

parent

9c922862e8f26aa06f86aefd6c4dec98c9ee815a

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

jump to
M src/gba/gba-memory.csrc/gba/gba-memory.c

@@ -318,7 +318,8 @@ case BASE_CART_SRAM:

wait = gbaMemory->waitstates16[address >> BASE_OFFSET]; if (gbaMemory->savedata.type == SAVEDATA_NONE) { GBASavedataInitSRAM(&gbaMemory->savedata); - } else if (gbaMemory->savedata.type == SAVEDATA_SRAM) { + } + if (gbaMemory->savedata.type == SAVEDATA_SRAM) { value = gbaMemory->savedata.data[address & (SIZE_CART_SRAM - 1)]; } else if (gbaMemory->savedata.type == SAVEDATA_FLASH512 || gbaMemory->savedata.type == SAVEDATA_FLASH1M) { value = GBASavedataReadFlash(&gbaMemory->savedata, address);