GBA Savedata: Fix EEPROM writing codepath when savetype is not EEPROM

This commit is contained in:
Vicki Pfau 2018-11-19 21:16:57 -08:00
parent 27feb3ed1f
commit 00cbb6156b
3 changed files with 9 additions and 2 deletions

View File

@ -136,6 +136,7 @@ Bugfixes:
- 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

View File

@ -278,7 +278,9 @@ void GBADMAService(struct GBA* gba, int number, struct GBADMA* info) {
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);

View File

@ -892,7 +892,11 @@ void GBAStore16(struct ARMCore* cpu, uint32_t address, int16_t value, int* cycle
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: