From 642ba374e7c3c65dfb74c6d8ba1cc5beca839f3e Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Thu, 1 Jan 2015 16:05:07 -0800 Subject: [PATCH] GBA: Allow GBAThread to override GBA object logLevel --- src/gba/gba.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/gba/gba.c b/src/gba/gba.c index a599d5196..60c5a0527 100644 --- a/src/gba/gba.c +++ b/src/gba/gba.c @@ -607,13 +607,17 @@ void GBAHalt(struct GBA* gba) { static void _GBAVLog(struct GBA* gba, enum GBALogLevel level, const char* format, va_list args) { struct GBAThread* threadContext = GBAThreadGetContext(); - if (threadContext) { - if (!gba) { - gba = threadContext->gba; - } + enum GBALogLevel logLevel = -1; + + if (gba) { + logLevel = gba->logLevel; } - if (gba && !(level & gba->logLevel) && level != GBA_LOG_FATAL) { + if (threadContext) { + logLevel = threadContext->logLevel; + } + + if (!(level & logLevel) && level != GBA_LOG_FATAL) { return; }