Skip to content

Commit

Permalink
Add AUTO_LOWERCASE_KEYBOARD (#4976)
Browse files Browse the repository at this point in the history
* 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 #4976
  • Loading branch information
pkmnsnfrn committed Jul 15, 2024
1 parent 0d0100d commit 7b3b635
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/config/general.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 17 additions & 0 deletions src/naming_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -1480,6 +1481,8 @@ static bool8 KeyboardKeyHandler_Character(u8 input)
{
bool8 textFull = AddTextCharacter();

SwapKeyboardToLowerAfterFirstCapitalLetter();

SquishCursor();
if (textFull)
{
Expand All @@ -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);
Expand Down

0 comments on commit 7b3b635

Please sign in to comment.