From 5607a130398eae0691e2d3664555bc54c9c6fc99 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sun, 2 Nov 2014 01:31:12 -0700 Subject: [PATCH] GBA Config: Support loading BIOS from config files --- src/gba/gba-config.c | 10 ++++++++++ src/platform/commandline.h | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gba/gba-config.c b/src/gba/gba-config.c index 61ce621a2..af3197797 100644 --- a/src/gba/gba-config.c +++ b/src/gba/gba-config.c @@ -18,6 +18,15 @@ static const char* _lookupValue(const struct Configuration* config, const char* return ConfigurationGetValue(config, 0, key); } +static bool _lookupCharValue(const struct Configuration* config, const char* key, const char* port, char** out) { + const char* value = _lookupValue(config, key, port); + if (!value) { + return false; + } + *out = strdup(value); + return true; +} + static bool _lookupIntValue(const struct Configuration* config, const char* key, const char* port, int* out) { const char* charValue = _lookupValue(config, key, port); if (!charValue) { @@ -37,6 +46,7 @@ bool GBAConfigLoad(struct Configuration* config) { } void GBAConfigMapStartupOpts(const struct Configuration* config, const char* port, struct StartupOptions* opts) { + _lookupCharValue(config, "bios", port, &opts->bios); _lookupIntValue(config, "logLevel", port, &opts->logLevel); _lookupIntValue(config, "frameskip", port, &opts->frameskip); _lookupIntValue(config, "rewindBufferCapacity", port, &opts->rewindBufferCapacity); diff --git a/src/platform/commandline.h b/src/platform/commandline.h index c6c441480..ed86139ce 100644 --- a/src/platform/commandline.h +++ b/src/platform/commandline.h @@ -17,7 +17,6 @@ enum DebuggerType { struct StartupOptions { // Passed only char* fname; - char* bios; char* patch; bool dirmode; @@ -25,6 +24,7 @@ struct StartupOptions { bool debugAtStart; // Configurable + char* bios; int logLevel; int frameskip; int rewindBufferCapacity;