From 4b40c5cd1a319866407984e560f312f7fd31702a Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sun, 19 Nov 2017 07:43:43 -0800 Subject: [PATCH] GBA BIOS: Crash on BIOS misuse if hardCrash is enabled --- src/core/thread.c | 4 ++++ src/gba/bios.c | 6 +++++- src/platform/qt/LogController.cpp | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/core/thread.c b/src/core/thread.c index 3a0c802ea..15dafe185 100644 --- a/src/core/thread.c +++ b/src/core/thread.c @@ -623,6 +623,10 @@ static void _mCoreLog(struct mLogger* logger, int category, enum mLogLevel level printf("%s: ", mLogCategoryName(category)); vprintf(format, args); printf("\n"); + struct mCoreThread* thread = mCoreThreadGet(); + if (thread && level == mLOG_FATAL) { + mCoreThreadMarkCrashed(thread); + } } struct mLogger* mCoreThreadLogger(void) { diff --git a/src/gba/bios.c b/src/gba/bios.c index fba9479ed..6d4835bed 100644 --- a/src/gba/bios.c +++ b/src/gba/bios.c @@ -531,7 +531,11 @@ static void _unLz77(struct GBA* gba, int width) { bytes = (block >> 12) + 3; while (bytes--) { if (!remaining) { - mLOG(GBA_BIOS, GAME_ERROR, "Improperly compressed LZ77 data. Real BIOS would hang."); + if (gba->hardCrash) { + mLOG(GBA_BIOS, FATAL, "Improperly compressed LZ77 data. Real BIOS would hang."); + } else { + mLOG(GBA_BIOS, GAME_ERROR, "Improperly compressed LZ77 data. Real BIOS would hang."); + } break; } --remaining; diff --git a/src/platform/qt/LogController.cpp b/src/platform/qt/LogController.cpp index d8870d335..32cf7a917 100644 --- a/src/platform/qt/LogController.cpp +++ b/src/platform/qt/LogController.cpp @@ -13,7 +13,7 @@ LogController::LogController(int levels, QObject* parent) : QObject(parent) { mLogFilterInit(&m_filter); - mLogFilterSet(&m_filter, "gba.bios", mLOG_STUB); + mLogFilterSet(&m_filter, "gba.bios", mLOG_STUB | mLOG_FATAL); mLogFilterSet(&m_filter, "core.status", mLOG_ALL & ~mLOG_DEBUG); m_filter.defaultLevels = levels;