From 7b3b635c6798e562415f45e21e9824b89514fe3a Mon Sep 17 00:00:00 2001 From: psf <77138753+pkmnsnfrn@users.noreply.github.com> Date: Mon, 15 Jul 2024 10:06:01 -0700 Subject: [PATCH] Add AUTO_LOWERCASE_KEYBOARD (#4976) * Added SwapKeyboardToLowerAfterFirstCapitalLetter and AUTO_LOWERCASE_KEYBOARD * Fixed tabs and spacing per https://github.com/rh-hideout/pokeemerald-expansion/pull/4976/files\#r1677868397 * Removed semicolon found by https://github.com/rh-hideout/pokeemerald-expansion/pull/4976\#discussion_r1678105502 --- include/config/general.h | 3 +++ src/naming_screen.c | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/config/general.h b/include/config/general.h index a374ee97a1..dc39f4919a 100644 --- a/include/config/general.h +++ b/include/config/general.h @@ -80,4 +80,7 @@ #define UNITS UNITS_IMPERIAL #define CHAR_DEC_SEPARATOR CHAR_PERIOD // CHAR_PERIOD is used as a decimal separator only in the UK and the US. The rest of the world uses CHAR_COMMA. +// Naming Screen +#define AUTO_LOWERCASE_KEYBOARD GEN_LATEST // Starting in GEN_6, after entering the first uppercase character, the keyboard switches to lowercase letters. + #endif // GUARD_CONFIG_GENERAL_H diff --git a/src/naming_screen.c b/src/naming_screen.c index cd6105dce9..118d91cfb4 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -1436,6 +1436,7 @@ static void NamingScreen_CreateWaldaDadIcon(void) //-------------------------------------------------- static bool8 KeyboardKeyHandler_Character(u8); +static void SwapKeyboardToLowerAfterFirstCapitalLetter(void); static bool8 KeyboardKeyHandler_Page(u8); static bool8 KeyboardKeyHandler_Backspace(u8); static bool8 KeyboardKeyHandler_OK(u8); @@ -1480,6 +1481,8 @@ static bool8 KeyboardKeyHandler_Character(u8 input) { bool8 textFull = AddTextCharacter(); + SwapKeyboardToLowerAfterFirstCapitalLetter(); + SquishCursor(); if (textFull) { @@ -1490,6 +1493,20 @@ static bool8 KeyboardKeyHandler_Character(u8 input) return FALSE; } +static void SwapKeyboardToLowerAfterFirstCapitalLetter(void) +{ + if (AUTO_LOWERCASE_KEYBOARD < GEN_6) + return; + + if (sNamingScreen->currentPage != KBPAGE_LETTERS_UPPER) + return; + + if (GetTextEntryPosition() != 1) + return; + + MainState_StartPageSwap(); +} + static bool8 KeyboardKeyHandler_Page(u8 input) { TryStartButtonFlash(BUTTON_PAGE, TRUE, FALSE);