all repos — mgba @ 874ad93f4dba11722ccfb02aa7a3533777d8e03e

mGBA Game Boy Advance Emulator

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
commit

874ad93f4dba11722ccfb02aa7a3533777d8e03e

parent

93dbae1e5fc50411fc229c799ce49d3b4ea97272

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

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