GBA: Make sure unloading only frees if needed and always zeroes variable
Jeffrey Pfau jeffrey@endrift.com
Mon, 22 Jun 2015 01:32:49 -0700
1 files changed,
2 insertions(+),
3 deletions(-)
jump to
M
src/gba/gba.c
→
src/gba/gba.c
@@ -97,14 +97,13 @@ gba->performingDMA = false;
} void GBAUnloadROM(struct GBA* gba) { - if (gba->pristineRom == gba->memory.rom) { - gba->memory.rom = 0; - } else { + if (gba->memory.rom && gba->pristineRom != gba->memory.rom) { if (gba->yankedRomSize) { gba->yankedRomSize = 0; } mappedMemoryFree(gba->memory.rom, SIZE_CART0); } + gba->memory.rom = 0; if (gba->romVf) { gba->romVf->unmap(gba->romVf, gba->pristineRom, gba->pristineRomSize);