mirror of https://github.com/mgba-emu/mgba.git
Add LOG_FATAL
This commit is contained in:
parent
70afe23fe4
commit
13d3146d0b
|
@ -50,7 +50,7 @@ void GBAMemoryInit(struct GBAMemory* memory) {
|
|||
|
||||
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 @@ static void GBASetActiveRegion(struct ARMMemory* memory, uint32_t address) {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ void GBAInit(struct GBA* gba) {
|
|||
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 @@ void GBALog(struct GBA* gba, enum GBALogLevel level, const char* format, ...) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (gba && !(level & gba->logLevel)) {
|
||||
if (gba && !(level & gba->logLevel) && level != GBA_LOG_FATAL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -530,20 +530,22 @@ void GBALog(struct GBA* gba, enum GBALogLevel level, const char* 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) {
|
||||
|
|
|
@ -39,6 +39,7 @@ enum GBALogLevel {
|
|||
GBA_LOG_INFO = 0x04,
|
||||
GBA_LOG_WARN = 0x08,
|
||||
GBA_LOG_ERROR = 0x10,
|
||||
GBA_LOG_FATAL = 0x20,
|
||||
|
||||
GBA_LOG_GAME_ERROR = 0x100
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue