GBA Memory: Fix copy-on-write for ROM when executing in ROM

This commit is contained in:
Vicki Pfau 2017-03-29 18:46:36 -07:00
parent 93dbae1e5f
commit 874ad93f4d
1 changed files with 3 additions and 0 deletions

View File

@ -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);