Better commenting

This commit is contained in:
Aurora 2016-04-04 18:19:00 +02:00
parent 0001f301f8
commit bb437f6f7b
6 changed files with 20 additions and 11 deletions

View File

@ -73,6 +73,7 @@ static int fileOpen(IFile *file, FS_ArchiveID id, const char *path, int flags)
ppath.type = PATH_ASCII;
ppath.data = path;
ppath.size = len+1;
return IFile_Open(file, archive, ppath, flags);
}
@ -109,16 +110,16 @@ static int loadConfig()
ret = fileOpen(&file, ARCHIVE_SDMC, "/aurei/config.bin", FS_OPEN_READ);
if(R_SUCCEEDED(ret))
{
ret = IFile_Read(&file, &total, (void *)&config, 3);
ret = IFile_Read(&file, &total, &config, 3);
IFile_Close(&file);
}
return ret;
}
void patchCode(u64 progid, u8 *code, u32 size)
void patchCode(u64 progId, u8 *code, u32 size)
{
switch(progid)
switch(progId)
{
case 0x0004003000008F02LL: // USA Menu
case 0x0004003000008202LL: // EUR Menu

View File

@ -2,4 +2,4 @@
#include <3ds/types.h>
void patchCode(u64 progid, u8 *code, u32 size);
void patchCode(u64 progId, u8 *code, u32 size);

View File

@ -2,7 +2,7 @@
firm_addr equ 0x24000000 ; Temporary location where we'll load the FIRM to
firm_maxsize equ 0x200000 ; Random value that's bigger than any of the currently known firm's sizes.
kernel_code equ 0x080F0000
kernel_code equ 0x080F0000 ; Offset to copy the Kernel9 code to
.create "reboot.bin", 0
.arm

View File

@ -24,6 +24,7 @@ u32 getEmunandSect(u32 *off, u32 *head, u32 *emuNAND)
*off = nandOffset + 1;
*head = nandOffset + 1;
}
//Check for Gateway emuNAND
else if(sdmmc_sdcard_readsectors(nandOffset + nandSize, 1, temp) == 0)
{
@ -32,15 +33,19 @@ u32 getEmunandSect(u32 *off, u32 *head, u32 *emuNAND)
*off = nandOffset;
*head = nandOffset + nandSize;
}
//Fallback to the first emuNAND if there's no second one
/* Fallback to the first emuNAND if there's no second one,
or to SysNAND if there isn't any */
else
{
(*emuNAND)--;
if(*emuNAND) getEmunandSect(off, head, emuNAND);
return 0;
}
}
}
return 1;
}

View File

@ -100,7 +100,7 @@ void setupCFW(void)
//Flag to prevent multiple boot options-forcing
tempConfig |= 1 << 15;
}
/* Else, force the last used boot options unless A/L/R/SELECT are pressed
/* Else, force the last used boot options unless a payload button or A/L/R are pressed
or the no-forcing flag is set */
else if(!(pressed & OVERRIDE_BUTTONS) && !((config >> 15) & 1))
{
@ -113,7 +113,7 @@ void setupCFW(void)
//Boot options aren't being forced
if(needConfig)
{
/* If L and one of the payload buttons are pressed, and if not using A9LH
/* If L and R/Select or one of the single payload buttons are pressed and, if not using A9LH,
the Safe Mode combo is not pressed, chainload an external payload */
if(((pressed & SINGLE_PAYLOAD_BUTTONS) || ((pressed & BUTTON_L1) && (pressed & L_PAYLOAD_BUTTONS)))
&& pressed != SAFE_MODE)
@ -167,6 +167,7 @@ void setupCFW(void)
mode = 1;
continue;
}
break;
}
@ -196,6 +197,7 @@ void loadFirm(void)
if(memcmp(firm, "FIRM", 4) != 0)
error("Couldn't decrypt NAND FIRM0 (O3DS not on 9.x?)");
}
//Load FIRM from SD
else
{
@ -276,7 +278,7 @@ static inline void patchTwlAgb(u32 whichFirm)
{{0xD7A12, 0xD8B8A}, { .type1 = 0xEF26 }, 1}
};
/* Calculate the amount of patches to apply. Only count the splash screen patch for AGB_FIRM
/* 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 = whichFirm ? (sizeof(agbPatches) / sizeof(struct patchData)) - !((config >> 6) & 1) :
(sizeof(twlPatches) / sizeof(struct patchData));

View File

@ -32,6 +32,7 @@ static u32 waitInput(void)
do {
//Wait for a key to be pressed
while(!HID_PAD);
key = HID_PAD;
//Make sure it's pressed
@ -59,7 +60,7 @@ void configureCFW(const char *configPath, const char *patchedFirms[])
"( ) Use 9.0 FIRM as default",
"( ) Use second EmuNAND as default",
"( ) Show current NAND in System Settings",
"( ) Show splash screen in patched AGB_FIRM" };
"( ) Show GBA boot screen in patched AGB_FIRM" };
u32 optionsAmount = sizeof(optionsText) / sizeof(char *);
struct option options[optionsAmount];
@ -115,7 +116,7 @@ void configureCFW(const char *configPath, const char *patchedFirms[])
//If the user has been using A9LH and the "Updated SysNAND" setting changed, delete the patched 9.0 FIRM
if(((tempConfig >> 16) & 1) && ((tempConfig & 1) != options[0].enabled)) fileDelete(patchedFirms[3]);
//If the "Show splash screen in patched AGB_FIRM" setting changed, delete the patched AGB_FIRM
//If the "Show GBA boot screen in patched AGB_FIRM" setting changed, delete the patched AGB_FIRM
if(((tempConfig >> 6) & 1) != options[6].enabled) fileDelete(patchedFirms[5]);
//Preserve the last-used boot options (last 12 bits)