GB MBC: Fix MBC1 initialization

This commit is contained in:
Vicki Pfau 2018-10-17 09:55:38 -07:00
parent a748e0c795
commit 0dc7da9a74
2 changed files with 6 additions and 6 deletions

View File

@ -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;

View File

@ -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;