From ea91c48d3e75f72577ef8cd00276819e4c3aa07e Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sun, 2 Aug 2015 11:45:26 -0700 Subject: [PATCH] GBA: Add option to not hard-crash when a game crashes --- src/gba/gba.c | 1 + src/gba/gba.h | 1 + src/gba/memory.c | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gba/gba.c b/src/gba/gba.c index 732da9eed..c221f587f 100644 --- a/src/gba/gba.c +++ b/src/gba/gba.c @@ -94,6 +94,7 @@ static void GBAInit(struct ARMCore* cpu, struct ARMComponent* component) { gba->idleDetectionFailures = 0; gba->realisticTiming = true; + gba->hardCrash = true; gba->performingDMA = false; } diff --git a/src/gba/gba.h b/src/gba/gba.h index 46eea057c..e472a14ac 100644 --- a/src/gba/gba.h +++ b/src/gba/gba.h @@ -124,6 +124,7 @@ struct GBA { bool taintedRegisters[16]; bool realisticTiming; + bool hardCrash; }; struct GBACartridge { diff --git a/src/gba/memory.c b/src/gba/memory.c index a69b5fd5a..a1195eeb8 100644 --- a/src/gba/memory.c +++ b/src/gba/memory.c @@ -278,9 +278,11 @@ static void GBASetActiveRegion(struct ARMCore* cpu, uint32_t address) { memory->activeRegion = -1; cpu->memory.activeRegion = _deadbeef; cpu->memory.activeMask = 0; - if (!gba->yankedRomSize) { - GBALog(gba, GBA_LOG_FATAL, "Jumped to invalid address"); + enum GBALogLevel errorLevel = GBA_LOG_FATAL; + if (gba->yankedRomSize || !gba->hardCrash) { + errorLevel = GBA_LOG_GAME_ERROR; } + GBALog(gba, errorLevel, "Jumped to invalid address: %08X", address); return; } cpu->memory.activeSeqCycles32 = memory->waitstatesSeq32[memory->activeRegion];