diff --git a/include/arm11/config.h b/include/arm11/config.h index 13b6581..aa76faf 100644 --- a/include/arm11/config.h +++ b/include/arm11/config.h @@ -46,6 +46,7 @@ KBootMode, KDevMode, + KRamFirmBoot, /* KBootOption1NandImage, @@ -86,6 +87,7 @@ void configRestoreDefaults(); bool configDeleteKey(int key); bool configDevModeEnabled(); +bool configRamFirmBootEnabled(); #ifdef __cplusplus } diff --git a/source/arm11/config.c b/source/arm11/config.c index 5b11e2e..ed24c88 100644 --- a/source/arm11/config.c +++ b/source/arm11/config.c @@ -60,8 +60,8 @@ static bool writeBootOptionPad(AttributeEntryType *attr, const void *newData, int key); static bool parseBootMode(AttributeEntryType *attr); static bool writeBootMode(AttributeEntryType *attr, const void *newData, int key); -static bool parseDevMode(AttributeEntryType *attr); -static bool writeDevMode(AttributeEntryType *attr, const void *newData, int key); +static bool parseBool(AttributeEntryType *attr); +static bool writeBool(AttributeEntryType *attr, const void *newData, int key); static const char *keyStrings[] = { "BOOT_OPTION1", @@ -87,7 +87,8 @@ "BOOT_OPTION9_BUTTONS", "BOOT_MODE", - "DEV_MODE" + "DEV_MODE", + "RAM_FIRM_BOOT" /* "BOOT_OPTION1_NAND_IMAGE", @@ -109,7 +110,7 @@ { parsePath, writePath }, { parseBootOptionPad, writeBootOptionPad }, { parseBootMode, writeBootMode }, - { parseDevMode, writeDevMode } + { parseBool, writeBool } }; if(key <= KSplashScreen && key >= KBootOption1) @@ -118,7 +119,7 @@ return &keyFunctions[1]; if(key == KBootMode) return &keyFunctions[2]; - if(key == KDevMode) + if(key == KDevMode || key == KRamFirmBoot) return &keyFunctions[3]; return NULL; @@ -851,18 +852,18 @@ return true; } -static const char * devModeStates[] = { +static const char * boolStates[] = { "Enabled", "Disabled" }; -static bool parseDevMode(AttributeEntryType *attr) +static bool parseBool(AttributeEntryType *attr) { char *textData = attr->textData; bool enabled; - if(strnicmp(textData, devModeStates[0], strlen(devModeStates[0])) == 0) + if(strnicmp(textData, boolStates[0], strlen(boolStates[0])) == 0) enabled = true; - else if(strnicmp(textData, devModeStates[1], strlen(devModeStates[1])) == 0) + else if(strnicmp(textData, boolStates[1], strlen(boolStates[1])) == 0) enabled = false; else { @@ -878,7 +879,7 @@ return true; } -static bool writeDevMode(AttributeEntryType *attr, const void *newData, int key) +static bool writeBool(AttributeEntryType *attr, const void *newData, int key) { bool enabled; @@ -896,7 +897,7 @@ *(bool *)attr->data = enabled; - const char *textData = devModeStates[enabled ? 0 : 1]; + const char *textData = boolStates[enabled ? 0 : 1]; writeAttributeText(attr, textData, key); @@ -1020,14 +1021,24 @@ return false; } -bool configDevModeEnabled() +static inline bool safeReadBoolKey(int key) { const bool *enabled; - enabled = configGetData(KDevMode); + enabled = configGetData(key); if(!enabled || *enabled == false) return false; return true; } + +bool configDevModeEnabled() +{ + return safeReadBoolKey(KDevMode); +} + +bool configRamFirmBootEnabled() +{ + return safeReadBoolKey(KRamFirmBoot); +}