From 811d8281c3f285e9e7421cf290ecefaefb46069d Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Fri, 29 Jan 2016 00:33:56 -0800 Subject: [PATCH] Core: Refactor GBAConfig into mCoreConfig --- src/{gba/context => core}/config.c | 80 +++++++++++------------ src/core/config.h | 98 ++++++++++++++++++++++++++++ src/core/directories.c | 2 +- src/gba/context/config.h | 98 ---------------------------- src/gba/context/context.c | 18 ++--- src/gba/context/context.h | 4 +- src/gba/gui/gui-config.c | 8 +-- src/gba/gui/gui-runner.c | 10 +-- src/gba/supervisor/thread.c | 2 +- src/platform/3ds/main.c | 6 +- src/platform/commandline.c | 18 ++--- src/platform/commandline.h | 6 +- src/platform/libretro/libretro.c | 2 +- src/platform/openemu/mGBAGameCore.m | 2 +- src/platform/psp2/psp2-context.c | 4 +- src/platform/qt/ConfigController.cpp | 40 ++++++------ src/platform/qt/ConfigController.h | 8 +-- src/platform/qt/GameController.cpp | 2 +- src/platform/sdl/main.c | 46 ++++++------- src/platform/test/fuzz-main.c | 10 +-- src/platform/test/perf-main.c | 30 ++++----- src/platform/wii/main.c | 4 +- 22 files changed, 249 insertions(+), 249 deletions(-) rename src/{gba/context => core}/config.c (78%) create mode 100644 src/core/config.h delete mode 100644 src/gba/context/config.h diff --git a/src/gba/context/config.c b/src/core/config.c similarity index 78% rename from src/gba/context/config.c rename to src/core/config.c index e9c68cd8d..d02c99b26 100644 --- a/src/gba/context/config.c +++ b/src/core/config.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2015 Jeffrey Pfau +/* Copyright (c) 2013-2016 Jeffrey Pfau * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -28,7 +28,7 @@ #define SECTION_NAME_MAX 128 -static const char* _lookupValue(const struct GBAConfig* config, const char* key) { +static const char* _lookupValue(const struct mCoreConfig* config, const char* key) { const char* value; if (config->port) { value = ConfigurationGetValue(&config->overridesTable, config->port, key); @@ -59,7 +59,7 @@ static const char* _lookupValue(const struct GBAConfig* config, const char* key) return ConfigurationGetValue(&config->defaultsTable, 0, key); } -static bool _lookupCharValue(const struct GBAConfig* config, const char* key, char** out) { +static bool _lookupCharValue(const struct mCoreConfig* config, const char* key, char** out) { const char* value = _lookupValue(config, key); if (!value) { return false; @@ -71,7 +71,7 @@ static bool _lookupCharValue(const struct GBAConfig* config, const char* key, ch return true; } -static bool _lookupIntValue(const struct GBAConfig* config, const char* key, int* out) { +static bool _lookupIntValue(const struct mCoreConfig* config, const char* key, int* out) { const char* charValue = _lookupValue(config, key); if (!charValue) { return false; @@ -85,7 +85,7 @@ static bool _lookupIntValue(const struct GBAConfig* config, const char* key, int return true; } -static bool _lookupUIntValue(const struct GBAConfig* config, const char* key, unsigned* out) { +static bool _lookupUIntValue(const struct mCoreConfig* config, const char* key, unsigned* out) { const char* charValue = _lookupValue(config, key); if (!charValue) { return false; @@ -99,7 +99,7 @@ static bool _lookupUIntValue(const struct GBAConfig* config, const char* key, un return true; } -static bool _lookupFloatValue(const struct GBAConfig* config, const char* key, float* out) { +static bool _lookupFloatValue(const struct mCoreConfig* config, const char* key, float* out) { const char* charValue = _lookupValue(config, key); if (!charValue) { return false; @@ -113,7 +113,7 @@ static bool _lookupFloatValue(const struct GBAConfig* config, const char* key, f return true; } -void GBAConfigInit(struct GBAConfig* config, const char* port) { +void mCoreConfigInit(struct mCoreConfig* config, const char* port) { ConfigurationInit(&config->configTable); ConfigurationInit(&config->defaultsTable); ConfigurationInit(&config->overridesTable); @@ -125,7 +125,7 @@ void GBAConfigInit(struct GBAConfig* config, const char* port) { } } -void GBAConfigDeinit(struct GBAConfig* config) { +void mCoreConfigDeinit(struct mCoreConfig* config) { ConfigurationDeinit(&config->configTable); ConfigurationDeinit(&config->defaultsTable); ConfigurationDeinit(&config->overridesTable); @@ -133,29 +133,29 @@ void GBAConfigDeinit(struct GBAConfig* config) { } #if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2 -bool GBAConfigLoad(struct GBAConfig* config) { +bool mCoreConfigLoad(struct mCoreConfig* config) { char path[PATH_MAX]; - GBAConfigDirectory(path, PATH_MAX); + mCoreConfigDirectory(path, PATH_MAX); strncat(path, PATH_SEP "config.ini", PATH_MAX - strlen(path)); - return GBAConfigLoadPath(config, path); + return mCoreConfigLoadPath(config, path); } -bool GBAConfigSave(const struct GBAConfig* config) { +bool mCoreConfigSave(const struct mCoreConfig* config) { char path[PATH_MAX]; - GBAConfigDirectory(path, PATH_MAX); + mCoreConfigDirectory(path, PATH_MAX); strncat(path, PATH_SEP "config.ini", PATH_MAX - strlen(path)); - return GBAConfigSavePath(config, path); + return mCoreConfigSavePath(config, path); } -bool GBAConfigLoadPath(struct GBAConfig* config, const char* path) { +bool mCoreConfigLoadPath(struct mCoreConfig* config, const char* path) { return ConfigurationRead(&config->configTable, path); } -bool GBAConfigSavePath(const struct GBAConfig* config, const char* path) { +bool mCoreConfigSavePath(const struct mCoreConfig* config, const char* path) { return ConfigurationWrite(&config->configTable, path); } -void GBAConfigMakePortable(const struct GBAConfig* config) { +void mCoreConfigMakePortable(const struct mCoreConfig* config) { struct VFile* portable = 0; #ifdef _WIN32 char out[MAX_PATH]; @@ -178,11 +178,11 @@ void GBAConfigMakePortable(const struct GBAConfig* config) { #endif if (portable) { portable->close(portable); - GBAConfigSave(config); + mCoreConfigSave(config); } } -void GBAConfigDirectory(char* out, size_t outLength) { +void mCoreConfigDirectory(char* out, size_t outLength) { struct VFile* portable; #ifdef _WIN32 wchar_t wpath[MAX_PATH]; @@ -235,71 +235,71 @@ void GBAConfigDirectory(char* out, size_t outLength) { } #endif -const char* GBAConfigGetValue(const struct GBAConfig* config, const char* key) { +const char* mCoreConfigGetValue(const struct mCoreConfig* config, const char* key) { return _lookupValue(config, key); } -bool GBAConfigGetIntValue(const struct GBAConfig* config, const char* key, int* value) { +bool mCoreConfigGetIntValue(const struct mCoreConfig* config, const char* key, int* value) { return _lookupIntValue(config, key, value); } -bool GBAConfigGetUIntValue(const struct GBAConfig* config, const char* key, unsigned* value) { +bool mCoreConfigGetUIntValue(const struct mCoreConfig* config, const char* key, unsigned* value) { return _lookupUIntValue(config, key, value); } -bool GBAConfigGetFloatValue(const struct GBAConfig* config, const char* key, float* value) { +bool mCoreConfigGetFloatValue(const struct mCoreConfig* config, const char* key, float* value) { return _lookupFloatValue(config, key, value); } -void GBAConfigSetValue(struct GBAConfig* config, const char* key, const char* value) { +void mCoreConfigSetValue(struct mCoreConfig* config, const char* key, const char* value) { ConfigurationSetValue(&config->configTable, config->port, key, value); } -void GBAConfigSetIntValue(struct GBAConfig* config, const char* key, int value) { +void mCoreConfigSetIntValue(struct mCoreConfig* config, const char* key, int value) { ConfigurationSetIntValue(&config->configTable, config->port, key, value); } -void GBAConfigSetUIntValue(struct GBAConfig* config, const char* key, unsigned value) { +void mCoreConfigSetUIntValue(struct mCoreConfig* config, const char* key, unsigned value) { ConfigurationSetUIntValue(&config->configTable, config->port, key, value); } -void GBAConfigSetFloatValue(struct GBAConfig* config, const char* key, float value) { +void mCoreConfigSetFloatValue(struct mCoreConfig* config, const char* key, float value) { ConfigurationSetFloatValue(&config->configTable, config->port, key, value); } -void GBAConfigSetDefaultValue(struct GBAConfig* config, const char* key, const char* value) { +void mCoreConfigSetDefaultValue(struct mCoreConfig* config, const char* key, const char* value) { ConfigurationSetValue(&config->defaultsTable, config->port, key, value); } -void GBAConfigSetDefaultIntValue(struct GBAConfig* config, const char* key, int value) { +void mCoreConfigSetDefaultIntValue(struct mCoreConfig* config, const char* key, int value) { ConfigurationSetIntValue(&config->defaultsTable, config->port, key, value); } -void GBAConfigSetDefaultUIntValue(struct GBAConfig* config, const char* key, unsigned value) { +void mCoreConfigSetDefaultUIntValue(struct mCoreConfig* config, const char* key, unsigned value) { ConfigurationSetUIntValue(&config->defaultsTable, config->port, key, value); } -void GBAConfigSetDefaultFloatValue(struct GBAConfig* config, const char* key, float value) { +void mCoreConfigSetDefaultFloatValue(struct mCoreConfig* config, const char* key, float value) { ConfigurationSetFloatValue(&config->defaultsTable, config->port, key, value); } -void GBAConfigSetOverrideValue(struct GBAConfig* config, const char* key, const char* value) { +void mCoreConfigSetOverrideValue(struct mCoreConfig* config, const char* key, const char* value) { ConfigurationSetValue(&config->overridesTable, config->port, key, value); } -void GBAConfigSetOverrideIntValue(struct GBAConfig* config, const char* key, int value) { +void mCoreConfigSetOverrideIntValue(struct mCoreConfig* config, const char* key, int value) { ConfigurationSetIntValue(&config->overridesTable, config->port, key, value); } -void GBAConfigSetOverrideUIntValue(struct GBAConfig* config, const char* key, unsigned value) { +void mCoreConfigSetOverrideUIntValue(struct mCoreConfig* config, const char* key, unsigned value) { ConfigurationSetUIntValue(&config->overridesTable, config->port, key, value); } -void GBAConfigSetOverrideFloatValue(struct GBAConfig* config, const char* key, float value) { +void mCoreConfigSetOverrideFloatValue(struct mCoreConfig* config, const char* key, float value) { ConfigurationSetFloatValue(&config->overridesTable, config->port, key, value); } -void GBAConfigMap(const struct GBAConfig* config, struct GBAOptions* opts) { +void mCoreConfigMap(const struct mCoreConfig* config, struct GBAOptions* opts) { _lookupCharValue(config, "bios", &opts->bios); _lookupCharValue(config, "shader", &opts->shader); _lookupIntValue(config, "logLevel", &opts->logLevel); @@ -365,7 +365,7 @@ void GBAConfigMap(const struct GBAConfig* config, struct GBAOptions* opts) { } } -void GBAConfigLoadDefaults(struct GBAConfig* config, const struct GBAOptions* opts) { +void mCoreConfigLoadDefaults(struct mCoreConfig* config, const struct GBAOptions* opts) { ConfigurationSetValue(&config->defaultsTable, 0, "bios", opts->bios); ConfigurationSetValue(&config->defaultsTable, 0, "shader", opts->shader); ConfigurationSetIntValue(&config->defaultsTable, 0, "skipBios", opts->skipBios); @@ -403,15 +403,15 @@ void GBAConfigLoadDefaults(struct GBAConfig* config, const struct GBAOptions* op } // These two are basically placeholders in case the internal layout changes, e.g. for loading separate files -struct Configuration* GBAConfigGetInput(struct GBAConfig* config) { +struct Configuration* mCoreConfigGetInput(struct mCoreConfig* config) { return &config->configTable; } -struct Configuration* GBAConfigGetOverrides(struct GBAConfig* config) { +struct Configuration* mCoreConfigGetOverrides(struct mCoreConfig* config) { return &config->configTable; } -void GBAConfigFreeOpts(struct GBAOptions* opts) { +void mCoreConfigFreeOpts(struct GBAOptions* opts) { free(opts->bios); free(opts->shader); free(opts->savegamePath); diff --git a/src/core/config.h b/src/core/config.h new file mode 100644 index 000000000..d74184ebe --- /dev/null +++ b/src/core/config.h @@ -0,0 +1,98 @@ +/* Copyright (c) 2013-2016 Jeffrey Pfau + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#ifndef M_CORE_CONFIG_H +#define M_CORE_CONFIG_H + +#include "util/common.h" + +#include "gba/gba.h" + +#include "util/configuration.h" + +struct mCoreConfig { + struct Configuration configTable; + struct Configuration defaultsTable; + struct Configuration overridesTable; + char* port; +}; + +struct GBAOptions { + char* bios; + bool skipBios; + bool useBios; + int logLevel; + int frameskip; + bool rewindEnable; + int rewindBufferCapacity; + int rewindBufferInterval; + float fpsTarget; + size_t audioBuffers; + unsigned sampleRate; + + int fullscreen; + int width; + int height; + bool lockAspectRatio; + bool resampleVideo; + bool suspendScreensaver; + char* shader; + + char* savegamePath; + char* savestatePath; + char* screenshotPath; + char* patchPath; + + int volume; + bool mute; + + bool videoSync; + bool audioSync; + + enum GBAIdleLoopOptimization idleOptimization; +}; + +void mCoreConfigInit(struct mCoreConfig*, const char* port); +void mCoreConfigDeinit(struct mCoreConfig*); + +#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2 +bool mCoreConfigLoad(struct mCoreConfig*); +bool mCoreConfigSave(const struct mCoreConfig*); +bool mCoreConfigLoadPath(struct mCoreConfig*, const char* path); +bool mCoreConfigSavePath(const struct mCoreConfig*, const char* path); + +void mCoreConfigMakePortable(const struct mCoreConfig*); +void mCoreConfigDirectory(char* out, size_t outLength); +#endif + +const char* mCoreConfigGetValue(const struct mCoreConfig*, const char* key); +bool mCoreConfigGetIntValue(const struct mCoreConfig*, const char* key, int* value); +bool mCoreConfigGetUIntValue(const struct mCoreConfig*, const char* key, unsigned* value); +bool mCoreConfigGetFloatValue(const struct mCoreConfig*, const char* key, float* value); + +void mCoreConfigSetValue(struct mCoreConfig*, const char* key, const char* value); +void mCoreConfigSetIntValue(struct mCoreConfig*, const char* key, int value); +void mCoreConfigSetUIntValue(struct mCoreConfig*, const char* key, unsigned value); +void mCoreConfigSetFloatValue(struct mCoreConfig*, const char* key, float value); + +void mCoreConfigSetDefaultValue(struct mCoreConfig*, const char* key, const char* value); +void mCoreConfigSetDefaultIntValue(struct mCoreConfig*, const char* key, int value); +void mCoreConfigSetDefaultUIntValue(struct mCoreConfig*, const char* key, unsigned value); +void mCoreConfigSetDefaultFloatValue(struct mCoreConfig*, const char* key, float value); + +void mCoreConfigSetOverrideValue(struct mCoreConfig*, const char* key, const char* value); +void mCoreConfigSetOverrideIntValue(struct mCoreConfig*, const char* key, int value); +void mCoreConfigSetOverrideUIntValue(struct mCoreConfig*, const char* key, unsigned value); +void mCoreConfigSetOverrideFloatValue(struct mCoreConfig*, const char* key, float value); + +void mCoreConfigMap(const struct mCoreConfig* config, struct GBAOptions* opts); +void mCoreConfigLoadDefaults(struct mCoreConfig* config, const struct GBAOptions* opts); + +struct Configuration* mCoreConfigGetInput(struct mCoreConfig*); +struct Configuration* mCoreConfigGetOverrides(struct mCoreConfig*); + +void mCoreConfigFreeOpts(struct GBAOptions* opts); + +#endif diff --git a/src/core/directories.c b/src/core/directories.c index 6cde01325..5a5685e36 100644 --- a/src/core/directories.c +++ b/src/core/directories.c @@ -5,7 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "directories.h" -#include "gba/context/config.h" +#include "core/config.h" #include "util/vfs.h" #if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2 diff --git a/src/gba/context/config.h b/src/gba/context/config.h deleted file mode 100644 index ce35bf614..000000000 --- a/src/gba/context/config.h +++ /dev/null @@ -1,98 +0,0 @@ -/* Copyright (c) 2013-2015 Jeffrey Pfau - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef GBA_CONFIG_H -#define GBA_CONFIG_H - -#include "util/common.h" - -#include "gba/gba.h" - -#include "util/configuration.h" - -struct GBAConfig { - struct Configuration configTable; - struct Configuration defaultsTable; - struct Configuration overridesTable; - char* port; -}; - -struct GBAOptions { - char* bios; - bool skipBios; - bool useBios; - int logLevel; - int frameskip; - bool rewindEnable; - int rewindBufferCapacity; - int rewindBufferInterval; - float fpsTarget; - size_t audioBuffers; - unsigned sampleRate; - - int fullscreen; - int width; - int height; - bool lockAspectRatio; - bool resampleVideo; - bool suspendScreensaver; - char* shader; - - char* savegamePath; - char* savestatePath; - char* screenshotPath; - char* patchPath; - - int volume; - bool mute; - - bool videoSync; - bool audioSync; - - enum GBAIdleLoopOptimization idleOptimization; -}; - -void GBAConfigInit(struct GBAConfig*, const char* port); -void GBAConfigDeinit(struct GBAConfig*); - -#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2 -bool GBAConfigLoad(struct GBAConfig*); -bool GBAConfigSave(const struct GBAConfig*); -bool GBAConfigLoadPath(struct GBAConfig*, const char* path); -bool GBAConfigSavePath(const struct GBAConfig*, const char* path); - -void GBAConfigMakePortable(const struct GBAConfig*); -void GBAConfigDirectory(char* out, size_t outLength); -#endif - -const char* GBAConfigGetValue(const struct GBAConfig*, const char* key); -bool GBAConfigGetIntValue(const struct GBAConfig*, const char* key, int* value); -bool GBAConfigGetUIntValue(const struct GBAConfig*, const char* key, unsigned* value); -bool GBAConfigGetFloatValue(const struct GBAConfig*, const char* key, float* value); - -void GBAConfigSetValue(struct GBAConfig*, const char* key, const char* value); -void GBAConfigSetIntValue(struct GBAConfig*, const char* key, int value); -void GBAConfigSetUIntValue(struct GBAConfig*, const char* key, unsigned value); -void GBAConfigSetFloatValue(struct GBAConfig*, const char* key, float value); - -void GBAConfigSetDefaultValue(struct GBAConfig*, const char* key, const char* value); -void GBAConfigSetDefaultIntValue(struct GBAConfig*, const char* key, int value); -void GBAConfigSetDefaultUIntValue(struct GBAConfig*, const char* key, unsigned value); -void GBAConfigSetDefaultFloatValue(struct GBAConfig*, const char* key, float value); - -void GBAConfigSetOverrideValue(struct GBAConfig*, const char* key, const char* value); -void GBAConfigSetOverrideIntValue(struct GBAConfig*, const char* key, int value); -void GBAConfigSetOverrideUIntValue(struct GBAConfig*, const char* key, unsigned value); -void GBAConfigSetOverrideFloatValue(struct GBAConfig*, const char* key, float value); - -void GBAConfigMap(const struct GBAConfig* config, struct GBAOptions* opts); -void GBAConfigLoadDefaults(struct GBAConfig* config, const struct GBAOptions* opts); - -struct Configuration* GBAConfigGetInput(struct GBAConfig*); -struct Configuration* GBAConfigGetOverrides(struct GBAConfig*); - -void GBAConfigFreeOpts(struct GBAOptions* opts); - -#endif diff --git a/src/gba/context/context.c b/src/gba/context/context.c index 953d3691d..2926a5287 100644 --- a/src/gba/context/context.c +++ b/src/gba/context/context.c @@ -39,19 +39,19 @@ bool GBAContextInit(struct GBAContext* context, const char* port) { ARMSetComponents(context->cpu, &context->gba->d, GBA_COMPONENT_MAX, context->components); ARMInit(context->cpu); - GBAConfigInit(&context->config, port); + mCoreConfigInit(&context->config, port); #if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2 if (port) { if (!_logFile) { char logPath[PATH_MAX]; - GBAConfigDirectory(logPath, PATH_MAX); + mCoreConfigDirectory(logPath, PATH_MAX); strncat(logPath, PATH_SEP "log", PATH_MAX - strlen(logPath)); _logFile = VFileOpen(logPath, O_WRONLY | O_CREAT | O_TRUNC); } context->gba->logHandler = _GBAContextLog; char biosPath[PATH_MAX]; - GBAConfigDirectory(biosPath, PATH_MAX); + mCoreConfigDirectory(biosPath, PATH_MAX); strncat(biosPath, PATH_SEP "gba_bios.bin", PATH_MAX - strlen(biosPath)); struct GBAOptions opts = { @@ -60,8 +60,8 @@ bool GBAContextInit(struct GBAContext* context, const char* port) { .idleOptimization = IDLE_LOOP_DETECT, .logLevel = GBA_LOG_WARN | GBA_LOG_ERROR | GBA_LOG_FATAL | GBA_LOG_STATUS }; - GBAConfigLoad(&context->config); - GBAConfigLoadDefaults(&context->config, &opts); + mCoreConfigLoad(&context->config); + mCoreConfigLoadDefaults(&context->config, &opts); } #else UNUSED(port); @@ -80,7 +80,7 @@ void GBAContextDeinit(struct GBAContext* context) { } mappedMemoryFree(context->gba, 0); mappedMemoryFree(context->cpu, 0); - GBAConfigDeinit(&context->config); + mCoreConfigDeinit(&context->config); #if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2 mDirectorySetDeinit(&context->dirs); #endif @@ -171,7 +171,7 @@ bool GBAContextStart(struct GBAContext* context) { return false; } - GBAConfigMap(&context->config, &opts); + mCoreConfigMap(&context->config, &opts); if (!context->bios && opts.bios) { GBAContextLoadBIOS(context, opts.bios); @@ -194,8 +194,8 @@ bool GBAContextStart(struct GBAContext* context) { memcpy(override.id, &cart->id, sizeof(override.id)); struct Configuration* overrides = 0; #if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2 - overrides = GBAConfigGetOverrides(&context->config); - GBAConfigFreeOpts(&opts); + overrides = mCoreConfigGetOverrides(&context->config); + mCoreConfigFreeOpts(&opts); #endif if (GBAOverrideFind(overrides, &override)) { GBAOverrideApply(context->gba, &override); diff --git a/src/gba/context/context.h b/src/gba/context/context.h index cc83777fa..389be7cf1 100644 --- a/src/gba/context/context.h +++ b/src/gba/context/context.h @@ -9,8 +9,8 @@ #include "util/common.h" #include "core/directories.h" +#include "core/config.h" #include "core/sync.h" -#include "gba/context/config.h" #include "gba/input.h" struct GBAContext { @@ -25,7 +25,7 @@ struct GBAContext { struct mDirectorySet dirs; #endif struct ARMComponent* components[GBA_COMPONENT_MAX]; - struct GBAConfig config; + struct mCoreConfig config; struct GBAOptions opts; struct GBAInputMap inputMap; }; diff --git a/src/gba/gui/gui-config.c b/src/gba/gui/gui-config.c index a7b5bc3e5..1a08aae70 100644 --- a/src/gba/gui/gui-config.c +++ b/src/gba/gui/gui-config.c @@ -93,7 +93,7 @@ void GBAGUIShowConfig(struct GBAGUIRunner* runner, struct GUIMenuItem* extra, si if (!item->validStates || !item->data) { continue; } - GBAConfigGetUIntValue(&runner->context.config, item->data, &item->state); + mCoreConfigGetUIntValue(&runner->context.config, item->data, &item->state); } while (true) { @@ -103,16 +103,16 @@ void GBAGUIShowConfig(struct GBAGUIRunner* runner, struct GUIMenuItem* extra, si } if (!strcmp(item->data, "*SAVE")) { if (biosPath[0]) { - GBAConfigSetValue(&runner->context.config, "bios", biosPath); + mCoreConfigSetValue(&runner->context.config, "bios", biosPath); } for (i = 0; i < GUIMenuItemListSize(&menu.items); ++i) { item = GUIMenuItemListGetPointer(&menu.items, i); if (!item->validStates || !item->data) { continue; } - GBAConfigSetUIntValue(&runner->context.config, item->data, item->state); + mCoreConfigSetUIntValue(&runner->context.config, item->data, item->state); } - GBAConfigSave(&runner->context.config); + mCoreConfigSave(&runner->context.config); break; } if (!strcmp(item->data, "*REMAP")) { diff --git a/src/gba/gui/gui-runner.c b/src/gba/gui/gui-runner.c index 7d4f7eb17..c1bde3e49 100644 --- a/src/gba/gui/gui-runner.c +++ b/src/gba/gui/gui-runner.c @@ -124,7 +124,7 @@ void GBAGUIInit(struct GBAGUIRunner* runner, const char* port) { if (runner->context.config.port && runner->keySources) { size_t i; for (i = 0; runner->keySources[i].id; ++i) { - GBAInputMapLoad(&runner->context.inputMap, runner->keySources[i].id, GBAConfigGetInput(&runner->context.config)); + GBAInputMapLoad(&runner->context.inputMap, runner->keySources[i].id, mCoreConfigGetInput(&runner->context.config)); } } } @@ -137,10 +137,10 @@ void GBAGUIDeinit(struct GBAGUIRunner* runner) { if (runner->keySources) { size_t i; for (i = 0; runner->keySources[i].id; ++i) { - GBAInputMapSave(&runner->context.inputMap, runner->keySources[i].id, GBAConfigGetInput(&runner->context.config)); + GBAInputMapSave(&runner->context.inputMap, runner->keySources[i].id, mCoreConfigGetInput(&runner->context.config)); } } - GBAConfigSave(&runner->context.config); + mCoreConfigSave(&runner->context.config); } CircleBufferDeinit(&runner->fpsBuffer); GBAContextDeinit(&runner->context); @@ -272,7 +272,7 @@ void GBAGUIRun(struct GBAGUIRunner* runner, const char* path) { GBAContextFrame(&runner->context, keys); if (runner->drawFrame) { int drawFps = false; - GBAConfigGetIntValue(&runner->context.config, "fpsCounter", &drawFps); + mCoreConfigGetIntValue(&runner->context.config, "fpsCounter", &drawFps); runner->params.drawStart(); runner->drawFrame(runner, false); @@ -347,7 +347,7 @@ void GBAGUIRun(struct GBAGUIRunner* runner, const char* path) { break; case RUNNER_CONFIG: GBAGUIShowConfig(runner, runner->configExtra, runner->nConfigExtra); - GBAConfigGetIntValue(&runner->context.config, "frameskip", &runner->context.gba->video.frameskip); + mCoreConfigGetIntValue(&runner->context.config, "frameskip", &runner->context.gba->video.frameskip); break; case RUNNER_CONTINUE: break; diff --git a/src/gba/supervisor/thread.c b/src/gba/supervisor/thread.c index fa4f5214b..336ff9f5b 100644 --- a/src/gba/supervisor/thread.c +++ b/src/gba/supervisor/thread.c @@ -6,10 +6,10 @@ #include "thread.h" #include "arm.h" +#include "core/config.h" #include "gba/gba.h" #include "gba/cheats.h" #include "gba/serialize.h" -#include "gba/context/config.h" #include "gba/rr/mgm.h" #include "gba/rr/vbm.h" diff --git a/src/platform/3ds/main.c b/src/platform/3ds/main.c index 166c10f00..bf94356a4 100644 --- a/src/platform/3ds/main.c +++ b/src/platform/3ds/main.c @@ -271,7 +271,7 @@ static void _setup(struct GBAGUIRunner* runner) { runner->context.renderer = &renderer.d; unsigned mode; - if (GBAConfigGetUIntValue(&runner->context.config, "screenMode", &mode) && mode < SM_MAX) { + if (mCoreConfigGetUIntValue(&runner->context.config, "screenMode", &mode) && mode < SM_MAX) { screenMode = mode; } @@ -304,7 +304,7 @@ static void _gameLoaded(struct GBAGUIRunner* runner) { memset(audioLeft, 0, AUDIO_SAMPLE_BUFFER * 2 * sizeof(int16_t)); } unsigned mode; - if (GBAConfigGetUIntValue(&runner->context.config, "screenMode", &mode) && mode != screenMode) { + if (mCoreConfigGetUIntValue(&runner->context.config, "screenMode", &mode) && mode != screenMode) { screenMode = mode; screenCleanup |= SCREEN_CLEANUP_BOTTOM | SCREEN_CLEANUP_TOP; } @@ -437,7 +437,7 @@ static void _incrementScreenMode(struct GBAGUIRunner* runner) { UNUSED(runner); screenCleanup |= SCREEN_CLEANUP_TOP | SCREEN_CLEANUP_BOTTOM; screenMode = (screenMode + 1) % SM_MAX; - GBAConfigSetUIntValue(&runner->context.config, "screenMode", screenMode); + mCoreConfigSetUIntValue(&runner->context.config, "screenMode", screenMode); } static uint32_t _pollInput(void) { diff --git a/src/platform/commandline.c b/src/platform/commandline.c index 4e04277fa..a28edf098 100644 --- a/src/platform/commandline.c +++ b/src/platform/commandline.c @@ -50,9 +50,9 @@ static const struct option _options[] = { { 0, 0, 0, 0 } }; -static bool _parseGraphicsArg(struct SubParser* parser, struct GBAConfig* config, int option, const char* arg); +static bool _parseGraphicsArg(struct SubParser* parser, struct mCoreConfig* config, int option, const char* arg); -bool parseArguments(struct GBAArguments* opts, struct GBAConfig* config, int argc, char* const* argv, struct SubParser* subparser) { +bool parseArguments(struct GBAArguments* opts, struct mCoreConfig* config, int argc, char* const* argv, struct SubParser* subparser) { int ch; char options[64] = "b:c:hl:p:s:v:" @@ -80,7 +80,7 @@ bool parseArguments(struct GBAArguments* opts, struct GBAConfig* config, int arg } break; case 'b': - GBAConfigSetOverrideValue(config, "bios", optarg); + mCoreConfigSetOverrideValue(config, "bios", optarg); break; case 'c': opts->cheatsFile = strdup(optarg); @@ -105,13 +105,13 @@ bool parseArguments(struct GBAArguments* opts, struct GBAConfig* config, int arg opts->showHelp = true; break; case 'l': - GBAConfigSetOverrideValue(config, "logLevel", optarg); + mCoreConfigSetOverrideValue(config, "logLevel", optarg); break; case 'p': opts->patch = strdup(optarg); break; case 's': - GBAConfigSetOverrideValue(config, "frameskip", optarg); + mCoreConfigSetOverrideValue(config, "frameskip", optarg); break; case 'v': opts->movie = strdup(optarg); @@ -154,13 +154,13 @@ void initParserForGraphics(struct SubParser* parser, struct GraphicsOpts* opts) opts->fullscreen = false; } -bool _parseGraphicsArg(struct SubParser* parser, struct GBAConfig* config, int option, const char* arg) { +bool _parseGraphicsArg(struct SubParser* parser, struct mCoreConfig* config, int option, const char* arg) { UNUSED(arg); struct GraphicsOpts* graphicsOpts = parser->opts; switch (option) { case 'f': graphicsOpts->fullscreen = true; - GBAConfigSetOverrideIntValue(config, "fullscreen", 1); + mCoreConfigSetOverrideIntValue(config, "fullscreen", 1); return true; case '1': case '2': @@ -172,8 +172,8 @@ bool _parseGraphicsArg(struct SubParser* parser, struct GBAConfig* config, int o return false; } graphicsOpts->multiplier = option - '0'; - GBAConfigSetOverrideIntValue(config, "width", VIDEO_HORIZONTAL_PIXELS * graphicsOpts->multiplier); - GBAConfigSetOverrideIntValue(config, "height", VIDEO_VERTICAL_PIXELS * graphicsOpts->multiplier); + mCoreConfigSetOverrideIntValue(config, "width", VIDEO_HORIZONTAL_PIXELS * graphicsOpts->multiplier); + mCoreConfigSetOverrideIntValue(config, "height", VIDEO_VERTICAL_PIXELS * graphicsOpts->multiplier); return true; default: return false; diff --git a/src/platform/commandline.h b/src/platform/commandline.h index 737fab8cc..da13658e9 100644 --- a/src/platform/commandline.h +++ b/src/platform/commandline.h @@ -8,7 +8,7 @@ #include "util/common.h" -#include "gba/context/config.h" +#include "core/config.h" enum DebuggerType { DEBUGGER_NONE = 0, @@ -35,7 +35,7 @@ struct GBAArguments { struct SubParser { const char* usage; - bool (*parse)(struct SubParser* parser, struct GBAConfig* config, int option, const char* arg); + bool (*parse)(struct SubParser* parser, struct mCoreConfig* config, int option, const char* arg); const char* extraOptions; void* opts; }; @@ -47,7 +47,7 @@ struct GraphicsOpts { struct GBAThread; -bool parseArguments(struct GBAArguments* opts, struct GBAConfig* config, int argc, char* const* argv, +bool parseArguments(struct GBAArguments* opts, struct mCoreConfig* config, int argc, char* const* argv, struct SubParser* subparser); void freeArguments(struct GBAArguments* opts); diff --git a/src/platform/libretro/libretro.c b/src/platform/libretro/libretro.c index c4850cbbd..56965b9f5 100644 --- a/src/platform/libretro/libretro.c +++ b/src/platform/libretro/libretro.c @@ -79,7 +79,7 @@ static void _reloadSettings(void) { } } - GBAConfigLoadDefaults(&context.config, &opts); + mCoreConfigLoadDefaults(&context.config, &opts); } unsigned retro_api_version(void) { diff --git a/src/platform/openemu/mGBAGameCore.m b/src/platform/openemu/mGBAGameCore.m index a5749d6d8..4114cdb65 100644 --- a/src/platform/openemu/mGBAGameCore.m +++ b/src/platform/openemu/mGBAGameCore.m @@ -63,7 +63,7 @@ .useBios = true, .idleOptimization = IDLE_LOOP_REMOVE }; - GBAConfigLoadDefaults(&context.config, &opts); + mCoreConfigLoadDefaults(&context.config, &opts); GBAVideoSoftwareRendererCreate(&renderer); renderer.outputBuffer = malloc(256 * VIDEO_VERTICAL_PIXELS * BYTES_PER_PIXEL); renderer.outputBufferStride = 256; diff --git a/src/platform/psp2/psp2-context.c b/src/platform/psp2/psp2-context.c index 3f567e209..ef3a75819 100644 --- a/src/platform/psp2/psp2-context.c +++ b/src/platform/psp2/psp2-context.c @@ -257,11 +257,11 @@ void GBAPSP2DrawScreenshot(struct GBAGUIRunner* runner, const uint32_t* pixels, void GBAPSP2IncrementScreenMode(struct GBAGUIRunner* runner) { unsigned mode; - if (GBAConfigGetUIntValue(&runner->context.config, "screenMode", &mode) && mode != screenMode) { + if (mCoreConfigGetUIntValue(&runner->context.config, "screenMode", &mode) && mode != screenMode) { screenMode = mode; } else { screenMode = (screenMode + 1) % SM_MAX; - GBAConfigSetUIntValue(&runner->context.config, "screenMode", screenMode); + mCoreConfigSetUIntValue(&runner->context.config, "screenMode", screenMode); } } diff --git a/src/platform/qt/ConfigController.cpp b/src/platform/qt/ConfigController.cpp index a2383333d..ecb1eaa22 100644 --- a/src/platform/qt/ConfigController.cpp +++ b/src/platform/qt/ConfigController.cpp @@ -96,13 +96,13 @@ ConfigController::ConfigController(QObject* parent) , m_opts() { char path[PATH_MAX]; - GBAConfigDirectory(path, sizeof(path)); + mCoreConfigDirectory(path, sizeof(path)); QString fileName(path); fileName.append(QDir::separator()); fileName.append("qt.ini"); m_settings = new QSettings(fileName, QSettings::IniFormat, this); - GBAConfigInit(&m_config, PORT); + mCoreConfigInit(&m_config, PORT); m_opts.audioSync = GameController::AUDIO_SYNC; m_opts.videoSync = GameController::VIDEO_SYNC; @@ -116,20 +116,20 @@ ConfigController::ConfigController(QObject* parent) m_opts.rewindBufferCapacity = 0; m_opts.useBios = true; m_opts.suspendScreensaver = true; - GBAConfigLoad(&m_config); - GBAConfigLoadDefaults(&m_config, &m_opts); - GBAConfigMap(&m_config, &m_opts); + mCoreConfigLoad(&m_config); + mCoreConfigLoadDefaults(&m_config, &m_opts); + mCoreConfigMap(&m_config, &m_opts); } ConfigController::~ConfigController() { - GBAConfigDeinit(&m_config); - GBAConfigFreeOpts(&m_opts); + mCoreConfigDeinit(&m_config); + mCoreConfigFreeOpts(&m_opts); } bool ConfigController::parseArguments(GBAArguments* args, int argc, char* argv[], SubParser* subparser) { if (::parseArguments(args, &m_config, argc, argv, subparser)) { - GBAConfigFreeOpts(&m_opts); - GBAConfigMap(&m_config, &m_opts); + mCoreConfigFreeOpts(&m_opts); + mCoreConfigMap(&m_config, &m_opts); return true; } return false; @@ -159,11 +159,11 @@ void ConfigController::updateOption(const char* key) { if (!m_optionSet.contains(optionName)) { return; } - m_optionSet[optionName]->setValue(GBAConfigGetValue(&m_config, key)); + m_optionSet[optionName]->setValue(mCoreConfigGetValue(&m_config, key)); } QString ConfigController::getOption(const char* key) const { - return QString(GBAConfigGetValue(&m_config, key)); + return QString(mCoreConfigGetValue(&m_config, key)); } QVariant ConfigController::getQtOption(const QString& key, const QString& group) const { @@ -183,7 +183,7 @@ void ConfigController::saveOverride(const GBACartridgeOverride& override) { } void ConfigController::setOption(const char* key, bool value) { - GBAConfigSetIntValue(&m_config, key, value); + mCoreConfigSetIntValue(&m_config, key, value); QString optionName(key); if (m_optionSet.contains(optionName)) { m_optionSet[optionName]->setValue(value); @@ -191,7 +191,7 @@ void ConfigController::setOption(const char* key, bool value) { } void ConfigController::setOption(const char* key, int value) { - GBAConfigSetIntValue(&m_config, key, value); + mCoreConfigSetIntValue(&m_config, key, value); QString optionName(key); if (m_optionSet.contains(optionName)) { m_optionSet[optionName]->setValue(value); @@ -199,7 +199,7 @@ void ConfigController::setOption(const char* key, int value) { } void ConfigController::setOption(const char* key, unsigned value) { - GBAConfigSetUIntValue(&m_config, key, value); + mCoreConfigSetUIntValue(&m_config, key, value); QString optionName(key); if (m_optionSet.contains(optionName)) { m_optionSet[optionName]->setValue(value); @@ -207,7 +207,7 @@ void ConfigController::setOption(const char* key, unsigned value) { } void ConfigController::setOption(const char* key, const char* value) { - GBAConfigSetValue(&m_config, key, value); + mCoreConfigSetValue(&m_config, key, value); QString optionName(key); if (m_optionSet.contains(optionName)) { m_optionSet[optionName]->setValue(value); @@ -261,18 +261,18 @@ void ConfigController::setMRU(const QList& mru) { } void ConfigController::write() { - GBAConfigSave(&m_config); + mCoreConfigSave(&m_config); m_settings->sync(); - GBAConfigFreeOpts(&m_opts); - GBAConfigMap(&m_config, &m_opts); + mCoreConfigFreeOpts(&m_opts); + mCoreConfigMap(&m_config, &m_opts); } void ConfigController::makePortable() { - GBAConfigMakePortable(&m_config); + mCoreConfigMakePortable(&m_config); char path[PATH_MAX]; - GBAConfigDirectory(path, sizeof(path)); + mCoreConfigDirectory(path, sizeof(path)); QString fileName(path); fileName.append(QDir::separator()); fileName.append("qt.ini"); diff --git a/src/platform/qt/ConfigController.h b/src/platform/qt/ConfigController.h index f4723427d..a347ab47a 100644 --- a/src/platform/qt/ConfigController.h +++ b/src/platform/qt/ConfigController.h @@ -14,7 +14,7 @@ #include extern "C" { -#include "gba/context/config.h" +#include "core/config.h" #include "util/configuration.h" #include "platform/commandline.h" } @@ -77,10 +77,10 @@ public: QList getMRU() const; void setMRU(const QList& mru); - Configuration* overrides() { return GBAConfigGetOverrides(&m_config); } + Configuration* overrides() { return mCoreConfigGetOverrides(&m_config); } void saveOverride(const GBACartridgeOverride&); - Configuration* input() { return GBAConfigGetInput(&m_config); } + Configuration* input() { return mCoreConfigGetInput(&m_config); } public slots: void setOption(const char* key, bool value); @@ -96,7 +96,7 @@ public slots: private: Configuration* defaults() { return &m_config.defaultsTable; } - GBAConfig m_config; + mCoreConfig m_config; GBAOptions m_opts; QMap m_optionSet; diff --git a/src/platform/qt/GameController.cpp b/src/platform/qt/GameController.cpp index 56c4ef0cc..3658f926e 100644 --- a/src/platform/qt/GameController.cpp +++ b/src/platform/qt/GameController.cpp @@ -18,9 +18,9 @@ #include extern "C" { +#include "core/config.h" #include "core/directories.h" #include "gba/audio.h" -#include "gba/context/config.h" #include "gba/gba.h" #include "gba/serialize.h" #include "gba/sharkport.h" diff --git a/src/platform/sdl/main.c b/src/platform/sdl/main.c index 6f0d63194..3365d82d6 100644 --- a/src/platform/sdl/main.c +++ b/src/platform/sdl/main.c @@ -14,9 +14,9 @@ #endif #include "core/core.h" +#include "core/config.h" #ifdef M_CORE_GBA #include "gba/gba.h" -#include "gba/context/config.h" #include "gba/supervisor/thread.h" #include "gba/video.h" #endif @@ -49,7 +49,7 @@ static void mSDLDeinit(struct mSDLRenderer* renderer); // TODO: Clean up signatures #ifdef M_CORE_GBA -static int mSDLRunGBA(struct mSDLRenderer* renderer, struct GBAArguments* args, struct GBAOptions* opts, struct GBAConfig* config); +static int mSDLRunGBA(struct mSDLRenderer* renderer, struct GBAArguments* args, struct GBAOptions* opts, struct mCoreConfig* config); #endif #ifdef M_CORE_GB static int mSDLRunGB(struct mSDLRenderer* renderer, struct GBAArguments* args); @@ -62,9 +62,9 @@ int main(int argc, char** argv) { struct GBAInputMap inputMap; GBAInputMapInit(&inputMap); - struct GBAConfig config; - GBAConfigInit(&config, PORT); - GBAConfigLoad(&config); + struct mCoreConfig config; + mCoreConfigInit(&config, PORT); + mCoreConfigLoad(&config); struct GBAOptions opts = { .width = 0, @@ -86,15 +86,15 @@ int main(int argc, char** argv) { if (!parsed || args.showHelp) { usage(argv[0], subparser.usage); freeArguments(&args); - GBAConfigFreeOpts(&opts); - GBAConfigDeinit(&config); + mCoreConfigFreeOpts(&opts); + mCoreConfigDeinit(&config); return !parsed; } if (args.showVersion) { version(argv[0]); freeArguments(&args); - GBAConfigFreeOpts(&opts); - GBAConfigDeinit(&config); + mCoreConfigFreeOpts(&opts); + mCoreConfigDeinit(&config); return 0; } @@ -105,8 +105,8 @@ int main(int argc, char** argv) { if (!vf) { printf("Could not open game. Are you sure the file exists?\n"); freeArguments(&args); - GBAConfigFreeOpts(&opts); - GBAConfigDeinit(&config); + mCoreConfigFreeOpts(&opts); + mCoreConfigDeinit(&config); return 1; } #ifdef M_CORE_GBA @@ -150,14 +150,14 @@ int main(int argc, char** argv) { else { printf("Could not run game. Are you sure the file exists and is a Game Boy Advance game?\n"); freeArguments(&args); - GBAConfigFreeOpts(&opts); - GBAConfigDeinit(&config); + mCoreConfigFreeOpts(&opts); + mCoreConfigDeinit(&config); return 1; } } - GBAConfigLoadDefaults(&config, &opts); - GBAConfigMap(&config, &opts); + mCoreConfigLoadDefaults(&config, &opts); + mCoreConfigMap(&config, &opts); renderer.viewportWidth = opts.width; renderer.viewportHeight = opts.height; @@ -177,8 +177,8 @@ int main(int argc, char** argv) { if (!mSDLInit(&renderer)) { freeArguments(&args); - GBAConfigFreeOpts(&opts); - GBAConfigDeinit(&config); + mCoreConfigFreeOpts(&opts); + mCoreConfigDeinit(&config); return 1; } @@ -190,9 +190,9 @@ int main(int argc, char** argv) { renderer.player.bindings = &inputMap; GBASDLInitBindings(&inputMap); GBASDLInitEvents(&renderer.events); - GBASDLEventsLoadConfig(&renderer.events, GBAConfigGetInput(&config)); + GBASDLEventsLoadConfig(&renderer.events, mCoreConfigGetInput(&config)); GBASDLAttachPlayer(&renderer.events, &renderer.player); - GBASDLPlayerLoadConfig(&renderer.player, GBAConfigGetInput(&config)); + GBASDLPlayerLoadConfig(&renderer.player, mCoreConfigGetInput(&config)); int ret; @@ -213,14 +213,14 @@ int main(int argc, char** argv) { mSDLDeinit(&renderer); freeArguments(&args); - GBAConfigFreeOpts(&opts); - GBAConfigDeinit(&config); + mCoreConfigFreeOpts(&opts); + mCoreConfigDeinit(&config); return ret; } #ifdef M_CORE_GBA -int mSDLRunGBA(struct mSDLRenderer* renderer, struct GBAArguments* args, struct GBAOptions* opts, struct GBAConfig* config) { +int mSDLRunGBA(struct mSDLRenderer* renderer, struct GBAArguments* args, struct GBAOptions* opts, struct mCoreConfig* config) { struct GBAThread context = { .renderer = &renderer->d.d, .userData = renderer @@ -230,7 +230,7 @@ int mSDLRunGBA(struct mSDLRenderer* renderer, struct GBAArguments* args, struct GBAMapOptionsToContext(opts, &context); GBAMapArgumentsToContext(args, &context); - context.overrides = GBAConfigGetOverrides(config); + context.overrides = mCoreConfigGetOverrides(config); bool didFail = false; diff --git a/src/platform/test/fuzz-main.c b/src/platform/test/fuzz-main.c index a6bd619ab..b66767d43 100644 --- a/src/platform/test/fuzz-main.c +++ b/src/platform/test/fuzz-main.c @@ -3,7 +3,7 @@ * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "gba/context/config.h" +#include "core/config.h" #include "gba/context/context.h" #include "gba/gba.h" #include "gba/renderers/video-software.h" @@ -36,7 +36,7 @@ struct FuzzOpts { static void _GBAFuzzRunloop(struct GBAContext* context, int frames); static void _GBAFuzzShutdown(int signal); -static bool _parseFuzzOpts(struct SubParser* parser, struct GBAConfig* config, int option, const char* arg); +static bool _parseFuzzOpts(struct SubParser* parser, struct mCoreConfig* config, int option, const char* arg); static bool _dispatchExiting = false; @@ -56,8 +56,8 @@ int main(int argc, char** argv) { struct GBAOptions opts = { .idleOptimization = IDLE_LOOP_DETECT }; - GBAConfigLoadDefaults(&context.config, &opts); - GBAConfigFreeOpts(&opts); + mCoreConfigLoadDefaults(&context.config, &opts); + mCoreConfigFreeOpts(&opts); struct GBAArguments args; bool parsed = parseArguments(&args, &context.config, argc, argv, &subparser); @@ -161,7 +161,7 @@ static void _GBAFuzzShutdown(int signal) { _dispatchExiting = true; } -static bool _parseFuzzOpts(struct SubParser* parser, struct GBAConfig* config, int option, const char* arg) { +static bool _parseFuzzOpts(struct SubParser* parser, struct mCoreConfig* config, int option, const char* arg) { UNUSED(config); struct FuzzOpts* opts = parser->opts; errno = 0; diff --git a/src/platform/test/perf-main.c b/src/platform/test/perf-main.c index c3b354387..823598026 100644 --- a/src/platform/test/perf-main.c +++ b/src/platform/test/perf-main.c @@ -3,8 +3,8 @@ * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "core/config.h" #include "gba/supervisor/thread.h" -#include "gba/context/config.h" #include "gba/gba.h" #include "gba/renderers/video-software.h" #include "gba/serialize.h" @@ -38,7 +38,7 @@ struct PerfOpts { static void _GBAPerfRunloop(struct GBAThread* context, int* frames, bool quiet); static void _GBAPerfShutdown(int signal); -static bool _parsePerfOpts(struct SubParser* parser, struct GBAConfig* config, int option, const char* arg); +static bool _parsePerfOpts(struct SubParser* parser, struct mCoreConfig* config, int option, const char* arg); static void _loadSavestate(struct GBAThread* context); static struct GBAThread* _thread; @@ -59,29 +59,29 @@ int main(int argc, char** argv) { .opts = &perfOpts }; - struct GBAConfig config; - GBAConfigInit(&config, "perf"); - GBAConfigLoad(&config); + struct mCoreConfig config; + mCoreConfigInit(&config, "perf"); + mCoreConfigLoad(&config); struct GBAOptions opts = { .idleOptimization = IDLE_LOOP_DETECT }; - GBAConfigLoadDefaults(&config, &opts); + mCoreConfigLoadDefaults(&config, &opts); struct GBAArguments args; bool parsed = parseArguments(&args, &config, argc, argv, &subparser); if (!parsed || args.showHelp) { usage(argv[0], PERF_USAGE); freeArguments(&args); - GBAConfigFreeOpts(&opts); - GBAConfigDeinit(&config); + mCoreConfigFreeOpts(&opts); + mCoreConfigDeinit(&config); return !parsed; } if (args.showVersion) { version(argv[0]); freeArguments(&args); - GBAConfigFreeOpts(&opts); - GBAConfigDeinit(&config); + mCoreConfigFreeOpts(&opts); + mCoreConfigDeinit(&config); return 0; } @@ -103,10 +103,10 @@ int main(int argc, char** argv) { } context.debugger = createDebugger(&args, &context); - context.overrides = GBAConfigGetOverrides(&config); + context.overrides = mCoreConfigGetOverrides(&config); char gameCode[5] = { 0 }; - GBAConfigMap(&config, &opts); + mCoreConfigMap(&config, &opts); opts.audioSync = false; opts.videoSync = false; GBAMapArgumentsToContext(&args, &context); @@ -158,9 +158,9 @@ cleanup: if (_savestate) { _savestate->close(_savestate); } - GBAConfigFreeOpts(&opts); + mCoreConfigFreeOpts(&opts); freeArguments(&args); - GBAConfigDeinit(&config); + mCoreConfigDeinit(&config); free(context.debugger); free(renderer.outputBuffer); @@ -212,7 +212,7 @@ static void _GBAPerfShutdown(int signal) { ConditionWake(&_thread->sync.videoFrameAvailableCond); } -static bool _parsePerfOpts(struct SubParser* parser, struct GBAConfig* config, int option, const char* arg) { +static bool _parsePerfOpts(struct SubParser* parser, struct mCoreConfig* config, int option, const char* arg) { UNUSED(config); struct PerfOpts* opts = parser->opts; errno = 0; diff --git a/src/platform/wii/main.c b/src/platform/wii/main.c index cf35ff13e..69ce5a989 100644 --- a/src/platform/wii/main.c +++ b/src/platform/wii/main.c @@ -599,10 +599,10 @@ void _unpaused(struct GBAGUIRunner* runner) { _CPU_ISR_Restore(level); unsigned mode; - if (GBAConfigGetUIntValue(&runner->context.config, "screenMode", &mode) && mode < SM_MAX) { + if (mCoreConfigGetUIntValue(&runner->context.config, "screenMode", &mode) && mode < SM_MAX) { screenMode = mode; } - if (GBAConfigGetUIntValue(&runner->context.config, "filter", &mode) && mode < FM_MAX) { + if (mCoreConfigGetUIntValue(&runner->context.config, "filter", &mode) && mode < FM_MAX) { switch (mode) { case FM_NEAREST: default: