GBA Memory: Only copy-on-write if ROM buffer is not fixed
Vicki Pfau vi@endrift.com
Thu, 25 Jan 2018 19:48:05 -0800
1 files changed,
2 insertions(+),
2 deletions(-)
jump to
M
src/gba/memory.c
→
src/gba/memory.c
@@ -1629,6 +1629,7 @@ void _pristineCow(struct GBA* gba) {
if (!gba->isPristine) { return; } +#ifndef FIXED_ROM_BUFFER 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);@@ -1636,14 +1637,13 @@ if (gba->cpu->memory.activeRegion == gba->memory.rom) {
gba->cpu->memory.activeRegion = newRom; } if (gba->romVf) { -#ifndef FIXED_ROM_BUFFER gba->romVf->unmap(gba->romVf, gba->memory.rom, gba->memory.romSize); -#endif gba->romVf->close(gba->romVf); gba->romVf = NULL; } gba->memory.rom = newRom; gba->memory.hw.gpioBase = &((uint16_t*) gba->memory.rom)[GPIO_REG_DATA >> 1]; +#endif gba->isPristine = false; }