From 678c5465ffc017d4dfa8b999cbdd3869db717cb1 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Fri, 4 Jul 2014 18:43:07 -0700 Subject: [PATCH] Add (currently undocumented) command line flag for setting logging level --- src/gba/gba-thread.c | 2 ++ src/gba/gba-thread.h | 1 + src/platform/commandline.c | 5 ++++- src/platform/commandline.h | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gba/gba-thread.c b/src/gba/gba-thread.c index 6de15bb8e..83d9fecad 100644 --- a/src/gba/gba-thread.c +++ b/src/gba/gba-thread.c @@ -75,6 +75,7 @@ static THREAD_ENTRY _GBAThreadRun(void* context) { ARMReset(&cpu); threadContext->gba = &gba; gba.sync = &threadContext->sync; + gba.logLevel = threadContext->logLevel; #ifdef USE_PTHREADS pthread_setspecific(_contextKey, threadContext); #else @@ -169,6 +170,7 @@ void GBAMapOptionsToContext(struct StartupOptions* opts, struct GBAThread* threa threadContext->fname = opts->fname; threadContext->biosFd = opts->biosFd; threadContext->frameskip = opts->frameskip; + threadContext->logLevel = opts->logLevel; threadContext->rewindBufferCapacity = opts->rewindBufferCapacity; threadContext->rewindBufferInterval = opts->rewindBufferInterval; } diff --git a/src/gba/gba-thread.h b/src/gba/gba-thread.h index aaeea7af0..34af0842b 100644 --- a/src/gba/gba-thread.h +++ b/src/gba/gba-thread.h @@ -58,6 +58,7 @@ struct GBAThread { enum ThreadState savedState; GBALogHandler logHandler; + int logLevel; ThreadCallback startCallback; ThreadCallback cleanCallback; ThreadCallback frameCallback; diff --git a/src/platform/commandline.c b/src/platform/commandline.c index 47beb526e..b1ca5788a 100644 --- a/src/platform/commandline.c +++ b/src/platform/commandline.c @@ -44,7 +44,7 @@ int parseCommandArgs(struct StartupOptions* opts, int argc, char* const* argv, s int ch; char options[64] = - "b:s:" + "b:l:s:" #ifdef USE_CLI_DEBUGGER "d" #endif @@ -77,6 +77,9 @@ int parseCommandArgs(struct StartupOptions* opts, int argc, char* const* argv, s opts->debuggerType = DEBUGGER_GDB; break; #endif + case 'l': + opts->logLevel = atoi(optarg); + break; case 's': opts->frameskip = atoi(optarg); break; diff --git a/src/platform/commandline.h b/src/platform/commandline.h index acc529eb4..52cbdfa50 100644 --- a/src/platform/commandline.h +++ b/src/platform/commandline.h @@ -18,6 +18,7 @@ struct StartupOptions { int fd; const char* fname; int biosFd; + int logLevel; int frameskip; int rewindBufferCapacity; int rewindBufferInterval;