Minor code syntax stuff

This commit is contained in:
Aurora Wright 2017-08-16 18:02:35 +02:00
parent a3cb6a622d
commit fbf8a1b6d9
4 changed files with 118 additions and 115 deletions

View File

@ -78,121 +78,121 @@ void writeConfig(bool isConfigOptions)
void configMenu(bool oldPinStatus, u32 oldPinMode) void configMenu(bool oldPinStatus, u32 oldPinMode)
{ {
const char *multiOptionsText[] = { "Default EmuNAND: 1( ) 2( ) 3( ) 4( )", static const char *multiOptionsText[] = { "Default EmuNAND: 1( ) 2( ) 3( ) 4( )",
"Screen brightness: 4( ) 3( ) 2( ) 1( )", "Screen brightness: 4( ) 3( ) 2( ) 1( )",
"Splash: Off( ) Before( ) After( ) payloads", "Splash: Off( ) Before( ) After( ) payloads",
"PIN lock: Off( ) 4( ) 6( ) 8( ) digits", "PIN lock: Off( ) 4( ) 6( ) 8( ) digits",
"New 3DS CPU: Off( ) Clock( ) L2( ) Clock+L2( )", "New 3DS CPU: Off( ) Clock( ) L2( ) Clock+L2( )",
}; };
const char *singleOptionsText[] = { "( ) Autoboot EmuNAND", static const char *singleOptionsText[] = { "( ) Autoboot EmuNAND",
"( ) Use EmuNAND FIRM if booting with R", "( ) Use EmuNAND FIRM if booting with R",
"( ) Enable loading external FIRMs and modules", "( ) Enable loading external FIRMs and modules",
"( ) Enable game patching", "( ) Enable game patching",
"( ) Show NAND or user string in System Settings", "( ) Show NAND or user string in System Settings",
"( ) Show GBA boot screen in patched AGB_FIRM", "( ) Show GBA boot screen in patched AGB_FIRM",
"( ) Patch ARM9 access", "( ) Patch ARM9 access",
"( ) Set developer UNITINFO", "( ) Set developer UNITINFO",
"( ) Disable ARM11 exception handlers", "( ) Disable ARM11 exception handlers",
}; };
const char *optionsDescription[] = { "Select the default EmuNAND.\n\n" static const char *optionsDescription[] = { "Select the default EmuNAND.\n\n"
"It will be booted when no\n" "It will be booted when no\n"
"directional pad buttons are pressed.", "directional pad buttons are pressed.",
"Select the screen brightness.", "Select the screen brightness.",
"Enable splash screen support.\n\n" "Enable splash screen support.\n\n"
"\t* 'Before payloads' displays it\n" "\t* 'Before payloads' displays it\n"
"before booting payloads\n" "before booting payloads\n"
"(intended for splashes that display\n" "(intended for splashes that display\n"
"button hints).\n\n" "button hints).\n\n"
"\t* 'After payloads' displays it\n" "\t* 'After payloads' displays it\n"
"afterwards.", "afterwards.",
"Activate a PIN lock.\n\n" "Activate a PIN lock.\n\n"
"The PIN will be asked each time\n" "The PIN will be asked each time\n"
"Luma3DS boots.\n\n" "Luma3DS boots.\n\n"
"4, 6 or 8 digits can be selected.\n\n" "4, 6 or 8 digits can be selected.\n\n"
"The ABXY buttons and the directional\n" "The ABXY buttons and the directional\n"
"pad buttons can be used as keys.\n\n" "pad buttons can be used as keys.\n\n"
"A message can also be displayed\n" "A message can also be displayed\n"
"(refer to the wiki for instructions).", "(refer to the wiki for instructions).",
"Select the New 3DS CPU mode.\n\n" "Select the New 3DS CPU mode.\n\n"
"This won't apply to\n" "This won't apply to\n"
"New 3DS exclusive/enhanced games.\n\n" "New 3DS exclusive/enhanced games.\n\n"
"'Clock+L2' can cause issues with some\n" "'Clock+L2' can cause issues with some\n"
"games.", "games.",
"If enabled, an EmuNAND\n" "If enabled, an EmuNAND\n"
"will be launched on boot.\n\n" "will be launched on boot.\n\n"
"Otherwise, SysNAND will.\n\n" "Otherwise, SysNAND will.\n\n"
"Hold L on boot to switch NAND.\n\n" "Hold L on boot to switch NAND.\n\n"
"To use a different EmuNAND from the\n" "To use a different EmuNAND from the\n"
"default, hold a directional pad button\n" "default, hold a directional pad button\n"
"(Up/Right/Down/Left equal EmuNANDs\n" "(Up/Right/Down/Left equal EmuNANDs\n"
"1/2/3/4).", "1/2/3/4).",
"If enabled, when holding R on boot\n" "If enabled, when holding R on boot\n"
"SysNAND will be booted with an\n" "SysNAND will be booted with an\n"
"EmuNAND FIRM.\n\n" "EmuNAND FIRM.\n\n"
"Otherwise, an EmuNAND will be booted\n" "Otherwise, an EmuNAND will be booted\n"
"with the SysNAND FIRM.\n\n" "with the SysNAND FIRM.\n\n"
"To use a different EmuNAND from the\n" "To use a different EmuNAND from the\n"
"default, hold a directional pad button\n" "default, hold a directional pad button\n"
"(Up/Right/Down/Left equal EmuNANDs\n" "(Up/Right/Down/Left equal EmuNANDs\n"
"1/2/3/4), also add A if you have\n" "1/2/3/4), also add A if you have\n"
"a matching payload.", "a matching payload.",
"Enable loading external FIRMs and\n" "Enable loading external FIRMs and\n"
"system modules.\n\n" "system modules.\n\n"
"This isn't needed in most cases.\n\n" "This isn't needed in most cases.\n\n"
"Refer to the wiki for instructions.", "Refer to the wiki for instructions.",
"Enable overriding the region and\n" "Enable overriding the region and\n"
"language configuration and the usage\n" "language configuration and the usage\n"
"of patched code binaries, exHeaders,\n" "of patched code binaries, exHeaders,\n"
"IPS code patches and LayeredFS\n" "IPS code patches and LayeredFS\n"
"for specific games.\n\n" "for specific games.\n\n"
"Also makes certain DLCs\n" "Also makes certain DLCs\n"
"for out-of-region games work.\n\n" "for out-of-region games work.\n\n"
"Refer to the wiki for instructions.", "Refer to the wiki for instructions.",
"Enable showing the current NAND/FIRM:\n\n" "Enable showing the current NAND/FIRM:\n\n"
"\t* Sys = SysNAND\n" "\t* Sys = SysNAND\n"
"\t* Emu = EmuNAND 1\n" "\t* Emu = EmuNAND 1\n"
"\t* EmuX = EmuNAND X\n" "\t* EmuX = EmuNAND X\n"
"\t* SysE = SysNAND with EmuNAND 1 FIRM\n" "\t* SysE = SysNAND with EmuNAND 1 FIRM\n"
"\t* SyEX = SysNAND with EmuNAND X FIRM\n" "\t* SyEX = SysNAND with EmuNAND X FIRM\n"
"\t* EmuS = EmuNAND 1 with SysNAND FIRM\n" "\t* EmuS = EmuNAND 1 with SysNAND FIRM\n"
"\t* EmXS = EmuNAND X with SysNAND FIRM\n\n" "\t* EmXS = EmuNAND X with SysNAND FIRM\n\n"
"or a user-defined custom string in\n" "or a user-defined custom string in\n"
"System Settings.\n\n" "System Settings.\n\n"
"Refer to the wiki for instructions.", "Refer to the wiki for instructions.",
"Enable showing the GBA boot screen\n" "Enable showing the GBA boot screen\n"
"when booting GBA games.", "when booting GBA games.",
"Disable ARM9 exheader access checks.\n\n" "Disable ARM9 exheader access checks.\n\n"
"Only select this if you know what you\n" "Only select this if you know what you\n"
"are doing!", "are doing!",
"Make the console be always detected\n" "Make the console be always detected\n"
"as a development unit, and conversely.\n" "as a development unit, and conversely.\n"
"(which breaks online features, amiibo\n" "(which breaks online features, amiibo\n"
"and retail CIAs, but allows installing\n" "and retail CIAs, but allows installing\n"
"and booting some developer software).\n\n" "and booting some developer software).\n\n"
"Only select this if you know what you\n" "Only select this if you know what you\n"
"are doing!", "are doing!",
"Disables the fatal error exception\n" "Disables the fatal error exception\n"
"handlers for the ARM11 CPU.\n\n" "handlers for the ARM11 CPU.\n\n"
"Note: Disabling the exception handlers\n" "Note: Disabling the exception handlers\n"
"will disqualify you from submitting\n" "will disqualify you from submitting\n"
"issues or bug reports to the Luma3DS\n" "issues or bug reports to the Luma3DS\n"
"GitHub repository!" "GitHub repository!"
}; };
struct multiOption { struct multiOption {
u32 posXs[4]; u32 posXs[4];

View File

@ -79,12 +79,11 @@ void detectAndProcessExceptionDumps(void)
"Precise External Abort", "Imprecise External Abort", "Debug event" "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, 0b1, 0b100, 0b1100, 0b1110, 0b101, 0b111, 0b11, 0b110, 0b1001, 0b1011, 0b1101,
0b1111, 0b1000, 0b10110, 0b10 0b1111, 0b1000, 0b10110, 0b10
}; };
initScreens(); initScreens();
drawString(true, 10, 10, COLOR_RED, "An exception occurred"); 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"); else posY = drawString(true, 10, 30, COLOR_WHITE, "Processor: ARM9");
const char *faultStatusInfos = NULL; const char *faultStatusInfos = NULL;
if (dumpHeader->type >= 2) if(dumpHeader->type >= 2)
{ {
u32 xfsr = dumpHeader->type == 2 ? regs[18] : regs[17]; u32 xfsr = dumpHeader->type == 2 ? regs[18] : regs[17];
xfsr &= 0xF; xfsr &= 0xF;
for (int i = 0; i < 15; i++) for(u32 i = 0; i < 15; i++)
if (xfsr == faultStatusValues[i]){ if(xfsr == faultStatusValues[i])
{
faultStatusInfos = faultStatusNames[i]; faultStatusInfos = faultStatusNames[i];
break; break;
} }
} }
if(dumpHeader->type == 2) if(dumpHeader->type == 2)
{ {
if((regs[16] & 0x20) == 0 && dumpHeader->codeDumpSize >= 4) if((regs[16] & 0x20) == 0 && dumpHeader->codeDumpSize >= 4)
@ -126,7 +127,8 @@ void detectAndProcessExceptionDumps(void)
} }
else else
posY = drawFormattedString(true, 10, posY + SPACING_Y, COLOR_WHITE, "Exception type: %s", handledExceptionNames[dumpHeader->type]); 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) if(dumpHeader->processor == 11 && dumpHeader->additionalDataSize != 0)
posY = drawFormattedString(true, 10, posY + SPACING_Y, COLOR_WHITE, posY = drawFormattedString(true, 10, posY + SPACING_Y, COLOR_WHITE,
@ -142,8 +144,9 @@ void detectAndProcessExceptionDumps(void)
else if(dumpHeader->processor == 11) else if(dumpHeader->processor == 11)
posY = drawFormattedString(true, 10 + 22 * SPACING_X, posY, COLOR_WHITE, "%-7s%08X", registerNames[i + 1], regs[20]); 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; posY += SPACING_Y;

View File

@ -108,14 +108,14 @@ static bool checkFirm(u32 firmSize)
static inline u32 loadFirmFromStorage(FirmwareType firmType) static inline u32 loadFirmFromStorage(FirmwareType firmType)
{ {
const char *firmwareFiles[] = { static const char *firmwareFiles[] = {
"native.firm", "native.firm",
"twl.firm", "twl.firm",
"agb.firm", "agb.firm",
"safe.firm", "safe.firm",
"sysupdater.firm" "sysupdater.firm"
}, },
*cetkFiles[] = { *cetkFiles[] = {
"cetk", "cetk",
"cetk_twl", "cetk_twl",
"cetk_agb", "cetk_agb",

View File

@ -251,11 +251,11 @@ bool payloadMenu(char *path)
u32 firmRead(void *dest, u32 firmType) u32 firmRead(void *dest, u32 firmType)
{ {
const char *firmFolders[][2] = {{"00000002", "20000002"}, static const char *firmFolders[][2] = {{"00000002", "20000002"},
{"00000102", "20000102"}, {"00000102", "20000102"},
{"00000202", "20000202"}, {"00000202", "20000202"},
{"00000003", "20000003"}, {"00000003", "20000003"},
{"00000001", "20000001"}}; {"00000001", "20000001"}};
char folderPath[35], char folderPath[35],
path[48]; path[48];