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

@ -514,6 +514,40 @@ void patchCode(u64 progId, u8 *code, u32 size)
break; 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: default:
if(CONFIG(4)) 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); drawString("Press A to select, START to save", 10, 30, COLOR_WHITE);
const char *multiOptionsText[] = { "Screen-init brightness: 4( ) 3( ) 2( ) 1( )", 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", const char *singleOptionsText[] = { "( ) Autoboot SysNAND",
"( ) SysNAND is updated (A9LH-only)", "( ) SysNAND is updated (A9LH-only)",
@ -27,8 +28,7 @@ void configureCFW(const char *configPath)
"( ) Enable region/language emulation", "( ) Enable region/language emulation",
"( ) Show current NAND in System Settings", "( ) Show current NAND in System Settings",
"( ) Show GBA boot screen in patched AGB_FIRM", "( ) Show GBA boot screen in patched AGB_FIRM",
"( ) Enable splash screen with no screen-init", "( ) Enable splash screen with no screen-init" };
"( ) Enable developer features" };
struct multiOption { struct multiOption {
int posXs[4]; int posXs[4];
@ -36,7 +36,8 @@ void configureCFW(const char *configPath)
u32 enabled; u32 enabled;
} multiOptions[] = { } multiOptions[] = {
{ .posXs = {26, 31, 36, 41} }, { .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 //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; u32 oldEnabled = multiOptions[selectedOption].enabled;
drawCharacter(selected, 10 + multiOptions[selectedOption].posXs[oldEnabled] * SPACING_X, multiOptions[selectedOption].posY, COLOR_BLACK); 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 else
{ {

View File

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

View File

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