all repos — mgba @ 00cbb6156ba020772fb44d6678d3b9142695c854

mGBA Game Boy Advance Emulator

GBA Savedata: Fix EEPROM writing codepath when savetype is not EEPROM
Vicki Pfau vi@endrift.com
Mon, 19 Nov 2018 21:16:57 -0800
commit

00cbb6156ba020772fb44d6678d3b9142695c854

parent

27feb3ed1f84796e8291eddb156312b469383ff7

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

jump to
M CHANGESCHANGES

@@ -136,6 +136,7 @@ - PSP2: Fix tearing issues (fixes mgba.io/i/1211)

- Qt: Fix mapping analog triggers (fixes mgba.io/i/495) - Qt: Grab focus when game starts (fixes mgba.io/i/804) - Core: Remember to deinit proxy ring FIFO + - GBA Savedata: Fix EEPROM writing codepath when savetype is not EEPROM Misc: - mGUI: Add SGB border configuration option - mGUI: Add support for different settings types
M src/gba/dma.csrc/gba/dma.c

@@ -278,7 +278,9 @@ if (memory->savedata.type == SAVEDATA_AUTODETECT) {

mLOG(GBA_MEM, INFO, "Detected EEPROM savegame"); GBASavedataInitEEPROM(&memory->savedata); } - GBASavedataWriteEEPROM(&memory->savedata, memory->dmaTransferRegister, wordsRemaining); + if (memory->savedata.type == SAVEDATA_EEPROM512 || memory->savedata.type == SAVEDATA_EEPROM) { + GBASavedataWriteEEPROM(&memory->savedata, memory->dmaTransferRegister, wordsRemaining); + } } else { cpu->memory.store16(cpu, dest, memory->dmaTransferRegister, 0);
M src/gba/memory.csrc/gba/memory.c

@@ -892,7 +892,11 @@ if (memory->savedata.type == SAVEDATA_AUTODETECT) {

mLOG(GBA_MEM, INFO, "Detected EEPROM savegame"); GBASavedataInitEEPROM(&memory->savedata); } - GBASavedataWriteEEPROM(&memory->savedata, value, 1); + if (memory->savedata.type == SAVEDATA_EEPROM512 || memory->savedata.type == SAVEDATA_EEPROM) { + GBASavedataWriteEEPROM(&memory->savedata, value, 1); + break; + } + mLOG(GBA_MEM, GAME_ERROR, "Bad memory Store16: 0x%08X", address); break; case REGION_CART_SRAM: case REGION_CART_SRAM_MIRROR: