Skip to content

Commit

Permalink
Move the UNITINFO patch to the developer version
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraWright committed Apr 26, 2016
1 parent a736e46 commit f9a1f1a
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 23 deletions.
2 changes: 1 addition & 1 deletion injector/source/patcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ void patchCode(u64 progId, u8 *code, u32 size)
case 0x0004001000027000LL: // KOR MSET
case 0x0004001000028000LL: // TWN MSET
{
if(CONFIG(6))
if(CONFIG(5))
{
static const u16 verPattern[] = u"Ver.";
const u32 currentNand = BOOTCONFIG(0, 3);
Expand Down
1 change: 0 additions & 1 deletion source/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ void configureCFW(const char *configPath)
"( ) Force A9LH detection",
"( ) Use second EmuNAND as default",
"( ) Enable region/language emulation",
"( ) Use developer UNITINFO",
"( ) Show current NAND in System Settings",
"( ) Show GBA boot screen in patched AGB_FIRM",
"( ) Enable splash screen with no screen-init" };
Expand Down
11 changes: 2 additions & 9 deletions source/firm.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void main(void)
configureCFW(configPath);

//If screens are inited or the corresponding option is set, load splash screen
if(PDN_GPU_CNT != 1 || CONFIG(8)) loadSplash();
if(PDN_GPU_CNT != 1 || CONFIG(7)) loadSplash();

u32 autoBootSys = CONFIG(0);

Expand Down Expand Up @@ -255,13 +255,6 @@ static inline void patchNativeFirm(u32 nandType, u32 emuHeader, u32 a9lhInstalle
*(u16 *)sigOffset2 = sigPatch[0];
*((u16 *)sigOffset2 + 1) = sigPatch[1];

if(CONFIG(5))
{
//Apply UNITINFO patch
u8 *unitInfoOffset = getUnitInfoValueSet(arm9Section, section[2].size);
*unitInfoOffset = unitInfoPatch;
}

//Replace the FIRM loader with the injector
injectLoader();
}
Expand Down Expand Up @@ -366,7 +359,7 @@ static inline void patchTwlAgbFirm(u32 firmType)
/* Calculate the amount of patches to apply. Only count the boot screen patch for AGB_FIRM
if the matching option was enabled (keep it as last) */
u32 numPatches = firmType == 1 ? (sizeof(twlPatches) / sizeof(patchData)) :
(sizeof(agbPatches) / sizeof(patchData) - !CONFIG(7));
(sizeof(agbPatches) / sizeof(patchData) - !CONFIG(6));
const patchData *patches = firmType == 1 ? twlPatches : agbPatches;

//Patch
Expand Down
10 changes: 0 additions & 10 deletions source/patches.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ const u16 nandRedir[2] = {0x4C00, 0x47A0},
sigPatch[2] = {0x2000, 0x4770},
writeBlock[2] = {0x2000, 0x46C0};

const u8 unitInfoPatch = 0xE3;

/**************************************************
* Functions
**************************************************/
Expand Down Expand Up @@ -65,14 +63,6 @@ u16 *getFirmWrite(u8 *pos, u32 size)
return (u16 *)memsearch(off - 0x100, pattern, 0x100, 4);
}

u8 *getUnitInfoValueSet(u8 *pos, u32 size)
{
//Look for UNITINFO value being set
const u8 pattern[] = {0x01, 0x10, 0xA0, 0x13};

return memsearch(pos, pattern, size, 4) + 3;
}

void *getLoader(u8 *pos, u32 size, u32 *loaderSize)
{
u8 *const off = memsearch(pos, "loade", size, 5);
Expand Down
2 changes: 0 additions & 2 deletions source/patches.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const u32 mpuPatch[3];
const u16 nandRedir[2],
sigPatch[2],
writeBlock[2];
const u8 unitInfoPatch;

/**************************************************
* Functions
Expand All @@ -23,5 +22,4 @@ void getSigChecks(u8 *pos, u32 size, u32 *off, u32 *off2);
void *getReboot(u8 *pos, u32 size);
u32 getfOpen(u8 *proc9Offset, void *rebootOffset);
u16 *getFirmWrite(u8 *pos, u32 size);
u8 *getUnitInfoValueSet(u8 *pos, u32 size);
void *getLoader(u8 *pos, u32 size, u32 *loaderSize);

2 comments on commit f9a1f1a

@fincs
Copy link
Collaborator

@fincs fincs commented on f9a1f1a Apr 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change breaks config compatibility with older versions of Luma3DS due to configuration bits having been moved ("Show current NAND in System Settings" becomes "Show GBA boot screen in patched AGB_FIRM" and so on). Also, is there any word on whether developer mode really blocks the eShop? I just tried opening it (EUR 10.7 a9lh O3DS) with devmode enabled and it did open.

@AuroraWright
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It blocks NNID rather than eShop

Please sign in to comment.