Add LOG_FATAL
Jeffrey Pfau jeffrey@endrift.com
Wed, 29 Jan 2014 22:44:40 -0800
3 files changed,
13 insertions(+),
11 deletions(-)
M
src/gba/gba-memory.c
→
src/gba/gba-memory.c
@@ -50,7 +50,7 @@ memory->nextDMA = INT_MAX;
if (!memory->wram || !memory->iwram) { GBAMemoryDeinit(memory); - GBALog(memory->p, GBA_LOG_ERROR, "Could not map memory"); + GBALog(memory->p, GBA_LOG_FATAL, "Could not map memory"); return; }@@ -125,10 +125,9 @@ memory->activeRegion = gbaMemory->rom;
memory->activeMask = SIZE_CART0 - 1; break; default: - GBALog(gbaMemory->p, GBA_LOG_ERROR, "Jumped to invalid address"); memory->activeRegion = 0; memory->activeMask = 0; - abort(); + GBALog(gbaMemory->p, GBA_LOG_FATAL, "Jumped to invalid address"); break; } }
M
src/gba/gba.c
→
src/gba/gba.c
@@ -130,7 +130,7 @@ gba->keySource = 0;
gba->rotationSource = 0; gba->rumble = 0; - gba->logLevel = GBA_LOG_INFO | GBA_LOG_WARN | GBA_LOG_ERROR; + gba->logLevel = GBA_LOG_INFO | GBA_LOG_WARN | GBA_LOG_ERROR | GBA_LOG_FATAL; gba->biosChecksum = GBAChecksum(gba->memory.bios, SIZE_BIOS);@@ -521,7 +521,7 @@ va_end(args);
return; } - if (gba && !(level & gba->logLevel)) { + if (gba && !(level & gba->logLevel) && level != GBA_LOG_FATAL) { return; }@@ -530,20 +530,22 @@ va_start(args, format);
vprintf(format, args); va_end(args); printf("\n"); + + if (level == GBA_LOG_FATAL) { + abort(); + } } void GBAHitStub(struct ARMBoard* board, uint32_t opcode) { struct GBABoard* gbaBoard = (struct GBABoard*) board; - GBALog(gbaBoard->p, GBA_LOG_STUB, "Stub opcode: %08x", opcode); + enum GBALogLevel level = GBA_LOG_FATAL; #ifdef USE_DEBUGGER - if (!gbaBoard->p->debugger) { - abort(); - } else { + if (gbaBoard->p->debugger) { + level = GBA_LOG_STUB; ARMDebuggerEnter(gbaBoard->p->debugger); } -#else - abort(); #endif + GBALog(gbaBoard->p, level, "Stub opcode: %08x", opcode); } void GBAIllegal(struct ARMBoard* board, uint32_t opcode) {
M
src/gba/gba.h
→
src/gba/gba.h
@@ -39,6 +39,7 @@ GBA_LOG_DEBUG = 0x02,
GBA_LOG_INFO = 0x04, GBA_LOG_WARN = 0x08, GBA_LOG_ERROR = 0x10, + GBA_LOG_FATAL = 0x20, GBA_LOG_GAME_ERROR = 0x100 };