all repos — mgba @ adcb2de81414c901bdac72481bda5df2ab2bd248

mGBA Game Boy Advance Emulator

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
commit

adcb2de81414c901bdac72481bda5df2ab2bd248

parent

d133cabd33cad4e8896046ba7af98debb3d003a8

1 files changed, 2 insertions(+), 2 deletions(-)

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