From 92cc989dc9a1d205da7d0467435da7bb484574d3 Mon Sep 17 00:00:00 2001 From: John Kearney Date: Thu, 19 Jan 2017 16:48:09 -0500 Subject: [PATCH] Add pin hiding option --- source/config.c | 7 ++++++- source/config.h | 3 ++- source/main.c | 3 ++- source/pin.c | 6 +++--- source/pin.h | 2 +- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/source/config.c b/source/config.c index f5b954b..48e4b75 100644 --- a/source/config.c +++ b/source/config.c @@ -83,7 +83,8 @@ void configMenu(bool isSdMode, bool oldPinStatus, u32 oldPinMode) "( ) Enable game patching", "( ) Show NAND or user string in System Settings", "( ) Show GBA boot screen in patched AGB_FIRM", - "( ) Patch SVC/service/archive/ARM9 access" + "( ) Patch SVC/service/archive/ARM9 access", + "( ) Hide Pin when entering" }; const char *optionsDescription[] = { "Select the default EmuNAND.\n\n" @@ -190,6 +191,9 @@ void configMenu(bool isSdMode, bool oldPinStatus, u32 oldPinMode) "9.3 and 10.4.\n\n" "Only change this if you know what you\n" "are doing!", + + "Hides the the input when entering pin\n" + "to unlock the 3DS" }; struct multiOption { @@ -218,6 +222,7 @@ void configMenu(bool isSdMode, bool oldPinStatus, u32 oldPinMode) { .visible = true }, { .visible = true }, { .visible = true }, + { .visible = true }, { .visible = true } }; diff --git a/source/config.h b/source/config.h index acfd4b9..905d4c9 100644 --- a/source/config.h +++ b/source/config.h @@ -56,7 +56,8 @@ enum singleOptions PATCHGAMES, PATCHVERSTRING, SHOWGBABOOT, - PATCHACCESS + PATCHACCESS, + HIDEPIN }; typedef enum ConfigurationStatus diff --git a/source/main.c b/source/main.c index e1e976f..d8267f4 100644 --- a/source/main.c +++ b/source/main.c @@ -124,7 +124,8 @@ void main(void) } u32 pinMode = MULTICONFIG(PIN); - bool pinExists = pinMode != 0 && verifyPin(pinMode); + bool hidePin = CONFIG(HIDEPIN); + bool pinExists = pinMode != 0 && verifyPin(pinMode, hidePin); //If no configuration file exists or SELECT is held, load configuration menu bool shouldLoadConfigMenu = needConfig == CREATE_CONFIGURATION || ((pressed & (BUTTON_SELECT | BUTTON_L1)) == BUTTON_SELECT); diff --git a/source/pin.c b/source/pin.c index 9426661..935343c 100644 --- a/source/pin.c +++ b/source/pin.c @@ -122,7 +122,7 @@ void newPin(bool allowSkipping, u32 pinMode) error("Error writing the PIN file"); } -bool verifyPin(u32 pinMode) +bool verifyPin(u32 pinMode, bool hidePin) { PinData pin; @@ -199,9 +199,9 @@ bool verifyPin(u32 pinMode) //Add character to password enteredPassword[cnt] = (u8)pinKeyToLetter(pressed); - //Visualize character on screen - drawCharacter((char)enteredPassword[cnt], true, 10 + (16 + 2 * cnt) * SPACING_X, 10 + 3 * SPACING_Y, COLOR_WHITE); + char display = hidePin ? '*' : (char)enteredPassword[cnt]; + drawCharacter(display, true, 10 + (16 + 2 * cnt) * SPACING_X, 10 + 3 * SPACING_Y, COLOR_WHITE); if(++cnt < lengthBlock[0]) continue; diff --git a/source/pin.h b/source/pin.h index c781508..a6c18fc 100644 --- a/source/pin.h +++ b/source/pin.h @@ -33,4 +33,4 @@ #define PIN_VERSIONMINOR 3 void newPin(bool allowSkipping, u32 pinMode); -bool verifyPin(u32 pinMode); \ No newline at end of file +bool verifyPin(u32 pinMode, bool hidePin); \ No newline at end of file