GBA Memory: Fix copy-on-write for ROM when executing in ROM
Vicki Pfau vi@endrift.com
Wed, 29 Mar 2017 18:46:36 -0700
1 files changed,
3 insertions(+),
0 deletions(-)
jump to
M
src/gba/memory.c
→
src/gba/memory.c
@@ -1552,6 +1552,9 @@ }
void* newRom = anonymousMemoryMap(SIZE_CART0); memcpy(newRom, gba->memory.rom, gba->memory.romSize); memset(((uint8_t*) newRom) + gba->memory.romSize, 0xFF, SIZE_CART0 - gba->memory.romSize); + if (gba->cpu->memory.activeRegion == gba->memory.rom) { + gba->cpu->memory.activeRegion = newRom; + } if (gba->romVf) { #ifndef _3DS gba->romVf->unmap(gba->romVf, gba->memory.rom, gba->memory.romSize);