Merge pull request #20 from Steveice10/master
Add developer UNITINFO patch.
This commit is contained in:
commit
49d49e637a
@ -26,7 +26,8 @@ void configureCFW(const char *configPath)
|
|||||||
"( ) Use second EmuNAND as default",
|
"( ) Use second EmuNAND as default",
|
||||||
"( ) 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",
|
||||||
|
"( ) Use developer UNITINFO" };
|
||||||
|
|
||||||
u32 optionsAmount = sizeof(optionsText) / sizeof(char *);
|
u32 optionsAmount = sizeof(optionsText) / sizeof(char *);
|
||||||
|
|
||||||
@ -146,4 +147,4 @@ void configureCFW(const char *configPath)
|
|||||||
//Reboot
|
//Reboot
|
||||||
i2cWriteRegister(I2C_DEV_MCU, 0x20, 1 << 2);
|
i2cWriteRegister(I2C_DEV_MCU, 0x20, 1 << 2);
|
||||||
while(1);
|
while(1);
|
||||||
}
|
}
|
||||||
|
@ -13,4 +13,4 @@
|
|||||||
|
|
||||||
extern u32 config;
|
extern u32 config;
|
||||||
|
|
||||||
void configureCFW(const char *configPath);
|
void configureCFW(const char *configPath);
|
||||||
|
@ -271,6 +271,15 @@ static inline void patchNativeFirm(u32 nandType, u32 emuHeader, u32 a9lhInstalle
|
|||||||
*(u16 *)sigOffset2 = sigPatch[0];
|
*(u16 *)sigOffset2 = sigPatch[0];
|
||||||
*((u16 *)sigOffset2 + 1) = sigPatch[1];
|
*((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
|
//Replace the FIRM loader with the injector
|
||||||
injectLoader();
|
injectLoader();
|
||||||
}
|
}
|
||||||
@ -416,4 +425,4 @@ static inline void launchFirm(u32 bootType)
|
|||||||
|
|
||||||
//Final jump to arm9 kernel
|
//Final jump to arm9 kernel
|
||||||
((void (*)())firm->arm9Entry)();
|
((void (*)())firm->arm9Entry)();
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,8 @@ const u16 sigPatch[2] = {0x2000, 0x4770};
|
|||||||
|
|
||||||
const u16 writeBlock[2] = {0x2000, 0x46C0};
|
const u16 writeBlock[2] = {0x2000, 0x46C0};
|
||||||
|
|
||||||
|
const u8 unitInfoPatch[1] = {0xE3};
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* Functions
|
* Functions
|
||||||
**************************************************/
|
**************************************************/
|
||||||
@ -73,4 +75,12 @@ void getLoader(u8 *pos, u32 size, u32 *loaderOffset, u32 *loaderSize)
|
|||||||
|
|
||||||
*loaderOffset = (u32)off - 0x200;
|
*loaderOffset = (u32)off - 0x200;
|
||||||
*loaderSize = *(u32 *)(off - 0xFC) * 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);
|
||||||
|
}
|
||||||
|
@ -15,6 +15,7 @@ const u32 mpuPatch[3];
|
|||||||
const u16 nandRedir[2];
|
const u16 nandRedir[2];
|
||||||
const u16 sigPatch[2];
|
const u16 sigPatch[2];
|
||||||
const u16 writeBlock[2];
|
const u16 writeBlock[2];
|
||||||
|
const u8 unitInfoPatch[1];
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* Functions
|
* Functions
|
||||||
@ -24,4 +25,5 @@ void getSigChecks(u8 *pos, u32 size, u32 *off, u32 *off2);
|
|||||||
void *getReboot(u8 *pos, u32 size);
|
void *getReboot(u8 *pos, u32 size);
|
||||||
u32 getfOpen(u8 *proc9Offset, void *rebootOffset);
|
u32 getfOpen(u8 *proc9Offset, void *rebootOffset);
|
||||||
u16 *getFirmWrite(u8 *pos, u32 size);
|
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);
|
||||||
|
Reference in New Issue
Block a user