GBA Config: Support loading BIOS from config files
Jeffrey Pfau jeffrey@endrift.com
Sun, 02 Nov 2014 01:31:12 -0700
2 files changed,
11 insertions(+),
1 deletions(-)
M
src/gba/gba-config.c
→
src/gba/gba-config.c
@@ -18,6 +18,15 @@ }
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 @@ return ConfigurationRead(config, BINARY_NAME ".ini");
} 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);
M
src/platform/commandline.h
→
src/platform/commandline.h
@@ -17,7 +17,6 @@
struct StartupOptions { // Passed only char* fname; - char* bios; char* patch; bool dirmode;@@ -25,6 +24,7 @@ enum DebuggerType debuggerType;
bool debugAtStart; // Configurable + char* bios; int logLevel; int frameskip; int rewindBufferCapacity;