Rewrote config menu to allow for multiple choice settings, made the N3DS CPU patch configurable in the NTR way, changed the config.bin format to be more future-proof (settings are on the leftmost part), added more macros to read settings
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 255
|
||||
#define CONFIG(a) ((config >> (a + 16)) & 1)
|
||||
#define MULTICONFIG(a) ((config >> (a * 2 + 6)) & 3)
|
||||
#define BOOTCONFIG(a, b) ((config >> a) & b)
|
||||
#endif
|
||||
|
||||
static u32 config = 0;
|
||||
@@ -206,11 +209,11 @@ void patchCode(u64 progId, u8 *code, u32 size)
|
||||
case 0x0004001000027000LL: // KOR MSET
|
||||
case 0x0004001000028000LL: // TWN MSET
|
||||
{
|
||||
if(R_SUCCEEDED(loadConfig()) && ((config >> 6) & 1))
|
||||
if(R_SUCCEEDED(loadConfig()) && CONFIG(6))
|
||||
{
|
||||
static const u16 verPattern[] = u"Ver.";
|
||||
const u32 currentNand = ((config >> 16) & 3);
|
||||
const u32 matchingFirm = ((config >> 18) & 1) == (currentNand != 0);
|
||||
const u32 currentNand = BOOTCONFIG(0, 3);
|
||||
const u32 matchingFirm = BOOTCONFIG(2, 1) == (currentNand != 0);
|
||||
|
||||
//Patch Ver. string
|
||||
patchMemory(code, size,
|
||||
@@ -242,7 +245,7 @@ void patchCode(u64 progId, u8 *code, u32 size)
|
||||
sizeof(stopCartUpdatesPatch), 2
|
||||
);
|
||||
|
||||
if(R_SUCCEEDED(loadConfig()) && ((config >> 4) & 1))
|
||||
if(R_SUCCEEDED(loadConfig()) && MULTICONFIG(1))
|
||||
{
|
||||
static const u8 cfgN3dsCpuPattern[] = {
|
||||
0x40, 0xA0, 0xE1, 0x07, 0x00
|
||||
@@ -254,7 +257,7 @@ void patchCode(u64 progId, u8 *code, u32 size)
|
||||
if(cfgN3dsCpuLoc != NULL)
|
||||
{
|
||||
*(u32 *)(cfgN3dsCpuLoc + 3) = 0xE1A00000;
|
||||
*(u32 *)(cfgN3dsCpuLoc + 0x1F) = 0xE3A00003;
|
||||
*(u32 *)(cfgN3dsCpuLoc + 0x1F) = 0xE3A00000 + MULTICONFIG(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user