Make developer features multi-choice, since modifying UNITINFO prevents accessing eShop on retail consoles (you can now choose "ErrDisp" for a less aggressive patch)

This commit is contained in:
TuxSH 2016-05-28 16:13:22 +02:00
parent 6a280723f8
commit 2424865fa1
4 changed files with 42 additions and 7 deletions

View File

@ -515,6 +515,40 @@ void patchCode(u64 progId, u8 *code, u32 size)
break;
}
case 0x0004003000008A02LL: // ErrDisp
{
if(MULTICONFIG(2) == 1)
{
static const u8 unitinfoCheckPattern1[] = {
0x14, 0x00, 0xD0, 0xE5, 0xDB, 0x9A, 0x9F, 0xED
};
static const u8 unitinfoCheckPattern2[] = {
0x14, 0x00, 0xD0, 0xE5, 0x01, 0x00, 0x10, 0xE3
} ;
static const u8 unitinfoCheckPatch[] = {
0x00, 0x00, 0xA0, 0xE3
} ;
patchMemory(code, size,
unitinfoCheckPattern1,
sizeof(unitinfoCheckPattern1), 0,
unitinfoCheckPatch,
sizeof(unitinfoCheckPatch), 1
);
patchMemory(code, size,
unitinfoCheckPattern2,
sizeof(unitinfoCheckPattern2), 0,
unitinfoCheckPatch,
sizeof(unitinfoCheckPatch), 3
);
}
break;
}
default:
if(CONFIG(4))
{

View File

@ -18,7 +18,8 @@ void configureCFW(const char *configPath)
drawString("Press A to select, START to save", 10, 30, COLOR_WHITE);
const char *multiOptionsText[] = { "Screen-init brightness: 4( ) 3( ) 2( ) 1( )",
"New 3DS CPU: Off( ) Clock( ) L2( ) Clock+L2( )" };
"New 3DS CPU: Off( ) Clock( ) L2( ) Clock+L2( )",
"Dev. features: None( ) ErrDisp( ) UNITINFO( )" };
const char *singleOptionsText[] = { "( ) Autoboot SysNAND",
"( ) SysNAND is updated (A9LH-only)",
@ -27,8 +28,7 @@ void configureCFW(const char *configPath)
"( ) Enable region/language emulation",
"( ) Show current NAND in System Settings",
"( ) Show GBA boot screen in patched AGB_FIRM",
"( ) Enable splash screen with no screen-init",
"( ) Enable developer features" };
"( ) Enable splash screen with no screen-init" };
struct multiOption {
int posXs[4];
@ -36,7 +36,8 @@ void configureCFW(const char *configPath)
u32 enabled;
} multiOptions[] = {
{ .posXs = {26, 31, 36, 41} },
{ .posXs = {17, 26, 32, 44} }
{ .posXs = {17, 26, 32, 44} },
{ .posXs = {20, 31, 43, 0} }
};
//Calculate the amount of the various kinds of options and pre-select the first single one
@ -145,7 +146,7 @@ void configureCFW(const char *configPath)
{
u32 oldEnabled = multiOptions[selectedOption].enabled;
drawCharacter(selected, 10 + multiOptions[selectedOption].posXs[oldEnabled] * SPACING_X, multiOptions[selectedOption].posY, COLOR_BLACK);
multiOptions[selectedOption].enabled = oldEnabled == 3 ? 0 : oldEnabled + 1;
multiOptions[selectedOption].enabled = (oldEnabled == 3 || !multiOptions[selectedOption].posXs[oldEnabled + 1]) ? 0 : oldEnabled + 1;
}
else
{

View File

@ -10,7 +10,7 @@
#define MULTICONFIG(a) ((config >> (a * 2 + 6)) & 3)
#define BOOTCONFIG(a, b) ((config >> a) & b)
#define DEVMODE CONFIG(8)
#define DEVMODE MULTICONFIG(2)
extern u32 config;

View File

@ -330,7 +330,7 @@ static inline void patchNativeFirm(u32 nandType, u32 emuHeader, u32 a9lhMode)
if(DEVMODE)
{
//Apply UNITINFO patch
patchUnitInfoValueSet(arm9Section, section[2].size);
if(DEVMODE == 2) patchUnitInfoValueSet(arm9Section, section[2].size);
//Make FCRAM (and VRAM as a side effect) globally executable from arm11 kernel
patchKernelFCRAMAndVRAMMappingPermissions(arm11Section1, section[1].size);