mirror of https://github.com/mgba-emu/mgba.git
GBA Memory: Fix copy-on-write for ROM when executing in ROM
This commit is contained in:
parent
93dbae1e5f
commit
874ad93f4d
|
@ -1552,6 +1552,9 @@ void _pristineCow(struct GBA* gba) {
|
||||||
void* newRom = anonymousMemoryMap(SIZE_CART0);
|
void* newRom = anonymousMemoryMap(SIZE_CART0);
|
||||||
memcpy(newRom, gba->memory.rom, gba->memory.romSize);
|
memcpy(newRom, gba->memory.rom, gba->memory.romSize);
|
||||||
memset(((uint8_t*) newRom) + gba->memory.romSize, 0xFF, SIZE_CART0 - 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) {
|
if (gba->romVf) {
|
||||||
#ifndef _3DS
|
#ifndef _3DS
|
||||||
gba->romVf->unmap(gba->romVf, gba->memory.rom, gba->memory.romSize);
|
gba->romVf->unmap(gba->romVf, gba->memory.rom, gba->memory.romSize);
|
||||||
|
|
Loading…
Reference in New Issue