all repos — mgba @ 0ecdc1ac44f60a1254fef93fd066b52f5274cb81

mGBA Game Boy Advance Emulator

GBA Config: Functions for loading and saving configs from a path
Jeffrey Pfau jeffrey@endrift.com
Tue, 21 Jul 2015 19:22:02 -0700
commit

0ecdc1ac44f60a1254fef93fd066b52f5274cb81

parent

037e518f5c3bab017d9a4486ff9dc820c03793db

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

jump to
M src/gba/supervisor/config.csrc/gba/supervisor/config.c

@@ -116,13 +116,21 @@ bool GBAConfigLoad(struct GBAConfig* config) {

char path[PATH_MAX]; GBAConfigDirectory(path, PATH_MAX); strncat(path, PATH_SEP "config.ini", PATH_MAX - strlen(path)); - return ConfigurationRead(&config->configTable, path); + return GBAConfigLoadPath(config, path); } bool GBAConfigSave(const struct GBAConfig* config) { char path[PATH_MAX]; GBAConfigDirectory(path, PATH_MAX); strncat(path, PATH_SEP "config.ini", PATH_MAX - strlen(path)); + return GBAConfigSavePath(config, path); +} + +bool GBAConfigLoadPath(struct GBAConfig* config, const char* path) { + return ConfigurationRead(&config->configTable, path); +} + +bool GBAConfigSavePath(const struct GBAConfig* config, const char* path) { return ConfigurationWrite(&config->configTable, path); }
M src/gba/supervisor/config.hsrc/gba/supervisor/config.h

@@ -51,6 +51,8 @@ void GBAConfigDeinit(struct GBAConfig*);

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);