GBA Memory: Fix ROMs incorrectly being resized
Jeffrey Pfau jeffrey@endrift.com
Sun, 17 May 2015 15:37:55 -0700
1 files changed,
3 insertions(+),
3 deletions(-)
jump to
M
src/gba/memory.c
→
src/gba/memory.c
@@ -854,7 +854,7 @@ case REGION_CART1_EX:
case REGION_CART2: case REGION_CART2_EX: _pristineCow(gba); - if ((address & (SIZE_CART0 - 1)) < gba->memory.romSize) { + if ((address & (SIZE_CART0 - 1)) >= gba->memory.romSize) { gba->memory.romSize = (address & (SIZE_CART0 - 4)) + 4; } LOAD_32(oldValue, address & (SIZE_CART0 - 1), gba->memory.rom);@@ -921,7 +921,7 @@ case REGION_CART1_EX:
case REGION_CART2: case REGION_CART2_EX: _pristineCow(gba); - if ((address & (SIZE_CART0 - 1)) < gba->memory.romSize) { + if ((address & (SIZE_CART0 - 1)) >= gba->memory.romSize) { gba->memory.romSize = (address & (SIZE_CART0 - 2)) + 2; } LOAD_16(oldValue, address & (SIZE_CART0 - 1), gba->memory.rom);@@ -978,7 +978,7 @@ case REGION_CART1_EX:
case REGION_CART2: case REGION_CART2_EX: _pristineCow(gba); - if ((address & (SIZE_CART0 - 1)) < gba->memory.romSize) { + if ((address & (SIZE_CART0 - 1)) >= gba->memory.romSize) { gba->memory.romSize = (address & (SIZE_CART0 - 2)) + 2; } oldValue = ((int8_t*) memory->rom)[address & (SIZE_CART0 - 1)];