Always hide PIN, rework dev. options, fix bug

This commit is contained in:
TuxSH 2017-03-05 01:56:24 +01:00
parent b1b81c87f2
commit 706cd50f25
6 changed files with 42 additions and 65 deletions

View File

@ -73,7 +73,6 @@ void configMenu(bool isSdMode, bool oldPinStatus, u32 oldPinMode)
"Splash: Off( ) Before( ) After( ) payloads",
"PIN lock: Off( ) 4( ) 6( ) 8( ) digits",
"New 3DS CPU: Off( ) Clock( ) L2( ) Clock+L2( )",
"Dev. features: Off( ) ErrDisp( ) UNITINFO( )"
};
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 GBA boot screen in patched AGB_FIRM",
"( ) 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"
@ -116,20 +116,6 @@ void configMenu(bool isSdMode, bool oldPinStatus, u32 oldPinMode)
"'Clock+L2' can cause issues with some\n"
"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"
"on boot.\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"
"Only change this if you know what you\n"
"are doing!",
"Hides the input when entering pin\n"
"to unlock the 3DS"
"Makes the console be always detected\n"
"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 {
@ -207,7 +204,6 @@ void configMenu(bool isSdMode, bool oldPinStatus, u32 oldPinMode)
{ .posXs = {12, 22, 31, 0}, .visible = true },
{ .posXs = {14, 19, 24, 29}, .visible = true },
{ .posXs = {17, 26, 32, 44}, .visible = ISN3DS },
{ .posXs = {19, 30, 42, 0}, .visible = true }
};
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}
};
//Calculate the amount of the various kinds of options and pre-select the first single one

View File

@ -30,7 +30,7 @@
#define CONFIG_FILE "config.bin"
#define CONFIG_VERSIONMAJOR 1
#define CONFIG_VERSIONMINOR 8
#define CONFIG_VERSIONMINOR 9
#define BOOTCFG_NAND BOOTCONFIG(0, 7)
#define BOOTCFG_FIRM BOOTCONFIG(3, 7)
@ -44,7 +44,6 @@ enum multiOptions
SPLASH,
PIN,
NEWCPU,
DEVOPTIONS
};
enum singleOptions
@ -57,7 +56,8 @@ enum singleOptions
PATCHVERSTRING,
SHOWGBABOOT,
PATCHACCESS,
HIDEPIN
PATCHUNITINFO,
ENABLEEXCEPTIONHANDLERS
};
typedef enum ConfigurationStatus

View File

@ -112,7 +112,7 @@ u32 loadFirm(FirmwareType *firmType, FirmwareSource nandType, bool loadFromStora
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,
*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);
//Apply UNITINFO patches
if(devMode == 2)
if(doUnitinfoPatch)
{
ret += patchUnitInfoValueSet(arm9Section, kernel9Size);
if(!ISDEVUNIT) ret += patchCheckForDevCommonKey(process9Offset, process9Size);
}
if(devMode != 0 && isA9lhInstalled)
if(enableExceptionHandlers && isA9lhInstalled)
{
//ARM11 exception handlers
u32 codeSetOffset,
@ -221,7 +221,7 @@ u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, boo
return ret;
}
u32 patchTwlFirm(u32 firmVersion, u32 devMode)
u32 patchTwlFirm(u32 firmVersion, bool doUnitinfoPatch)
{
u8 *arm9Section = (u8 *)firm + firm->section[3].offset;
@ -249,12 +249,12 @@ u32 patchTwlFirm(u32 firmVersion, u32 devMode)
ret += patchTwlShaHashChecks(process9Offset, process9Size);
//Apply UNITINFO patch
if(devMode == 2) ret += patchUnitInfoValueSet(arm9Section, kernel9Size);
if(doUnitinfoPatch) ret += patchUnitInfoValueSet(arm9Section, kernel9Size);
return ret;
}
u32 patchAgbFirm(u32 devMode)
u32 patchAgbFirm(bool doUnitinfoPatch)
{
u8 *arm9Section = (u8 *)firm + firm->section[3].offset;
@ -277,12 +277,12 @@ u32 patchAgbFirm(u32 devMode)
if(CONFIG(SHOWGBABOOT)) ret += patchAgbBootSplash(process9Offset, process9Size);
//Apply UNITINFO patch
if(devMode == 2) ret += patchUnitInfoValueSet(arm9Section, kernel9Size);
if(doUnitinfoPatch) ret += patchUnitInfoValueSet(arm9Section, kernel9Size);
return ret;
}
u32 patch1x2xNativeAndSafeFirm(u32 devMode)
u32 patch1x2xNativeAndSafeFirm(bool enableExceptionHandlers)
{
u8 *arm9Section = (u8 *)firm + firm->section[2].offset;
@ -305,7 +305,7 @@ u32 patch1x2xNativeAndSafeFirm(u32 devMode)
ret += ISN3DS ? patchSignatureChecks(process9Offset, process9Size) : patchOldSignatureChecks(process9Offset, process9Size);
if(devMode != 0)
if(enableExceptionHandlers)
{
//ARM9 exception handlers
ret += patchArm9ExceptionHandlersInstall(arm9Section, kernel9Size);

View File

@ -25,8 +25,8 @@
#include "types.h"
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 patchTwlFirm(u32 firmVersion, u32 devMode);
u32 patchAgbFirm(u32 devMode);
u32 patch1x2xNativeAndSafeFirm(u32 devMode);
void launchFirm(FirmwareType firmType, bool loadFromStorage);
u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, bool isA9lhInstalled, bool isSafeMode, bool doUnitinfoPatch, bool enableExceptionHandlers);
u32 patchTwlFirm(u32 firmVersion, bool doUnitinfoPatch);
u32 patchAgbFirm(bool doUnitinfoPatch);
u32 patch1x2xNativeAndSafeFirm(bool enableExceptionHandlers);
void launchFirm(FirmwareType firmType, bool loadFromStorage);

View File

@ -128,8 +128,7 @@ void main(void)
}
u32 pinMode = MULTICONFIG(PIN);
bool hidePin = CONFIG(HIDEPIN);
bool pinExists = pinMode != 0 && verifyPin(pinMode, hidePin);
bool pinExists = pinMode != 0 && verifyPin(pinMode, true);
//If no configuration file exists or SELECT is held, load configuration menu
bool shouldLoadConfigMenu = needConfig == CREATE_CONFIGURATION || ((pressed & (BUTTON_SELECT | BUTTON_L1)) == BUTTON_SELECT);
@ -246,24 +245,23 @@ boot:
bool loadFromStorage = CONFIG(LOADEXTFIRMSANDMODULES);
u32 firmVersion = loadFirm(&firmType, firmSource, loadFromStorage, isSafeMode);
u32 devMode = MULTICONFIG(DEVOPTIONS);
bool doUnitinfoPatch = CONFIG(PATCHUNITINFO), enableExceptionHandlers = CONFIG(PATCHUNITINFO);
u32 res;
switch(firmType)
{
case NATIVE_FIRM:
res = patchNativeFirm(firmVersion, nandType, emuHeader, isA9lhInstalled, isSafeMode, devMode);
res = patchNativeFirm(firmVersion, nandType, emuHeader, isA9lhInstalled, isSafeMode, doUnitinfoPatch, enableExceptionHandlers);
break;
case TWL_FIRM:
res = patchTwlFirm(firmVersion, devMode);
res = patchTwlFirm(firmVersion, doUnitinfoPatch);
break;
case AGB_FIRM:
res = patchAgbFirm(devMode);
res = patchAgbFirm(doUnitinfoPatch);
break;
case SAFE_FIRM:
case SYSUPDATER_FIRM:
case NATIVE_FIRM1X2X:
res = isA9lhInstalled ? patch1x2xNativeAndSafeFirm(devMode) : 0;
res = isA9lhInstalled ? patch1x2xNativeAndSafeFirm(enableExceptionHandlers) : 0;
break;
}

View File

@ -299,27 +299,9 @@ u32 stubTimerQueueSanityCheck(u8 *pos, u32 size)
const u8 pattern[] = {0xF0, 0x41, 0x2D, 0xE9, 0x00, 0x60, 0xA0, 0xE1, 0x00, 0x70,
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));
if(off == NULL) return 1;
*off = 0xE12FFF1E;
if(off != NULL) *off = 0xE12FFF1E; // Do not error, since we could be using an external FIRM, ...
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)