From 67e28b2a82e782826aabfe79438b7fdd36db7b8c Mon Sep 17 00:00:00 2001 From: TuxSH Date: Fri, 17 Apr 2020 01:01:35 +0100 Subject: [PATCH] arm9: check for combos again after the PIN has been entered/splash has been displayed --- arm9/source/main.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/arm9/source/main.c b/arm9/source/main.c index 5221361..073a550 100644 --- a/arm9/source/main.c +++ b/arm9/source/main.c @@ -226,11 +226,21 @@ void main(int argc, char **argv, u32 magicWord) } u32 pinMode = MULTICONFIG(PIN); + bool shouldLoadConfigMenu = needConfig == CREATE_CONFIGURATION || ((pressed & (BUTTON_SELECT | BUTTON_L1)) == BUTTON_SELECT); bool pinExists = pinMode != 0 && verifyPin(pinMode); - //If no configuration file exists or SELECT is held or if booted from NTRCARD, load configuration menu - bool shouldLoadConfigMenu = needConfig == CREATE_CONFIGURATION || ((pressed & (BUTTON_SELECT | BUTTON_L1)) == BUTTON_SELECT); + /* If the PIN has been verified, wait to make it easier to press the SAFE_MODE combo or the configuration menu button + (if not already pressed, for the latter) */ + if(pinExists && !shouldLoadConfigMenu) + { + while(HID_PAD & PIN_BUTTONS); + wait(2000ULL); + //Update pressed buttons + pressed = HID_PAD; + } + + shouldLoadConfigMenu = needConfig == CREATE_CONFIGURATION || ((pressed & (BUTTON_SELECT | BUTTON_L1)) == BUTTON_SELECT); if(shouldLoadConfigMenu) { configMenu(pinExists, pinMode); @@ -247,13 +257,6 @@ void main(int argc, char **argv, u32 magicWord) isSafeMode = true; needToInitSd = true; - //If the PIN has been verified, wait to make it easier to press the SAFE_MODE combo - if(pinExists && !shouldLoadConfigMenu) - { - while(HID_PAD & PIN_BUTTONS); - wait(2000ULL); - } - goto boot; } @@ -271,7 +274,19 @@ void main(int argc, char **argv, u32 magicWord) else if((((pressed & SINGLE_PAYLOAD_BUTTONS) || (!autoBootEmu && (pressed & DPAD_BUTTONS))) && !(pressed & (BUTTON_L1 | BUTTON_R1))) || (((pressed & L_PAYLOAD_BUTTONS) || (autoBootEmu && (pressed & DPAD_BUTTONS))) && (pressed & BUTTON_L1))) loadHomebrewFirm(pressed); - if(splashMode == 2) loadSplash(); + if(splashMode == 2 && loadSplash()) pressed = HID_PAD; + + //Check SAFE_MODE combo again + if(!CFG_BOOTENV && pressed == SAFE_MODE) + { + nandType = FIRMWARE_SYSNAND; + firmSource = FIRMWARE_SYSNAND; + + isSafeMode = true; + needToInitSd = true; + + goto boot; + } //If booting from CTRNAND, always use SysNAND if(!isSdMode) nandType = FIRMWARE_SYSNAND;