Check the PIN before loading a payload.
Also fix some bugs.
This commit is contained in:
parent
709aefba5d
commit
e01802e299
@ -71,7 +71,6 @@ void main(void)
|
||||
|
||||
//Attempt to read the configuration file
|
||||
needConfig = fileRead(&config, configPath) ? MODIFY_CONFIGURATION : CREATE_CONFIGURATION;
|
||||
bool pinExists = CONFIG(7) && readPin(&pin);
|
||||
|
||||
//Determine if this is a firmlaunch boot
|
||||
if(*(vu8 *)0x23F00005)
|
||||
@ -127,15 +126,21 @@ void main(void)
|
||||
}
|
||||
}
|
||||
|
||||
//If no configuration file exists or SELECT is held, load configuration menu
|
||||
bool loadConfigurationMenu = needConfig == CREATE_CONFIGURATION || ((pressed & BUTTON_SELECT) && !(pressed & BUTTON_L1));
|
||||
bool needToDeinit = false;
|
||||
if(CFG_BOOTENV == 0 || loadConfigurationMenu)
|
||||
//Boot options aren't being forced
|
||||
if(needConfig != DONT_CONFIGURE)
|
||||
{
|
||||
if(loadConfigurationMenu || pinExists) needToDeinit = initScreens();
|
||||
//If no configuration file exists or SELECT is held, load configuration menu
|
||||
bool shouldLoadConfigurationMenu = needConfig == CREATE_CONFIGURATION || ((pressed & BUTTON_SELECT) && !(pressed & BUTTON_L1));
|
||||
bool pinExists = CONFIG(7) && readPin(&pin);
|
||||
|
||||
if(pinExists || shouldLoadConfigurationMenu)
|
||||
{
|
||||
bool needToDeinit = initScreens();
|
||||
|
||||
//If we get here we should check the PIN (if it exists) in all cases
|
||||
if(pinExists) verifyPin(&pin, true);
|
||||
}
|
||||
if(loadConfigurationMenu)
|
||||
|
||||
if(shouldLoadConfigurationMenu)
|
||||
{
|
||||
configureCFW(configPath);
|
||||
|
||||
@ -151,6 +156,7 @@ void main(void)
|
||||
//Update pressed buttons
|
||||
pressed = HID_PAD;
|
||||
}
|
||||
|
||||
if(needToDeinit)
|
||||
{
|
||||
//Turn off backlight
|
||||
@ -158,20 +164,20 @@ void main(void)
|
||||
deinitScreens();
|
||||
PDN_GPU_CNT = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(isA9lh && !CFG_BOOTENV && pressed == SAFE_MODE)
|
||||
{
|
||||
nandType = FIRMWARE_SYSNAND;
|
||||
firmSource = FIRMWARE_SYSNAND;
|
||||
needConfig = DONT_CONFIGURE;
|
||||
}
|
||||
|
||||
//Boot options aren't being forced
|
||||
if(needConfig != DONT_CONFIGURE)
|
||||
else
|
||||
{
|
||||
/* If L and R/A/Select or one of the single payload buttons are pressed,
|
||||
chainload an external payload */
|
||||
if((pressed & SINGLE_PAYLOAD_BUTTONS) || ((pressed & BUTTON_L1) && (pressed & L_PAYLOAD_BUTTONS)))
|
||||
chainload an external payload (verify the PIN if needed)*/
|
||||
bool shouldLoadPayload = (pressed & SINGLE_PAYLOAD_BUTTONS) || ((pressed & BUTTON_L1) && (pressed & L_PAYLOAD_BUTTONS));
|
||||
|
||||
if(shouldLoadPayload)
|
||||
loadPayload(pressed);
|
||||
|
||||
//If screens are inited or the corresponding option is set, load splash screen
|
||||
@ -201,6 +207,7 @@ void main(void)
|
||||
if(nandType != FIRMWARE_SYSNAND && (CONFIG(2) == !(pressed & BUTTON_B))) nandType = FIRMWARE_EMUNAND2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//If we need to boot emuNAND, make sure it exists
|
||||
if(nandType != FIRMWARE_SYSNAND)
|
||||
|
@ -30,7 +30,10 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifndef PIN_LENGTH
|
||||
#define PIN_LENGTH 4
|
||||
#endif
|
||||
|
||||
typedef struct __attribute__((packed))
|
||||
{
|
||||
char magic[4];
|
||||
|
Reference in New Issue
Block a user