Simplify the main logic, remove assumption that if not using A9LH, SysNAND can't have a newer FIRM than EmuNAND, fix derp
This commit is contained in:
parent
d5ce3044c8
commit
e07c230106
@ -80,7 +80,7 @@ void configMenu(bool isSdMode, bool oldPinStatus, u32 oldPinMode)
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *singleOptionsText[] = { "( ) Autoboot SysNAND",
|
const char *singleOptionsText[] = { "( ) Autoboot SysNAND",
|
||||||
"( ) Use SysNAND FIRM if booting with R (A9LH)",
|
"( ) Use SysNAND FIRM if booting with R",
|
||||||
"( ) Enable loading external FIRMs and modules",
|
"( ) Enable loading external FIRMs and modules",
|
||||||
"( ) Use custom path",
|
"( ) Use custom path",
|
||||||
"( ) Enable region/language emu. and ext. .code",
|
"( ) Enable region/language emu. and ext. .code",
|
||||||
|
@ -52,12 +52,12 @@ static bool switchToMainDir(bool isSd)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mountFs(bool isSd, bool switchToCtrNand)
|
bool mountFs(bool isSd, bool switchToCtrNand)
|
||||||
{
|
{
|
||||||
return isSd ? f_mount(&sdFs, "0:", 1) == FR_OK && switchToMainDir(true) :
|
return isSd ? f_mount(&sdFs, "0:", 1) == FR_OK && switchToMainDir(true) :
|
||||||
f_mount(&nandFs, "1:", 1) == FR_OK && (!switchToCtrNand || (f_chdrive("1:") == FR_OK && switchToMainDir(false)));
|
f_mount(&nandFs, "1:", 1) == FR_OK && (!switchToCtrNand || (f_chdrive("1:") == FR_OK && switchToMainDir(false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ void main(void)
|
|||||||
if(CFG_BOOTENV == 7)
|
if(CFG_BOOTENV == 7)
|
||||||
{
|
{
|
||||||
nandType = FIRMWARE_SYSNAND;
|
nandType = FIRMWARE_SYSNAND;
|
||||||
firmSource = CONFIG(USESYSFIRM) ? FIRMWARE_SYSNAND : (FirmwareSource)BOOTCFG_FIRM;
|
firmSource = (BOOTCFG_NAND != 0) == (BOOTCFG_FIRM != 0) ? FIRMWARE_SYSNAND : (FirmwareSource)BOOTCFG_FIRM;
|
||||||
needConfig = DONT_CONFIGURE;
|
needConfig = DONT_CONFIGURE;
|
||||||
|
|
||||||
//Flag to prevent multiple boot options-forcing
|
//Flag to prevent multiple boot options-forcing
|
||||||
@ -113,7 +113,7 @@ void main(void)
|
|||||||
bool pinExists = pinMode != 0 && verifyPin(pinMode);
|
bool pinExists = pinMode != 0 && verifyPin(pinMode);
|
||||||
|
|
||||||
//If no configuration file exists or SELECT is held, load configuration menu
|
//If no configuration file exists or SELECT is held, load configuration menu
|
||||||
bool shouldLoadConfigMenu = needConfig == CREATE_CONFIGURATION || ((pressed & BUTTON_SELECT) && !(pressed & BUTTON_L1));
|
bool shouldLoadConfigMenu = needConfig == CREATE_CONFIGURATION || ((pressed & (BUTTON_SELECT | BUTTON_L1)) == BUTTON_SELECT);
|
||||||
|
|
||||||
if(shouldLoadConfigMenu)
|
if(shouldLoadConfigMenu)
|
||||||
{
|
{
|
||||||
@ -159,46 +159,47 @@ void main(void)
|
|||||||
//If R is pressed, boot the non-updated NAND with the FIRM of the opposite one
|
//If R is pressed, boot the non-updated NAND with the FIRM of the opposite one
|
||||||
else if(pressed & BUTTON_R1)
|
else if(pressed & BUTTON_R1)
|
||||||
{
|
{
|
||||||
//Determine if the user chose to use the SysNAND FIRM as default for a R boot
|
if(CONFIG(USESYSFIRM))
|
||||||
bool useSysAsDefault = ISA9LH ? CONFIG(USESYSFIRM) : false;
|
{
|
||||||
|
nandType = FIRMWARE_EMUNAND;
|
||||||
nandType = useSysAsDefault ? FIRMWARE_EMUNAND : FIRMWARE_SYSNAND;
|
firmSource = FIRMWARE_SYSNAND;
|
||||||
firmSource = useSysAsDefault ? FIRMWARE_SYSNAND : FIRMWARE_EMUNAND;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nandType = FIRMWARE_SYSNAND;
|
||||||
|
firmSource = FIRMWARE_EMUNAND;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Else, boot the NAND the user set to autoboot or the opposite one, depending on L,
|
/* Else, boot the NAND the user set to autoboot or the opposite one, depending on L,
|
||||||
with their own FIRM */
|
with their own FIRM */
|
||||||
else
|
else firmSource = nandType = (CONFIG(AUTOBOOTSYS) == ((pressed & BUTTON_L1) == BUTTON_L1)) ? FIRMWARE_EMUNAND : FIRMWARE_SYSNAND;
|
||||||
{
|
|
||||||
nandType = (CONFIG(AUTOBOOTSYS) != !(pressed & BUTTON_L1)) ? FIRMWARE_EMUNAND : FIRMWARE_SYSNAND;
|
|
||||||
firmSource = nandType;
|
|
||||||
}
|
|
||||||
|
|
||||||
//If we're booting EmuNAND or using EmuNAND FIRM, determine which one from the directional pad buttons, or otherwise from the config
|
//If we're booting EmuNAND or using EmuNAND FIRM, determine which one from the directional pad buttons, or otherwise from the config
|
||||||
if(nandType == FIRMWARE_EMUNAND || firmSource == FIRMWARE_EMUNAND)
|
if(nandType == FIRMWARE_EMUNAND || firmSource == FIRMWARE_EMUNAND)
|
||||||
{
|
{
|
||||||
FirmwareSource temp;
|
FirmwareSource tempNand;
|
||||||
switch(pressed & EMUNAND_BUTTONS)
|
switch(pressed & EMUNAND_BUTTONS)
|
||||||
{
|
{
|
||||||
case BUTTON_UP:
|
case BUTTON_UP:
|
||||||
temp = FIRMWARE_EMUNAND;
|
tempNand = FIRMWARE_EMUNAND;
|
||||||
break;
|
break;
|
||||||
case BUTTON_RIGHT:
|
case BUTTON_RIGHT:
|
||||||
temp = FIRMWARE_EMUNAND2;
|
tempNand = FIRMWARE_EMUNAND2;
|
||||||
break;
|
break;
|
||||||
case BUTTON_DOWN:
|
case BUTTON_DOWN:
|
||||||
temp = FIRMWARE_EMUNAND3;
|
tempNand = FIRMWARE_EMUNAND3;
|
||||||
break;
|
break;
|
||||||
case BUTTON_LEFT:
|
case BUTTON_LEFT:
|
||||||
temp = FIRMWARE_EMUNAND4;
|
tempNand = FIRMWARE_EMUNAND4;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
temp = (FirmwareSource)(1 + MULTICONFIG(DEFAULTEMU));
|
tempNand = (FirmwareSource)(1 + MULTICONFIG(DEFAULTEMU));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nandType == FIRMWARE_EMUNAND) nandType = temp;
|
if(nandType == FIRMWARE_EMUNAND) nandType = tempNand;
|
||||||
else firmSource = temp;
|
else firmSource = tempNand;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user