From 608cf39e12e745cf08ae92d688c0fbff6ba9882f Mon Sep 17 00:00:00 2001 From: d0k3 Date: Wed, 11 Nov 2020 00:07:09 +0100 Subject: [PATCH] Fix #601 This adds SELECT as a shortcut ot the old button based input tool in the software keyboard --- arm9/source/common/swkbd.c | 9 +++++---- arm9/source/common/swkbd.h | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/arm9/source/common/swkbd.c b/arm9/source/common/swkbd.c index 9946203..246c41c 100644 --- a/arm9/source/common/swkbd.c +++ b/arm9/source/common/swkbd.c @@ -58,10 +58,7 @@ static bool BuildKeyboard(TouchBox* swkbd, const char* keys, const u8* layout) { } // next row - if (layout[l++] != 0) { - ShowPrompt(false, "Oh shit %lu %lu", k, l); - return false; // error!!!! THIS HAS TO GO! - } + if (layout[l++] != 0) return false; p_y += SWKBD_STDKEY_HEIGHT + SWKDB_KEY_SPACING; } @@ -199,6 +196,7 @@ static char KeyboardWait(TouchBox* swkbd, bool uppercase) { else if (pressed & BUTTON_R1) return KEY_CAPS; else if (pressed & BUTTON_RIGHT) return KEY_RIGHT; else if (pressed & BUTTON_LEFT) return KEY_LEFT; + else if (pressed & BUTTON_SELECT) return KEY_SWITCH; else if (pressed & BUTTON_TOUCH) break; } @@ -297,6 +295,9 @@ bool ShowKeyboard(char* inputstr, const u32 max_size, const char *format, ...) { swkbd = swkbd_special; } else if (key == KEY_NUMPAD) { swkbd = swkbd_numpad; + } else if (key == KEY_SWITCH) { + ClearScreen(BOT_SCREEN, COLOR_STD_BG); + return ShowStringPrompt(inputstr, max_size, str); } else if (key && (key < 0x80)) { if ((cursor < (max_size-1)) && (inputstr_size < max_size)) { // pad string (if cursor beyound string size) diff --git a/arm9/source/common/swkbd.h b/arm9/source/common/swkbd.h index ee3fc52..69ed58a 100644 --- a/arm9/source/common/swkbd.h +++ b/arm9/source/common/swkbd.h @@ -18,16 +18,16 @@ enum { KEY_LEFT = 0x88, KEY_RIGHT = 0x89, KEY_ESCAPE = 0x8A, + KEY_SWITCH = 0x8B, KEY_TXTBOX = 0xFF }; // special key strings -#define SWKBD_KEYSTR "", "DEL", "INS", "SUBMIT", "CAPS", "#$@", "123", "ABC", "\x1b", "\x1a", "ESC" +#define SWKBD_KEYSTR "", "DEL", "INS", "SUBMIT", "CAPS", "#$@", "123", "ABC", "\x1b", "\x1a", "ESC", "SWITCH" #define COLOR_SWKBD_NORMAL COLOR_GREY #define COLOR_SWKBD_PRESSED COLOR_LIGHTGREY #define COLOR_SWKBD_BOX COLOR_DARKGREY -#define COLOR_SWKBD_TEXTBOX COLOR_DARKGREY #define COLOR_SWKBD_CHARS COLOR_BLACK #define COLOR_SWKBD_ENTER COLOR_TINTEDBLUE #define COLOR_SWKBD_CAPS COLOR_TINTEDYELLOW