GBA: Fix patching being incompatible with GBAUnloadROM
Jeffrey Pfau jeffrey@endrift.com
Sun, 28 Jun 2015 01:32:34 -0700
1 files changed,
2 insertions(+),
2 deletions(-)
jump to
M
src/gba/gba.c
→
src/gba/gba.c
@@ -435,10 +435,10 @@ }
void GBAApplyPatch(struct GBA* gba, struct Patch* patch) { size_t patchedSize = patch->outputSize(patch, gba->memory.romSize); - if (!patchedSize) { + if (!patchedSize || patchedSize > SIZE_CART0) { return; } - gba->memory.rom = anonymousMemoryMap(patchedSize); + gba->memory.rom = anonymousMemoryMap(SIZE_CART0); if (!patch->applyPatch(patch, gba->pristineRom, gba->pristineRomSize, gba->memory.rom, patchedSize)) { mappedMemoryFree(gba->memory.rom, patchedSize); gba->memory.rom = gba->pristineRom;