mirror of https://github.com/mgba-emu/mgba.git
GB, GBA Savedata: Fix leaks when loading masked save (fixes #1197)
This commit is contained in:
parent
08ab254fef
commit
e26eeed02a
1
CHANGES
1
CHANGES
|
@ -114,6 +114,7 @@ Bugfixes:
|
|||
- GB, GBA: Fix broken opposing button filter (fixes mgba.io/i/1191)
|
||||
- Qt: Fix jumbled background when paused
|
||||
- Qt: Fix FPS counter on Windows
|
||||
- GB, GBA Savedata: Fix leaks when loading masked save (fixes mgba.io/i/1197)
|
||||
Misc:
|
||||
- mGUI: Add SGB border configuration option
|
||||
- mGUI: Add support for different settings types
|
||||
|
|
|
@ -249,7 +249,11 @@ void GBSramClean(struct GB* gb, uint32_t frameCount) {
|
|||
}
|
||||
|
||||
void GBSavedataMask(struct GB* gb, struct VFile* vf, bool writeback) {
|
||||
struct VFile* oldVf = gb->sramVf;
|
||||
GBSramDeinit(gb);
|
||||
if (oldVf && oldVf != gb->sramRealVf) {
|
||||
oldVf->close(oldVf);
|
||||
}
|
||||
gb->sramVf = vf;
|
||||
gb->sramMaskWriteback = writeback;
|
||||
gb->memory.sram = vf->map(vf, gb->sramSize, MAP_READ);
|
||||
|
|
|
@ -138,6 +138,8 @@ void GBAUnloadROM(struct GBA* gba) {
|
|||
gba->memory.rom = NULL;
|
||||
gba->isPristine = false;
|
||||
|
||||
gba->memory.savedata.maskWriteback = false;
|
||||
GBASavedataUnmask(&gba->memory.savedata);
|
||||
GBASavedataDeinit(&gba->memory.savedata);
|
||||
if (gba->memory.savedata.realVf) {
|
||||
gba->memory.savedata.realVf->close(gba->memory.savedata.realVf);
|
||||
|
|
|
@ -99,13 +99,6 @@ void GBAMemoryDeinit(struct GBA* gba) {
|
|||
if (gba->memory.rom) {
|
||||
mappedMemoryFree(gba->memory.rom, gba->memory.romSize);
|
||||
}
|
||||
gba->memory.savedata.maskWriteback = false;
|
||||
GBASavedataUnmask(&gba->memory.savedata);
|
||||
GBASavedataDeinit(&gba->memory.savedata);
|
||||
if (gba->memory.savedata.realVf) {
|
||||
gba->memory.savedata.realVf->close(gba->memory.savedata.realVf);
|
||||
}
|
||||
|
||||
if (gba->memory.agbPrintBuffer) {
|
||||
mappedMemoryFree(gba->memory.agbPrintBuffer, SIZE_AGB_PRINT);
|
||||
}
|
||||
|
|
|
@ -88,7 +88,11 @@ void GBASavedataDeinit(struct GBASavedata* savedata) {
|
|||
|
||||
void GBASavedataMask(struct GBASavedata* savedata, struct VFile* vf, bool writeback) {
|
||||
enum SavedataType type = savedata->type;
|
||||
struct VFile* oldVf = savedata->vf;
|
||||
GBASavedataDeinit(savedata);
|
||||
if (oldVf && oldVf != savedata->realVf) {
|
||||
oldVf->close(oldVf);
|
||||
}
|
||||
savedata->vf = vf;
|
||||
savedata->mapMode = MAP_READ;
|
||||
savedata->maskWriteback = writeback;
|
||||
|
|
Loading…
Reference in New Issue