From efe66bc72ea3071da961073997bd3f4fed9ead7a Mon Sep 17 00:00:00 2001 From: TuxSH Date: Sun, 18 Sep 2016 17:40:00 +0200 Subject: [PATCH] Make option descriptions more readable, fix bug in draw.c --- source/config.c | 71 +++++++++++++++++++++++++------------------------ source/draw.c | 35 +++++++++++++++--------- 2 files changed, 58 insertions(+), 48 deletions(-) diff --git a/source/config.c b/source/config.c index 61e035c..2393d67 100644 --- a/source/config.c +++ b/source/config.c @@ -86,68 +86,69 @@ void configMenu(bool oldPinStatus) #endif }; - const char *optionsDescription[] = { "Select the default EmuNAND.\n" + const char *optionsDescription[] = { "Select the default EmuNAND.\n\n" "It will booted with no directional pad\n" - "buttons pressed", + "buttons pressed.", "Select the screen brightness", - "Activate a PIN lock.\n" + "Activate a PIN lock.\n\n" "The PIN will be asked each time\n" - "Luma3DS boots.\n" - "4, 6 or 8 digits can be selected.\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", + "pad buttons can be used as keys.", - "Select the New 3DS CPU mode.\n" - "It will be always enabled.\n" + "Select the New 3DS CPU mode.\n\n" + "It will be always enabled.\n\n" "'Clock+L2' can cause issues with some\n" - "games", + "games.", #ifdef DEV - "Select the developer features.\n" - "'ErrDisp' displays debug information\n" + "Select the developer features.\n\n" + "\t* 'ErrDisp' displays debug info. " "on the 'An error has occurred' screen.\n" - "'UNITINFO' makes the console be always\n" - "detected as a development unit (which\n" - "breaks online features and allows\n" - "booting some developer software).\n" - "'Off' disables exception handlers\n" - "in FIRM", + "\t* 'UNITINFO' makes the console be\n" + "always detected as a development unit (which " + "breaks online features and\n" + "allows booting some developer software).\n" + "\t* 'Off' disables exception handlers\n" + "in FIRM.", #endif "If enabled SysNAND will be launched on\n" - "boot. Otherwise, an EmuNAND will.\n" - "Hold L on boot to switch NAND.\n" + "boot. Otherwise, an EmuNAND 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)", + "1/2/3/4).", "If enabled, when holding R on boot\n" "EmuNAND will be booted with the\n" "SysNAND FIRM. Otherwise, SysNAND will\n" - "be booted with an EmuNAND FIRM.\n" + "be booted with an EmuNAND 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)", + "1/2/3/4).", "Enable overriding the region and\n" "language configuration and the usage\n" "of patched code binaries for specific\n" - "games.\n" + "games.\n\n" "Also makes certain DLCs for\n" - "out-of-region games work.\n" - "Refer to the wiki for instructions", + "out-of-region games work.\n\n" + "Refer to the wiki for instructions.", - "Show the currently booted NAND\n" - "(Sys = SysNAND, Emu = EmuNAND 1,\n" - "EmuX = EmuNAND X,\n" - "SysE = SysNAND with EmuNAND 1 FIRM,\n" - "SyEX = SysNAND with EmuNAND X FIRM,\n" - "EmXS = EmuNAND X with SysNAND FIRM)\n" + "Show the currently booted NAND.\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* EmXS = EmuNAND X with SysNAND FIRM\n\n" "or an user-defined custom string in\n" - "System Settings.\n" - "Refer to the wiki for instructions", + "System Settings.\n\n" + "Refer to the wiki for instructions.", "Show the GBA boot screen when booting\n" "GBA games", @@ -155,9 +156,9 @@ void configMenu(bool oldPinStatus) "If enabled, the splash screen will be\n" "displayed before booting payloads,\n" "otherwise it will be displayed\n" - "afterwards.\n" + "afterwards.\n\n" "Intended for splash screens that\n" - "display button hints" + "display button hints." #ifdef DEV , "Disable SVC, service, archive and ARM9\n" "exheader access checks" diff --git a/source/draw.c b/source/draw.c index ed9bd46..36a943e 100644 --- a/source/draw.c +++ b/source/draw.c @@ -76,23 +76,32 @@ void drawCharacter(char character, bool isTopScreen, u32 posX, u32 posY, u32 col u32 drawString(const char *string, bool isTopScreen, u32 posX, u32 posY, u32 color) { - for(u32 i = 0, line_i = 0; i < strlen(string); i++, line_i++) + for(u32 i = 0, line_i = 0; i < strlen(string); i++) { - if(string[i] == '\n') + switch(string[i]) { - posY += SPACING_Y; - line_i = 0; - i++; - } - else if(line_i >= ((isTopScreen ? SCREEN_TOP_WIDTH : SCREEN_BOTTOM_WIDTH) - posX) / SPACING_X) - { - //Make sure we never get out of the screen - posY += SPACING_Y; - line_i = 1; //Little offset so we know the same string continues - if(string[i] == ' ') i++; //Spaces at the start look weird + case '\n': + posY += SPACING_Y; + line_i = 0; + break; + + case '\t': + line_i += 2; + break; + + default: + //Make sure we never get out of the screen + if(line_i >= ((isTopScreen ? SCREEN_TOP_WIDTH : SCREEN_BOTTOM_WIDTH) - posX) / SPACING_X) + { + posY += SPACING_Y; + line_i = 0; + } + + drawCharacter(string[i], isTopScreen, posX + line_i * SPACING_X, posY, color); + line_i++; + break; } - drawCharacter(string[i], isTopScreen, posX + line_i * SPACING_X, posY, color); } return posY;