From 874ad93f4dba11722ccfb02aa7a3533777d8e03e Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 29 Mar 2017 18:46:36 -0700 Subject: [PATCH] GBA Memory: Fix copy-on-write for ROM when executing in ROM --- src/gba/memory.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gba/memory.c b/src/gba/memory.c index 69cdc8b28..a6280254e 100644 --- a/src/gba/memory.c +++ b/src/gba/memory.c @@ -1552,6 +1552,9 @@ void _pristineCow(struct GBA* gba) { 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);