all repos — mgba @ e797d009d0da181ba0587927a9da96ef8cf4eef9

mGBA Game Boy Advance Emulator

GBA Memory: Fix ROMs incorrectly being resized
Jeffrey Pfau jeffrey@endrift.com
Sun, 17 May 2015 15:37:55 -0700
commit

e797d009d0da181ba0587927a9da96ef8cf4eef9

parent

57e84f0c6938a1e5797a15cce88a6565dff77ba3

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

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