From d2949383d584cdf9a00f1e80d986eda0f8fb9dfb Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sat, 17 Dec 2022 00:21:07 -0800 Subject: [PATCH] GBA: Clean up BIOS skip detection; add second multiboot entry --- src/gba/core.c | 6 +++--- src/gba/gba.c | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gba/core.c b/src/gba/core.c index b44c8aa5c..a50c11175 100644 --- a/src/gba/core.c +++ b/src/gba/core.c @@ -700,8 +700,8 @@ static void _GBACoreReset(struct mCore* core) { #endif ARMReset(core->cpu); - bool forceSkip = gba->mbVf; - if (!(forceSkip || core->opts.skipBios) && (gba->romVf || gba->memory.rom) && gba->pristineRomSize >= 0xA0 && gba->biosVf) { + bool forceSkip = gba->mbVf || core->opts.skipBios; + if (!forceSkip && (gba->romVf || gba->memory.rom) && gba->pristineRomSize >= 0xA0 && gba->biosVf) { uint32_t crc = doCrc32(&gba->memory.rom[1], 0x9C); if (crc != LOGO_CRC32) { mLOG(STATUS, WARN, "Invalid logo, skipping BIOS"); @@ -709,7 +709,7 @@ static void _GBACoreReset(struct mCore* core) { } } - if (forceSkip || (core->opts.skipBios && (gba->romVf || gba->memory.rom))) { + if (forceSkip) { GBASkipBIOS(core->board); } diff --git a/src/gba/gba.c b/src/gba/gba.c index f40e85ace..b26ec85af 100644 --- a/src/gba/gba.c +++ b/src/gba/gba.c @@ -275,8 +275,10 @@ void GBASkipBIOS(struct GBA* gba) { if (cpu->gprs[ARM_PC] == BASE_RESET + WORD_SIZE_ARM) { if (gba->memory.rom) { cpu->gprs[ARM_PC] = BASE_CART0; - } else { + } else if (gba->memory.wram[0x30]) { cpu->gprs[ARM_PC] = BASE_WORKING_RAM + 0xC0; + } else { + cpu->gprs[ARM_PC] = BASE_WORKING_RAM; } gba->video.vcount = 0x7E; gba->memory.io[REG_VCOUNT >> 1] = 0x7E;