GBA: Allow GBAThread to override GBA object logLevel

This commit is contained in:
Jeffrey Pfau 2015-01-01 16:05:07 -08:00
parent b51710e92f
commit 642ba374e7
1 changed files with 9 additions and 5 deletions

View File

@ -607,13 +607,17 @@ void GBAHalt(struct GBA* gba) {
static void _GBAVLog(struct GBA* gba, enum GBALogLevel level, const char* format, va_list args) { static void _GBAVLog(struct GBA* gba, enum GBALogLevel level, const char* format, va_list args) {
struct GBAThread* threadContext = GBAThreadGetContext(); struct GBAThread* threadContext = GBAThreadGetContext();
if (threadContext) { enum GBALogLevel logLevel = -1;
if (!gba) {
gba = threadContext->gba; 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; return;
} }