Always hide PIN, rework dev. options, fix bug
This commit is contained in:
parent
b1b81c87f2
commit
706cd50f25
@ -73,7 +73,6 @@ void configMenu(bool isSdMode, bool oldPinStatus, u32 oldPinMode)
|
|||||||
"Splash: Off( ) Before( ) After( ) payloads",
|
"Splash: Off( ) Before( ) After( ) payloads",
|
||||||
"PIN lock: Off( ) 4( ) 6( ) 8( ) digits",
|
"PIN lock: Off( ) 4( ) 6( ) 8( ) digits",
|
||||||
"New 3DS CPU: Off( ) Clock( ) L2( ) Clock+L2( )",
|
"New 3DS CPU: Off( ) Clock( ) L2( ) Clock+L2( )",
|
||||||
"Dev. features: Off( ) ErrDisp( ) UNITINFO( )"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *singleOptionsText[] = { "( ) Autoboot SysNAND",
|
const char *singleOptionsText[] = { "( ) Autoboot SysNAND",
|
||||||
@ -84,7 +83,8 @@ void configMenu(bool isSdMode, bool oldPinStatus, u32 oldPinMode)
|
|||||||
"( ) Show NAND or user string in System Settings",
|
"( ) Show NAND or user string in System Settings",
|
||||||
"( ) Show GBA boot screen in patched AGB_FIRM",
|
"( ) Show GBA boot screen in patched AGB_FIRM",
|
||||||
"( ) Patch SVC/service/archive/ARM9 access",
|
"( ) Patch SVC/service/archive/ARM9 access",
|
||||||
"( ) Hide Pin when entering"
|
"( ) Set developer UNITINFO",
|
||||||
|
"( ) Enable exception handlers"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *optionsDescription[] = { "Select the default EmuNAND.\n\n"
|
const char *optionsDescription[] = { "Select the default EmuNAND.\n\n"
|
||||||
@ -116,20 +116,6 @@ void configMenu(bool isSdMode, bool oldPinStatus, u32 oldPinMode)
|
|||||||
"'Clock+L2' can cause issues with some\n"
|
"'Clock+L2' can cause issues with some\n"
|
||||||
"games.",
|
"games.",
|
||||||
|
|
||||||
"Select the developer features.\n\n"
|
|
||||||
"\t* If 'Off' is not checked, exception\n"
|
|
||||||
"handlers will be enabled on A9LH.\n"
|
|
||||||
"\t* 'ErrDisp' also displays debug info\n"
|
|
||||||
"on the 'An error has occurred' screen.\n"
|
|
||||||
"\t* 'UNITINFO' also makes the console\n"
|
|
||||||
"be always detected as a\n"
|
|
||||||
"development unit\n"
|
|
||||||
"(which breaks online features, amiibos\n"
|
|
||||||
"and retail CIAs, but allows installing\n"
|
|
||||||
"and booting some developer software).\n\n"
|
|
||||||
"Only change this if you know what you\n"
|
|
||||||
"are doing!",
|
|
||||||
|
|
||||||
"If enabled, SysNAND will be launched\n"
|
"If enabled, SysNAND will be launched\n"
|
||||||
"on boot.\n\n"
|
"on boot.\n\n"
|
||||||
"Otherwise, an EmuNAND will.\n\n"
|
"Otherwise, an EmuNAND will.\n\n"
|
||||||
@ -191,9 +177,20 @@ void configMenu(bool isSdMode, bool oldPinStatus, u32 oldPinMode)
|
|||||||
"9.3 and 10.4.\n\n"
|
"9.3 and 10.4.\n\n"
|
||||||
"Only change this if you know what you\n"
|
"Only change this if you know what you\n"
|
||||||
"are doing!",
|
"are doing!",
|
||||||
|
|
||||||
"Hides the input when entering pin\n"
|
"Makes the console be always detected\n"
|
||||||
"to unlock the 3DS"
|
"as a development unit\n"
|
||||||
|
"(which breaks online features, amiibo\n"
|
||||||
|
"and retail CIAs, but allows installing\n"
|
||||||
|
"and booting some developer software).\n\n"
|
||||||
|
"Only change this if you know what you\n"
|
||||||
|
"are doing!",
|
||||||
|
|
||||||
|
"Enables Luma3DS's ARM9/ARM11 exception\n"
|
||||||
|
"handlers.\n"
|
||||||
|
"A9LH is required, and Luma3DS should\n"
|
||||||
|
"be ran as arm9loaderhax.bin.\n"
|
||||||
|
"Useful for debugging."
|
||||||
};
|
};
|
||||||
|
|
||||||
struct multiOption {
|
struct multiOption {
|
||||||
@ -207,7 +204,6 @@ void configMenu(bool isSdMode, bool oldPinStatus, u32 oldPinMode)
|
|||||||
{ .posXs = {12, 22, 31, 0}, .visible = true },
|
{ .posXs = {12, 22, 31, 0}, .visible = true },
|
||||||
{ .posXs = {14, 19, 24, 29}, .visible = true },
|
{ .posXs = {14, 19, 24, 29}, .visible = true },
|
||||||
{ .posXs = {17, 26, 32, 44}, .visible = ISN3DS },
|
{ .posXs = {17, 26, 32, 44}, .visible = ISN3DS },
|
||||||
{ .posXs = {19, 30, 42, 0}, .visible = true }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct singleOption {
|
struct singleOption {
|
||||||
@ -223,7 +219,8 @@ void configMenu(bool isSdMode, bool oldPinStatus, u32 oldPinMode)
|
|||||||
{ .visible = true },
|
{ .visible = true },
|
||||||
{ .visible = true },
|
{ .visible = true },
|
||||||
{ .visible = true },
|
{ .visible = true },
|
||||||
{ .visible = true }
|
{ .visible = true },
|
||||||
|
{ .visible = true}
|
||||||
};
|
};
|
||||||
|
|
||||||
//Calculate the amount of the various kinds of options and pre-select the first single one
|
//Calculate the amount of the various kinds of options and pre-select the first single one
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#define CONFIG_FILE "config.bin"
|
#define CONFIG_FILE "config.bin"
|
||||||
#define CONFIG_VERSIONMAJOR 1
|
#define CONFIG_VERSIONMAJOR 1
|
||||||
#define CONFIG_VERSIONMINOR 8
|
#define CONFIG_VERSIONMINOR 9
|
||||||
|
|
||||||
#define BOOTCFG_NAND BOOTCONFIG(0, 7)
|
#define BOOTCFG_NAND BOOTCONFIG(0, 7)
|
||||||
#define BOOTCFG_FIRM BOOTCONFIG(3, 7)
|
#define BOOTCFG_FIRM BOOTCONFIG(3, 7)
|
||||||
@ -44,7 +44,6 @@ enum multiOptions
|
|||||||
SPLASH,
|
SPLASH,
|
||||||
PIN,
|
PIN,
|
||||||
NEWCPU,
|
NEWCPU,
|
||||||
DEVOPTIONS
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum singleOptions
|
enum singleOptions
|
||||||
@ -57,7 +56,8 @@ enum singleOptions
|
|||||||
PATCHVERSTRING,
|
PATCHVERSTRING,
|
||||||
SHOWGBABOOT,
|
SHOWGBABOOT,
|
||||||
PATCHACCESS,
|
PATCHACCESS,
|
||||||
HIDEPIN
|
PATCHUNITINFO,
|
||||||
|
ENABLEEXCEPTIONHANDLERS
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum ConfigurationStatus
|
typedef enum ConfigurationStatus
|
||||||
|
@ -112,7 +112,7 @@ u32 loadFirm(FirmwareType *firmType, FirmwareSource nandType, bool loadFromStora
|
|||||||
return firmVersion;
|
return firmVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, bool isA9lhInstalled, bool isSafeMode, u32 devMode)
|
u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, bool isA9lhInstalled, bool isSafeMode, bool doUnitinfoPatch, bool enableExceptionHandlers)
|
||||||
{
|
{
|
||||||
u8 *arm9Section = (u8 *)firm + firm->section[2].offset,
|
u8 *arm9Section = (u8 *)firm + firm->section[2].offset,
|
||||||
*arm11Section1 = (u8 *)firm + firm->section[1].offset;
|
*arm11Section1 = (u8 *)firm + firm->section[1].offset;
|
||||||
@ -183,13 +183,13 @@ u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, boo
|
|||||||
ret += implementSvcGetCFWInfo(arm11Section1, arm11SvcTable, baseK11VA, &freeK11Space, isSafeMode);
|
ret += implementSvcGetCFWInfo(arm11Section1, arm11SvcTable, baseK11VA, &freeK11Space, isSafeMode);
|
||||||
|
|
||||||
//Apply UNITINFO patches
|
//Apply UNITINFO patches
|
||||||
if(devMode == 2)
|
if(doUnitinfoPatch)
|
||||||
{
|
{
|
||||||
ret += patchUnitInfoValueSet(arm9Section, kernel9Size);
|
ret += patchUnitInfoValueSet(arm9Section, kernel9Size);
|
||||||
if(!ISDEVUNIT) ret += patchCheckForDevCommonKey(process9Offset, process9Size);
|
if(!ISDEVUNIT) ret += patchCheckForDevCommonKey(process9Offset, process9Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(devMode != 0 && isA9lhInstalled)
|
if(enableExceptionHandlers && isA9lhInstalled)
|
||||||
{
|
{
|
||||||
//ARM11 exception handlers
|
//ARM11 exception handlers
|
||||||
u32 codeSetOffset,
|
u32 codeSetOffset,
|
||||||
@ -221,7 +221,7 @@ u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, boo
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 patchTwlFirm(u32 firmVersion, u32 devMode)
|
u32 patchTwlFirm(u32 firmVersion, bool doUnitinfoPatch)
|
||||||
{
|
{
|
||||||
u8 *arm9Section = (u8 *)firm + firm->section[3].offset;
|
u8 *arm9Section = (u8 *)firm + firm->section[3].offset;
|
||||||
|
|
||||||
@ -249,12 +249,12 @@ u32 patchTwlFirm(u32 firmVersion, u32 devMode)
|
|||||||
ret += patchTwlShaHashChecks(process9Offset, process9Size);
|
ret += patchTwlShaHashChecks(process9Offset, process9Size);
|
||||||
|
|
||||||
//Apply UNITINFO patch
|
//Apply UNITINFO patch
|
||||||
if(devMode == 2) ret += patchUnitInfoValueSet(arm9Section, kernel9Size);
|
if(doUnitinfoPatch) ret += patchUnitInfoValueSet(arm9Section, kernel9Size);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 patchAgbFirm(u32 devMode)
|
u32 patchAgbFirm(bool doUnitinfoPatch)
|
||||||
{
|
{
|
||||||
u8 *arm9Section = (u8 *)firm + firm->section[3].offset;
|
u8 *arm9Section = (u8 *)firm + firm->section[3].offset;
|
||||||
|
|
||||||
@ -277,12 +277,12 @@ u32 patchAgbFirm(u32 devMode)
|
|||||||
if(CONFIG(SHOWGBABOOT)) ret += patchAgbBootSplash(process9Offset, process9Size);
|
if(CONFIG(SHOWGBABOOT)) ret += patchAgbBootSplash(process9Offset, process9Size);
|
||||||
|
|
||||||
//Apply UNITINFO patch
|
//Apply UNITINFO patch
|
||||||
if(devMode == 2) ret += patchUnitInfoValueSet(arm9Section, kernel9Size);
|
if(doUnitinfoPatch) ret += patchUnitInfoValueSet(arm9Section, kernel9Size);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 patch1x2xNativeAndSafeFirm(u32 devMode)
|
u32 patch1x2xNativeAndSafeFirm(bool enableExceptionHandlers)
|
||||||
{
|
{
|
||||||
u8 *arm9Section = (u8 *)firm + firm->section[2].offset;
|
u8 *arm9Section = (u8 *)firm + firm->section[2].offset;
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ u32 patch1x2xNativeAndSafeFirm(u32 devMode)
|
|||||||
|
|
||||||
ret += ISN3DS ? patchSignatureChecks(process9Offset, process9Size) : patchOldSignatureChecks(process9Offset, process9Size);
|
ret += ISN3DS ? patchSignatureChecks(process9Offset, process9Size) : patchOldSignatureChecks(process9Offset, process9Size);
|
||||||
|
|
||||||
if(devMode != 0)
|
if(enableExceptionHandlers)
|
||||||
{
|
{
|
||||||
//ARM9 exception handlers
|
//ARM9 exception handlers
|
||||||
ret += patchArm9ExceptionHandlersInstall(arm9Section, kernel9Size);
|
ret += patchArm9ExceptionHandlersInstall(arm9Section, kernel9Size);
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
u32 loadFirm(FirmwareType *firmType, FirmwareSource nandType, bool loadFromStorage, bool isSafeMode);
|
u32 loadFirm(FirmwareType *firmType, FirmwareSource nandType, bool loadFromStorage, bool isSafeMode);
|
||||||
u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, bool isA9lhInstalled, bool isSafeMode, u32 devMode);
|
u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, bool isA9lhInstalled, bool isSafeMode, bool doUnitinfoPatch, bool enableExceptionHandlers);
|
||||||
u32 patchTwlFirm(u32 firmVersion, u32 devMode);
|
u32 patchTwlFirm(u32 firmVersion, bool doUnitinfoPatch);
|
||||||
u32 patchAgbFirm(u32 devMode);
|
u32 patchAgbFirm(bool doUnitinfoPatch);
|
||||||
u32 patch1x2xNativeAndSafeFirm(u32 devMode);
|
u32 patch1x2xNativeAndSafeFirm(bool enableExceptionHandlers);
|
||||||
void launchFirm(FirmwareType firmType, bool loadFromStorage);
|
void launchFirm(FirmwareType firmType, bool loadFromStorage);
|
||||||
|
@ -128,8 +128,7 @@ void main(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
u32 pinMode = MULTICONFIG(PIN);
|
u32 pinMode = MULTICONFIG(PIN);
|
||||||
bool hidePin = CONFIG(HIDEPIN);
|
bool pinExists = pinMode != 0 && verifyPin(pinMode, true);
|
||||||
bool pinExists = pinMode != 0 && verifyPin(pinMode, hidePin);
|
|
||||||
|
|
||||||
//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 | BUTTON_L1)) == BUTTON_SELECT);
|
bool shouldLoadConfigMenu = needConfig == CREATE_CONFIGURATION || ((pressed & (BUTTON_SELECT | BUTTON_L1)) == BUTTON_SELECT);
|
||||||
@ -246,24 +245,23 @@ boot:
|
|||||||
bool loadFromStorage = CONFIG(LOADEXTFIRMSANDMODULES);
|
bool loadFromStorage = CONFIG(LOADEXTFIRMSANDMODULES);
|
||||||
u32 firmVersion = loadFirm(&firmType, firmSource, loadFromStorage, isSafeMode);
|
u32 firmVersion = loadFirm(&firmType, firmSource, loadFromStorage, isSafeMode);
|
||||||
|
|
||||||
u32 devMode = MULTICONFIG(DEVOPTIONS);
|
bool doUnitinfoPatch = CONFIG(PATCHUNITINFO), enableExceptionHandlers = CONFIG(PATCHUNITINFO);
|
||||||
|
|
||||||
u32 res;
|
u32 res;
|
||||||
switch(firmType)
|
switch(firmType)
|
||||||
{
|
{
|
||||||
case NATIVE_FIRM:
|
case NATIVE_FIRM:
|
||||||
res = patchNativeFirm(firmVersion, nandType, emuHeader, isA9lhInstalled, isSafeMode, devMode);
|
res = patchNativeFirm(firmVersion, nandType, emuHeader, isA9lhInstalled, isSafeMode, doUnitinfoPatch, enableExceptionHandlers);
|
||||||
break;
|
break;
|
||||||
case TWL_FIRM:
|
case TWL_FIRM:
|
||||||
res = patchTwlFirm(firmVersion, devMode);
|
res = patchTwlFirm(firmVersion, doUnitinfoPatch);
|
||||||
break;
|
break;
|
||||||
case AGB_FIRM:
|
case AGB_FIRM:
|
||||||
res = patchAgbFirm(devMode);
|
res = patchAgbFirm(doUnitinfoPatch);
|
||||||
break;
|
break;
|
||||||
case SAFE_FIRM:
|
case SAFE_FIRM:
|
||||||
case SYSUPDATER_FIRM:
|
case SYSUPDATER_FIRM:
|
||||||
case NATIVE_FIRM1X2X:
|
case NATIVE_FIRM1X2X:
|
||||||
res = isA9lhInstalled ? patch1x2xNativeAndSafeFirm(devMode) : 0;
|
res = isA9lhInstalled ? patch1x2xNativeAndSafeFirm(enableExceptionHandlers) : 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,27 +299,9 @@ u32 stubTimerQueueSanityCheck(u8 *pos, u32 size)
|
|||||||
const u8 pattern[] = {0xF0, 0x41, 0x2D, 0xE9, 0x00, 0x60, 0xA0, 0xE1, 0x00, 0x70,
|
const u8 pattern[] = {0xF0, 0x41, 0x2D, 0xE9, 0x00, 0x60, 0xA0, 0xE1, 0x00, 0x70,
|
||||||
0xA0, 0xE3, 0x20, 0x00, 0x86, 0xE2};
|
0xA0, 0xE3, 0x20, 0x00, 0x86, 0xE2};
|
||||||
|
|
||||||
/* pattern2[] = {0x01, 0x20, 0xB0, 0xE1, 0xF5, 0xFF, 0xFF, 0x1A},
|
|
||||||
pattern3[] = {0x02, 0x00, 0x51, 0xE1, 0x01, 0x00, 0x00, 0x1A};
|
|
||||||
*/
|
|
||||||
u32 *off = (u32 *)memsearch(pos, pattern, size, sizeof(pattern));
|
u32 *off = (u32 *)memsearch(pos, pattern, size, sizeof(pattern));
|
||||||
if(off == NULL) return 1;
|
if(off != NULL) *off = 0xE12FFF1E; // Do not error, since we could be using an external FIRM, ...
|
||||||
*off = 0xE12FFF1E;
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/*
|
|
||||||
This results in UAFs, rip.. I could do patterns for all of the incref/decref code they added, but this is a PITA
|
|
||||||
The idea was to tell the make stuff think the timer was always in the queue and that the refcount shouldn't be incremented.
|
|
||||||
That was worth trying, though.
|
|
||||||
|
|
||||||
off = (u32 *)memsearch(pos, pattern2, size, sizeof(pattern2));
|
|
||||||
if(off == NULL) return 1;
|
|
||||||
off[8] = 0xE3A00000;
|
|
||||||
|
|
||||||
off = (u32 *)memsearch(pos, pattern3, size, sizeof(pattern3));
|
|
||||||
if(off == NULL) return 1;
|
|
||||||
off[4] = 0xE3A00001;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 implementSvcGetCFWInfo(u8 *pos, u32 *arm11SvcTable, u32 baseK11VA, u8 **freeK11Space, bool isSafeMode)
|
u32 implementSvcGetCFWInfo(u8 *pos, u32 *arm11SvcTable, u32 baseK11VA, u8 **freeK11Space, bool isSafeMode)
|
||||||
|
Reference in New Issue
Block a user