diff --git a/src/gb/mbc.c b/src/gb/mbc.c index 817b3dc9d..65ba791e3 100644 --- a/src/gb/mbc.c +++ b/src/gb/mbc.c @@ -188,11 +188,6 @@ void GBMBCInit(struct GB* gb) { case 2: case 3: gb->memory.mbcType = GB_MBC1; - if (gb->memory.romSize >= GB_SIZE_CART_BANK0 * 0x31 && _isMulticart(gb->memory.rom)) { - gb->memory.mbcState.mbc1.multicartStride = 4; - } else { - gb->memory.mbcState.mbc1.multicartStride = 5; - } break; case 5: case 6: @@ -255,6 +250,11 @@ void GBMBCInit(struct GB* gb) { break; case GB_MBC1: gb->memory.mbcWrite = _GBMBC1; + if (gb->memory.romSize >= GB_SIZE_CART_BANK0 * 0x31 && _isMulticart(gb->memory.rom)) { + gb->memory.mbcState.mbc1.multicartStride = 4; + } else { + gb->memory.mbcState.mbc1.multicartStride = 5; + } break; case GB_MBC2: gb->memory.mbcWrite = _GBMBC2; diff --git a/src/gb/memory.c b/src/gb/memory.c index 1761bcb39..b2e229c4d 100644 --- a/src/gb/memory.c +++ b/src/gb/memory.c @@ -177,8 +177,8 @@ void GBMemoryReset(struct GB* gb) { memset(&gb->memory.hram, 0, sizeof(gb->memory.hram)); - GBMBCInit(gb); memset(&gb->memory.mbcState, 0, sizeof(gb->memory.mbcState)); + GBMBCInit(gb); switch (gb->memory.mbcType) { case GB_MBC1: gb->memory.mbcState.mbc1.mode = 0;