GBA Savedata: Fix potential corruption when loading a 1Mbit flash save

This commit is contained in:
Vicki Pfau 2020-07-27 00:28:56 -07:00
parent 3210d5f272
commit a637616ac2
2 changed files with 2 additions and 1 deletions

View File

@ -23,6 +23,7 @@ Emulation fixes:
- GBA DMA: Linger last DMA on bus (fixes mgba.io/i/301 and mgba.io/i/1320)
- GBA Memory: Improve gamepak prefetch timing
- GBA Memory: Stall on VRAM access in mode 2 (fixes mgba.io/i/190)
- GBA Savedata: Fix potential corruption when loading a 1Mbit flash save
- GBA SIO: Fix copying Normal mode transfer values
- GBA Video: Latch scanline at end of Hblank (fixes mgba.io/i/1319)
- GBA Video: Fix Hblank timing

View File

@ -599,7 +599,6 @@ void GBASavedataDeserialize(struct GBASavedata* savedata, const struct GBASerial
void _flashSwitchBank(struct GBASavedata* savedata, int bank) {
mLOG(GBA_SAVE, DEBUG, "Performing flash bank switch to bank %i", bank);
savedata->currentBank = &savedata->data[bank << 16];
if (bank > 0 && savedata->type == SAVEDATA_FLASH512) {
mLOG(GBA_SAVE, INFO, "Updating flash chip from 512kb to 1Mb");
savedata->type = SAVEDATA_FLASH1M;
@ -614,6 +613,7 @@ void _flashSwitchBank(struct GBASavedata* savedata, int bank) {
}
}
}
savedata->currentBank = &savedata->data[bank << 16];
}
void _flashErase(struct GBASavedata* savedata) {