all repos — mgba @ 5607a130398eae0691e2d3664555bc54c9c6fc99

mGBA Game Boy Advance Emulator

GBA Config: Support loading BIOS from config files
Jeffrey Pfau jeffrey@endrift.com
Sun, 02 Nov 2014 01:31:12 -0700
commit

5607a130398eae0691e2d3664555bc54c9c6fc99

parent

3ed2993e8ced10194017d2f10527f1aae864e9ac

2 files changed, 11 insertions(+), 1 deletions(-)

jump to
M src/gba/gba-config.csrc/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.hsrc/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;