Skip to content

Commit 8872a24

Browse files
committed
Better commenting
Everyone loves that!
1 parent 02bed5d commit 8872a24

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

source/firm.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,17 @@ u8 loadFirm(u8 a9lh){
2525
pressed = HID_PAD;
2626
section = firmLocation->section;
2727

28+
//If L and R are pressed, boot SysNAND with the 9.0 FIRM
2829
if((pressed & BUTTON_L1R1) == BUTTON_L1R1) mode = 0;
2930

30-
//If L and R are pressed, boot SysNAND with the NAND FIRM
31+
//If not using an A9LH setup, do so by decrypting FIRM0
3132
if(!a9lh && !fileSize("/rei/installeda9lh") && !mode){
3233
//Read FIRM from NAND and write to FCRAM
3334
firmSize = console ? 0xF2000 : 0xE9000;
3435
nandFirm0((u8*)firmLocation, firmSize, console);
3536
if(memcmp((u8*)firmLocation, "FIRM", 4) != 0) return 1;
3637
}
37-
//Load FIRM from SDCard
38+
//Load FIRM from SD
3839
else{
3940
if (!mode){
4041
char firmPath[] = "/rei/firmware90.bin";
@@ -100,7 +101,7 @@ u8 loadEmu(void){
100101
//Patches
101102
u8 patchFirm(void){
102103

103-
//If L is pressed, boot SysNAND with the SDCard FIRM
104+
//If L is pressed, boot SysNAND with the SD FIRM
104105
if(mode && !(pressed & BUTTON_L1)) if (loadEmu()) return 1;
105106

106107
u32 sigOffset = 0,
@@ -111,6 +112,7 @@ u8 patchFirm(void){
111112
memcpy((u8*)sigOffset, sigPat1, sizeof(sigPat1));
112113
memcpy((u8*)sigOffset2, sigPat2, sizeof(sigPat2));
113114

115+
//Apply FIRM reboot patch. Not needed with A9LH and N3DS.
114116
if(!console && !a9lh && mode &&
115117
((fileSize("/rei/reversereboot") > 0) == (pressed & BUTTON_A))){
116118
u32 rebootOffset = 0,
@@ -129,7 +131,7 @@ u8 patchFirm(void){
129131
if (!size) return 1;
130132
fileRead((u8*)rebootOffset2, path, size);
131133

132-
//Write patched FIRM to SDCard
134+
//Write patched FIRM to SD
133135
if (fileWrite((u8*)firmLocation, PATCHED_FIRM_PATH, firmSize) != 0) return 1;
134136
}
135137

source/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ u8 a9lh = 0;
1414

1515
u8 main(){
1616
mountSD();
17+
//Detect A9LH mode checking PDN_GPU_CNT2 register.
1718
if (!*((u32*)0x10141204)) a9lh = 1;
1819
else loadSplash();
1920
if (loadFirm(a9lh)) return 1;

0 commit comments

Comments
 (0)