all repos — mgba @ 86a36853edc869ddd026906b2c641aa0871e93e3

mGBA Game Boy Advance Emulator

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
commit

86a36853edc869ddd026906b2c641aa0871e93e3

parent

051af279c99fd47f5a6b004fa4cc3e12735a5426

1 files changed, 2 insertions(+), 3 deletions(-)

jump to
M src/gba/gba.csrc/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);