Fix config derp

This commit is contained in:
Aurora 2016-08-26 21:38:03 +02:00
parent 60c4956290
commit b5cddedb7d

View File

@ -51,7 +51,7 @@ void main(void)
{ {
bool isA9lh; bool isA9lh;
u32 newConfig, u32 configTemp,
emuHeader; emuHeader;
FirmwareType firmType; FirmwareType firmType;
@ -100,7 +100,8 @@ void main(void)
//Determine if the user chose to use the SysNAND FIRM as default for a R boot //Determine if the user chose to use the SysNAND FIRM as default for a R boot
bool useSysAsDefault = isA9lh ? CONFIG(1) : false; bool useSysAsDefault = isA9lh ? CONFIG(1) : false;
newConfig = (config & 0xFFFFFFC0) | ((u32)isA9lh << 3); //Save old options and begin saving the new boot configuration
configTemp = (config & 0xFFFFFFC0) | ((u32)isA9lh << 3);
//If it's a MCU reboot, try to force boot options //If it's a MCU reboot, try to force boot options
if(isA9lh && CFG_BOOTENV) if(isA9lh && CFG_BOOTENV)
@ -113,7 +114,7 @@ void main(void)
needConfig = DONT_CONFIGURE; needConfig = DONT_CONFIGURE;
//Flag to prevent multiple boot options-forcing //Flag to prevent multiple boot options-forcing
newConfig |= 1 << 4; configTemp |= 1 << 4;
} }
/* Else, force the last used boot options unless a button is pressed /* Else, force the last used boot options unless a button is pressed
@ -203,14 +204,14 @@ void main(void)
if(!isFirmlaunch) if(!isFirmlaunch)
{ {
newConfig |= (u32)nandType | ((u32)firmSource << 2); configTemp |= (u32)nandType | ((u32)firmSource << 2);
/* If the boot configuration is different from previously, overwrite it. /* If the configuration is different from previously, overwrite it.
Just the no-forcing flag being set is not enough */ Just the no-forcing flag being set is not enough */
if((newConfig & 0xFFFFFFEF) != config) if((configTemp & 0xFFFFFFEF) != config)
{ {
//Update the last boot configuration //Merge the new options and new boot configuration
config |= newConfig & 0x3F; config = (config & 0xFFFFFFC0) | (configTemp & 0x3F);
if(!fileWrite(&config, configPath, 4)) if(!fileWrite(&config, configPath, 4))
{ {