GBA Config: Functions for loading and saving configs from a path
Jeffrey Pfau jeffrey@endrift.com
Tue, 21 Jul 2015 19:22:02 -0700
2 files changed,
11 insertions(+),
1 deletions(-)
M
src/gba/supervisor/config.c
→
src/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.h
→
src/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);