mirror of https://github.com/mgba-emu/mgba.git
GBA Config: Functions for loading and saving configs from a path
This commit is contained in:
parent
037e518f5c
commit
0ecdc1ac44
|
@ -116,13 +116,21 @@ bool GBAConfigLoad(struct GBAConfig* config) {
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
GBAConfigDirectory(path, PATH_MAX);
|
GBAConfigDirectory(path, PATH_MAX);
|
||||||
strncat(path, PATH_SEP "config.ini", PATH_MAX - strlen(path));
|
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) {
|
bool GBAConfigSave(const struct GBAConfig* config) {
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
GBAConfigDirectory(path, PATH_MAX);
|
GBAConfigDirectory(path, PATH_MAX);
|
||||||
strncat(path, PATH_SEP "config.ini", PATH_MAX - strlen(path));
|
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);
|
return ConfigurationWrite(&config->configTable, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,8 @@ void GBAConfigDeinit(struct GBAConfig*);
|
||||||
|
|
||||||
bool GBAConfigLoad(struct GBAConfig*);
|
bool GBAConfigLoad(struct GBAConfig*);
|
||||||
bool GBAConfigSave(const 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 GBAConfigMakePortable(const struct GBAConfig*);
|
||||||
void GBAConfigDirectory(char* out, size_t outLength);
|
void GBAConfigDirectory(char* out, size_t outLength);
|
||||||
|
|
Loading…
Reference in New Issue