diff --git a/source/config.c b/source/config.c index 25c395c..7f31590 100644 --- a/source/config.c +++ b/source/config.c @@ -78,121 +78,121 @@ void writeConfig(bool isConfigOptions) void configMenu(bool oldPinStatus, u32 oldPinMode) { - const char *multiOptionsText[] = { "Default EmuNAND: 1( ) 2( ) 3( ) 4( )", - "Screen brightness: 4( ) 3( ) 2( ) 1( )", - "Splash: Off( ) Before( ) After( ) payloads", - "PIN lock: Off( ) 4( ) 6( ) 8( ) digits", - "New 3DS CPU: Off( ) Clock( ) L2( ) Clock+L2( )", - }; + static const char *multiOptionsText[] = { "Default EmuNAND: 1( ) 2( ) 3( ) 4( )", + "Screen brightness: 4( ) 3( ) 2( ) 1( )", + "Splash: Off( ) Before( ) After( ) payloads", + "PIN lock: Off( ) 4( ) 6( ) 8( ) digits", + "New 3DS CPU: Off( ) Clock( ) L2( ) Clock+L2( )", + }; - const char *singleOptionsText[] = { "( ) Autoboot EmuNAND", - "( ) Use EmuNAND FIRM if booting with R", - "( ) Enable loading external FIRMs and modules", - "( ) Enable game patching", - "( ) Show NAND or user string in System Settings", - "( ) Show GBA boot screen in patched AGB_FIRM", - "( ) Patch ARM9 access", - "( ) Set developer UNITINFO", - "( ) Disable ARM11 exception handlers", - }; + static const char *singleOptionsText[] = { "( ) Autoboot EmuNAND", + "( ) Use EmuNAND FIRM if booting with R", + "( ) Enable loading external FIRMs and modules", + "( ) Enable game patching", + "( ) Show NAND or user string in System Settings", + "( ) Show GBA boot screen in patched AGB_FIRM", + "( ) Patch ARM9 access", + "( ) Set developer UNITINFO", + "( ) Disable ARM11 exception handlers", + }; - const char *optionsDescription[] = { "Select the default EmuNAND.\n\n" - "It will be booted when no\n" - "directional pad buttons are pressed.", + static const char *optionsDescription[] = { "Select the default EmuNAND.\n\n" + "It will be booted when no\n" + "directional pad buttons are pressed.", - "Select the screen brightness.", + "Select the screen brightness.", - "Enable splash screen support.\n\n" - "\t* 'Before payloads' displays it\n" - "before booting payloads\n" - "(intended for splashes that display\n" - "button hints).\n\n" - "\t* 'After payloads' displays it\n" - "afterwards.", + "Enable splash screen support.\n\n" + "\t* 'Before payloads' displays it\n" + "before booting payloads\n" + "(intended for splashes that display\n" + "button hints).\n\n" + "\t* 'After payloads' displays it\n" + "afterwards.", - "Activate a PIN lock.\n\n" - "The PIN will be asked each time\n" - "Luma3DS boots.\n\n" - "4, 6 or 8 digits can be selected.\n\n" - "The ABXY buttons and the directional\n" - "pad buttons can be used as keys.\n\n" - "A message can also be displayed\n" - "(refer to the wiki for instructions).", + "Activate a PIN lock.\n\n" + "The PIN will be asked each time\n" + "Luma3DS boots.\n\n" + "4, 6 or 8 digits can be selected.\n\n" + "The ABXY buttons and the directional\n" + "pad buttons can be used as keys.\n\n" + "A message can also be displayed\n" + "(refer to the wiki for instructions).", - "Select the New 3DS CPU mode.\n\n" - "This won't apply to\n" - "New 3DS exclusive/enhanced games.\n\n" - "'Clock+L2' can cause issues with some\n" - "games.", + "Select the New 3DS CPU mode.\n\n" + "This won't apply to\n" + "New 3DS exclusive/enhanced games.\n\n" + "'Clock+L2' can cause issues with some\n" + "games.", - "If enabled, an EmuNAND\n" - "will be launched on boot.\n\n" - "Otherwise, SysNAND will.\n\n" - "Hold L on boot to switch NAND.\n\n" - "To use a different EmuNAND from the\n" - "default, hold a directional pad button\n" - "(Up/Right/Down/Left equal EmuNANDs\n" - "1/2/3/4).", + "If enabled, an EmuNAND\n" + "will be launched on boot.\n\n" + "Otherwise, SysNAND will.\n\n" + "Hold L on boot to switch NAND.\n\n" + "To use a different EmuNAND from the\n" + "default, hold a directional pad button\n" + "(Up/Right/Down/Left equal EmuNANDs\n" + "1/2/3/4).", - "If enabled, when holding R on boot\n" - "SysNAND will be booted with an\n" - "EmuNAND FIRM.\n\n" - "Otherwise, an EmuNAND will be booted\n" - "with the SysNAND FIRM.\n\n" - "To use a different EmuNAND from the\n" - "default, hold a directional pad button\n" - "(Up/Right/Down/Left equal EmuNANDs\n" - "1/2/3/4), also add A if you have\n" - "a matching payload.", + "If enabled, when holding R on boot\n" + "SysNAND will be booted with an\n" + "EmuNAND FIRM.\n\n" + "Otherwise, an EmuNAND will be booted\n" + "with the SysNAND FIRM.\n\n" + "To use a different EmuNAND from the\n" + "default, hold a directional pad button\n" + "(Up/Right/Down/Left equal EmuNANDs\n" + "1/2/3/4), also add A if you have\n" + "a matching payload.", - "Enable loading external FIRMs and\n" - "system modules.\n\n" - "This isn't needed in most cases.\n\n" - "Refer to the wiki for instructions.", + "Enable loading external FIRMs and\n" + "system modules.\n\n" + "This isn't needed in most cases.\n\n" + "Refer to the wiki for instructions.", - "Enable overriding the region and\n" - "language configuration and the usage\n" - "of patched code binaries, exHeaders,\n" - "IPS code patches and LayeredFS\n" - "for specific games.\n\n" - "Also makes certain DLCs\n" - "for out-of-region games work.\n\n" - "Refer to the wiki for instructions.", + "Enable overriding the region and\n" + "language configuration and the usage\n" + "of patched code binaries, exHeaders,\n" + "IPS code patches and LayeredFS\n" + "for specific games.\n\n" + "Also makes certain DLCs\n" + "for out-of-region games work.\n\n" + "Refer to the wiki for instructions.", - "Enable showing the current NAND/FIRM:\n\n" - "\t* Sys = SysNAND\n" - "\t* Emu = EmuNAND 1\n" - "\t* EmuX = EmuNAND X\n" - "\t* SysE = SysNAND with EmuNAND 1 FIRM\n" - "\t* SyEX = SysNAND with EmuNAND X FIRM\n" - "\t* EmuS = EmuNAND 1 with SysNAND FIRM\n" - "\t* EmXS = EmuNAND X with SysNAND FIRM\n\n" - "or a user-defined custom string in\n" - "System Settings.\n\n" - "Refer to the wiki for instructions.", + "Enable showing the current NAND/FIRM:\n\n" + "\t* Sys = SysNAND\n" + "\t* Emu = EmuNAND 1\n" + "\t* EmuX = EmuNAND X\n" + "\t* SysE = SysNAND with EmuNAND 1 FIRM\n" + "\t* SyEX = SysNAND with EmuNAND X FIRM\n" + "\t* EmuS = EmuNAND 1 with SysNAND FIRM\n" + "\t* EmXS = EmuNAND X with SysNAND FIRM\n\n" + "or a user-defined custom string in\n" + "System Settings.\n\n" + "Refer to the wiki for instructions.", - "Enable showing the GBA boot screen\n" - "when booting GBA games.", + "Enable showing the GBA boot screen\n" + "when booting GBA games.", - "Disable ARM9 exheader access checks.\n\n" - "Only select this if you know what you\n" - "are doing!", + "Disable ARM9 exheader access checks.\n\n" + "Only select this if you know what you\n" + "are doing!", - "Make the console be always detected\n" - "as a development unit, and conversely.\n" - "(which breaks online features, amiibo\n" - "and retail CIAs, but allows installing\n" - "and booting some developer software).\n\n" - "Only select this if you know what you\n" - "are doing!", + "Make the console be always detected\n" + "as a development unit, and conversely.\n" + "(which breaks online features, amiibo\n" + "and retail CIAs, but allows installing\n" + "and booting some developer software).\n\n" + "Only select this if you know what you\n" + "are doing!", - "Disables the fatal error exception\n" - "handlers for the ARM11 CPU.\n\n" - "Note: Disabling the exception handlers\n" - "will disqualify you from submitting\n" - "issues or bug reports to the Luma3DS\n" - "GitHub repository!" - }; + "Disables the fatal error exception\n" + "handlers for the ARM11 CPU.\n\n" + "Note: Disabling the exception handlers\n" + "will disqualify you from submitting\n" + "issues or bug reports to the Luma3DS\n" + "GitHub repository!" + }; struct multiOption { u32 posXs[4]; diff --git a/source/exceptions.c b/source/exceptions.c index bf2db71..44606a1 100644 --- a/source/exceptions.c +++ b/source/exceptions.c @@ -79,12 +79,11 @@ void detectAndProcessExceptionDumps(void) "Precise External Abort", "Imprecise External Abort", "Debug event" }; - static const u32 faultStatusValues[] = { + static const u32 faultStatusValues[] = { 0b1, 0b100, 0b1100, 0b1110, 0b101, 0b111, 0b11, 0b110, 0b1001, 0b1011, 0b1101, 0b1111, 0b1000, 0b10110, 0b10 }; - initScreens(); drawString(true, 10, 10, COLOR_RED, "An exception occurred"); @@ -93,16 +92,18 @@ void detectAndProcessExceptionDumps(void) else posY = drawString(true, 10, 30, COLOR_WHITE, "Processor: ARM9"); const char *faultStatusInfos = NULL; - if (dumpHeader->type >= 2) + if(dumpHeader->type >= 2) { u32 xfsr = dumpHeader->type == 2 ? regs[18] : regs[17]; xfsr &= 0xF; - for (int i = 0; i < 15; i++) - if (xfsr == faultStatusValues[i]){ + for(u32 i = 0; i < 15; i++) + if(xfsr == faultStatusValues[i]) + { faultStatusInfos = faultStatusNames[i]; break; } } + if(dumpHeader->type == 2) { if((regs[16] & 0x20) == 0 && dumpHeader->codeDumpSize >= 4) @@ -126,7 +127,8 @@ void detectAndProcessExceptionDumps(void) } else posY = drawFormattedString(true, 10, posY + SPACING_Y, COLOR_WHITE, "Exception type: %s", handledExceptionNames[dumpHeader->type]); - if (faultStatusInfos != NULL) posY = drawFormattedString(true, 10, posY + SPACING_Y, COLOR_WHITE, "Fault status: %s", faultStatusInfos); + + if(faultStatusInfos != NULL) posY = drawFormattedString(true, 10, posY + SPACING_Y, COLOR_WHITE, "Fault status: %s", faultStatusInfos); if(dumpHeader->processor == 11 && dumpHeader->additionalDataSize != 0) posY = drawFormattedString(true, 10, posY + SPACING_Y, COLOR_WHITE, @@ -142,8 +144,9 @@ void detectAndProcessExceptionDumps(void) else if(dumpHeader->processor == 11) posY = drawFormattedString(true, 10 + 22 * SPACING_X, posY, COLOR_WHITE, "%-7s%08X", registerNames[i + 1], regs[20]); } - if (dumpHeader->type == 3) - posY = drawFormattedString(true, 10, posY + SPACING_Y, COLOR_WHITE, "%-7s%08X Access type: %s", "FAR", regs[19], regs[17] & (1u << 11) ? "Write":"Read"); + + if(dumpHeader->type == 3) + posY = drawFormattedString(true, 10, posY + SPACING_Y, COLOR_WHITE, "%-7s%08X Access type: %s", "FAR", regs[19], regs[17] & (1u << 11) ? "Write" : "Read"); posY += SPACING_Y; diff --git a/source/firm.c b/source/firm.c index 1231eb0..07f0334 100755 --- a/source/firm.c +++ b/source/firm.c @@ -108,14 +108,14 @@ static bool checkFirm(u32 firmSize) static inline u32 loadFirmFromStorage(FirmwareType firmType) { - const char *firmwareFiles[] = { + static const char *firmwareFiles[] = { "native.firm", "twl.firm", "agb.firm", "safe.firm", "sysupdater.firm" }, - *cetkFiles[] = { + *cetkFiles[] = { "cetk", "cetk_twl", "cetk_agb", diff --git a/source/fs.c b/source/fs.c index a251ef3..fc88f38 100644 --- a/source/fs.c +++ b/source/fs.c @@ -251,11 +251,11 @@ bool payloadMenu(char *path) u32 firmRead(void *dest, u32 firmType) { - const char *firmFolders[][2] = {{"00000002", "20000002"}, - {"00000102", "20000102"}, - {"00000202", "20000202"}, - {"00000003", "20000003"}, - {"00000001", "20000001"}}; + static const char *firmFolders[][2] = {{"00000002", "20000002"}, + {"00000102", "20000102"}, + {"00000202", "20000202"}, + {"00000003", "20000003"}, + {"00000001", "20000001"}}; char folderPath[35], path[48];