Better commenting
Everyone loves that!
This commit is contained in:
parent
02bed5d37d
commit
8872a243fc
@ -25,16 +25,17 @@ u8 loadFirm(u8 a9lh){
|
|||||||
pressed = HID_PAD;
|
pressed = HID_PAD;
|
||||||
section = firmLocation->section;
|
section = firmLocation->section;
|
||||||
|
|
||||||
|
//If L and R are pressed, boot SysNAND with the 9.0 FIRM
|
||||||
if((pressed & BUTTON_L1R1) == BUTTON_L1R1) mode = 0;
|
if((pressed & BUTTON_L1R1) == BUTTON_L1R1) mode = 0;
|
||||||
|
|
||||||
//If L and R are pressed, boot SysNAND with the NAND FIRM
|
//If not using an A9LH setup, do so by decrypting FIRM0
|
||||||
if(!a9lh && !fileSize("/rei/installeda9lh") && !mode){
|
if(!a9lh && !fileSize("/rei/installeda9lh") && !mode){
|
||||||
//Read FIRM from NAND and write to FCRAM
|
//Read FIRM from NAND and write to FCRAM
|
||||||
firmSize = console ? 0xF2000 : 0xE9000;
|
firmSize = console ? 0xF2000 : 0xE9000;
|
||||||
nandFirm0((u8*)firmLocation, firmSize, console);
|
nandFirm0((u8*)firmLocation, firmSize, console);
|
||||||
if(memcmp((u8*)firmLocation, "FIRM", 4) != 0) return 1;
|
if(memcmp((u8*)firmLocation, "FIRM", 4) != 0) return 1;
|
||||||
}
|
}
|
||||||
//Load FIRM from SDCard
|
//Load FIRM from SD
|
||||||
else{
|
else{
|
||||||
if (!mode){
|
if (!mode){
|
||||||
char firmPath[] = "/rei/firmware90.bin";
|
char firmPath[] = "/rei/firmware90.bin";
|
||||||
@ -100,7 +101,7 @@ u8 loadEmu(void){
|
|||||||
//Patches
|
//Patches
|
||||||
u8 patchFirm(void){
|
u8 patchFirm(void){
|
||||||
|
|
||||||
//If L is pressed, boot SysNAND with the SDCard FIRM
|
//If L is pressed, boot SysNAND with the SD FIRM
|
||||||
if(mode && !(pressed & BUTTON_L1)) if (loadEmu()) return 1;
|
if(mode && !(pressed & BUTTON_L1)) if (loadEmu()) return 1;
|
||||||
|
|
||||||
u32 sigOffset = 0,
|
u32 sigOffset = 0,
|
||||||
@ -111,6 +112,7 @@ u8 patchFirm(void){
|
|||||||
memcpy((u8*)sigOffset, sigPat1, sizeof(sigPat1));
|
memcpy((u8*)sigOffset, sigPat1, sizeof(sigPat1));
|
||||||
memcpy((u8*)sigOffset2, sigPat2, sizeof(sigPat2));
|
memcpy((u8*)sigOffset2, sigPat2, sizeof(sigPat2));
|
||||||
|
|
||||||
|
//Apply FIRM reboot patch. Not needed with A9LH and N3DS.
|
||||||
if(!console && !a9lh && mode &&
|
if(!console && !a9lh && mode &&
|
||||||
((fileSize("/rei/reversereboot") > 0) == (pressed & BUTTON_A))){
|
((fileSize("/rei/reversereboot") > 0) == (pressed & BUTTON_A))){
|
||||||
u32 rebootOffset = 0,
|
u32 rebootOffset = 0,
|
||||||
@ -129,7 +131,7 @@ u8 patchFirm(void){
|
|||||||
if (!size) return 1;
|
if (!size) return 1;
|
||||||
fileRead((u8*)rebootOffset2, path, size);
|
fileRead((u8*)rebootOffset2, path, size);
|
||||||
|
|
||||||
//Write patched FIRM to SDCard
|
//Write patched FIRM to SD
|
||||||
if (fileWrite((u8*)firmLocation, PATCHED_FIRM_PATH, firmSize) != 0) return 1;
|
if (fileWrite((u8*)firmLocation, PATCHED_FIRM_PATH, firmSize) != 0) return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ u8 a9lh = 0;
|
|||||||
|
|
||||||
u8 main(){
|
u8 main(){
|
||||||
mountSD();
|
mountSD();
|
||||||
|
//Detect A9LH mode checking PDN_GPU_CNT2 register.
|
||||||
if (!*((u32*)0x10141204)) a9lh = 1;
|
if (!*((u32*)0x10141204)) a9lh = 1;
|
||||||
else loadSplash();
|
else loadSplash();
|
||||||
if (loadFirm(a9lh)) return 1;
|
if (loadFirm(a9lh)) return 1;
|
||||||
|
Reference in New Issue
Block a user