all repos — mgba @ 68790c1b2a70f617a1798811ba1c50614a27b482

mGBA Game Boy Advance Emulator

GBA: Fix patching being incompatible with GBAUnloadROM
Jeffrey Pfau jeffrey@endrift.com
Sun, 28 Jun 2015 01:32:34 -0700
commit

68790c1b2a70f617a1798811ba1c50614a27b482

parent

2346c2355a23bfc022cb54cc8f330f352aa2f51b

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

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