diff --git a/include/arm11/config.h b/include/arm11/config.h index 14e4092..67abc20 100644 --- a/include/arm11/config.h +++ b/include/arm11/config.h @@ -44,6 +44,7 @@ #define numKeys KLast bool loadConfigFile(); +bool configHasChanged(); bool writeConfigFile(); void *configCopyText(int key); const void *configGetData(int key); diff --git a/source/arm11/config.c b/source/arm11/config.c index 20b129f..0cee1ff 100644 --- a/source/arm11/config.c +++ b/source/arm11/config.c @@ -101,6 +101,7 @@ static char *filebuf = NULL; static bool configLoaded = false; +static bool configDirty = false; /* This loads the config file from SD card or eMMC and parses it */ bool loadConfigFile() @@ -112,6 +113,8 @@ if(configLoaded) unloadConfigFile(); + configDirty = false; + // first, try SD card fatfs if(true) // !!! if(bootInfo.sd_status == 2) { @@ -215,6 +218,11 @@ } } +bool configHasChanged() +{ + return configDirty; +} + bool writeConfigFile() { if(!filebuf) @@ -864,7 +872,13 @@ if(!keyFunctions[key].write) panicMsg("Unimplemented key function!"); - return keyFunctions[key].write(attr, data, key); + if(keyFunctions[key].write(attr, data, key)) + { + configDirty = true; + return true; + } + + return false; } void configRestoreDefaults() @@ -879,6 +893,8 @@ else configSetKeyData(key, ""); } + + configDirty = true; } @@ -901,6 +917,8 @@ attr->textData = NULL; attr->textLength = 0; + configDirty = true; + return true; }