GB, GBA: Save writeback-pending masked saves on unload (fixes #2396)

This commit is contained in:
Vicki Pfau 2022-01-20 22:27:15 -08:00
parent ae4605596f
commit c34e031d8c
3 changed files with 7 additions and 2 deletions

View File

@ -3,6 +3,7 @@ Emulation fixes:
- GBA I/O: Disable open bus behavior on invalid register 06A
Other fixes:
- FFmpeg: Fix crash when encoding audio with some containers
- GB, GBA: Save writeback-pending masked saves on unload (fixes mgba.io/i/2396)
0.9.3: (2021-12-17)
Emulation fixes:

View File

@ -316,7 +316,9 @@ void GBUnloadROM(struct GB* gb) {
gb->memory.mbcType = GB_MBC_AUTODETECT;
gb->isPristine = false;
gb->sramMaskWriteback = false;
if (!gb->sramDirty) {
gb->sramMaskWriteback = false;
}
GBSavedataUnmask(gb);
GBSramDeinit(gb);
if (gb->sramRealVf) {

View File

@ -148,7 +148,9 @@ void GBAUnloadROM(struct GBA* gba) {
gba->memory.rom = NULL;
gba->isPristine = false;
gba->memory.savedata.maskWriteback = false;
if (!gba->memory.savedata.dirty) {
gba->memory.savedata.maskWriteback = false;
}
GBASavedataUnmask(&gba->memory.savedata);
GBASavedataDeinit(&gba->memory.savedata);
if (gba->memory.savedata.realVf) {