Merge pull request #20 from Steveice10/master

Add developer UNITINFO patch.
This commit is contained in:
Aurora 2016-04-11 21:17:22 +02:00
commit 49d49e637a
5 changed files with 28 additions and 6 deletions

View File

@ -26,7 +26,8 @@ void configureCFW(const char *configPath)
"( ) Use second EmuNAND as default",
"( ) Show current NAND in System Settings",
"( ) Show GBA boot screen in patched AGB_FIRM",
"( ) Enable splash screen with no screen-init" };
"( ) Enable splash screen with no screen-init",
"( ) Use developer UNITINFO" };
u32 optionsAmount = sizeof(optionsText) / sizeof(char *);
@ -146,4 +147,4 @@ void configureCFW(const char *configPath)
//Reboot
i2cWriteRegister(I2C_DEV_MCU, 0x20, 1 << 2);
while(1);
}
}

View File

@ -13,4 +13,4 @@
extern u32 config;
void configureCFW(const char *configPath);
void configureCFW(const char *configPath);

View File

@ -271,6 +271,15 @@ static inline void patchNativeFirm(u32 nandType, u32 emuHeader, u32 a9lhInstalle
*(u16 *)sigOffset2 = sigPatch[0];
*((u16 *)sigOffset2 + 1) = sigPatch[1];
if(CONFIG(7, 1))
{
//Apply UNITINFO patch
u32 unitInfoOffset;
getUnitInfoValueSet(arm9Section, section[2].size, &unitInfoOffset);
*((u8*)unitInfoOffset + 3) = unitInfoPatch[0];
}
//Replace the FIRM loader with the injector
injectLoader();
}
@ -416,4 +425,4 @@ static inline void launchFirm(u32 bootType)
//Final jump to arm9 kernel
((void (*)())firm->arm9Entry)();
}
}

View File

@ -19,6 +19,8 @@ const u16 sigPatch[2] = {0x2000, 0x4770};
const u16 writeBlock[2] = {0x2000, 0x46C0};
const u8 unitInfoPatch[1] = {0xE3};
/**************************************************
* Functions
**************************************************/
@ -73,4 +75,12 @@ void getLoader(u8 *pos, u32 size, u32 *loaderOffset, u32 *loaderSize)
*loaderOffset = (u32)off - 0x200;
*loaderSize = *(u32 *)(off - 0xFC) * 0x200;
}
}
void getUnitInfoValueSet(u8 *pos, u32 size, u32 *off)
{
//Look for UNITINFO value being set
const u8 pattern[] = {0x01, 0x10, 0xA0, 0x13};
*off = (u32)memsearch(pos, pattern, size, 4);
}

View File

@ -15,6 +15,7 @@ const u32 mpuPatch[3];
const u16 nandRedir[2];
const u16 sigPatch[2];
const u16 writeBlock[2];
const u8 unitInfoPatch[1];
/**************************************************
* Functions
@ -24,4 +25,5 @@ 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);
void getLoader(u8 *pos, u32 size, u32 *loaderOffset, u32 *loaderSize);
void getLoader(u8 *pos, u32 size, u32 *loaderOffset, u32 *loaderSize);
void getUnitInfoValueSet(u8 *pos, u32 size, u32* off);