From da4e5e4832f4f1f1285d7d487a6f01e6e4ba1dec Mon Sep 17 00:00:00 2001 From: fgsfds Date: Sun, 5 Jan 2025 15:44:14 +0100 Subject: [PATCH] what the fuck git --- port/include/console.h | 1 + port/src/console.c | 9 ++++++++- port/src/net/netmenu.c | 2 +- src/game/menuitem.c | 21 ++++++++++++--------- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/port/include/console.h b/port/include/console.h index 29476f895..28731c751 100644 --- a/port/include/console.h +++ b/port/include/console.h @@ -10,5 +10,6 @@ void conTick(void); void conPrint(s32 showmsg, const char *s); void conPrintf(s32 showmsg, const char *fmt, ...); void conPrintLn(s32 showmsg, const char *s); +s32 conIsOpen(void); #endif diff --git a/port/src/console.c b/port/src/console.c index 098b0c8b1..a5b039eb7 100644 --- a/port/src/console.c +++ b/port/src/console.c @@ -192,7 +192,9 @@ void conTick(void) const s32 button = inputKeyPressed(VK_GRAVE); if (button && !conButton) { conOpen = !conOpen; + g_MenuKeyboardPlayer = -1; if (conOpen) { + inputClearLastTextChar(); inputStartTextInput(); } else { inputStopTextInput(); @@ -202,7 +204,7 @@ void conTick(void) conButton = button; if (conOpen) { - if (inputTextHandler(conInput, CON_COLS, &conInputCol)) { + if (inputTextHandler(conInput, CON_COLS, &conInputCol, false)) { if (g_NetMode) { netChat(NULL, conInput); } @@ -211,3 +213,8 @@ void conTick(void) } } } + +s32 conIsOpen(void) +{ + return conOpen; +} diff --git a/port/src/net/netmenu.c b/port/src/net/netmenu.c index dca72affe..94da0a537 100644 --- a/port/src/net/netmenu.c +++ b/port/src/net/netmenu.c @@ -236,7 +236,7 @@ static MenuItemHandlerResult menuhandlerEnterJoinAddress(s32 operation, struct m return 0; } - if (inputTextHandler(g_NetJoinAddr, NET_MAX_ADDR, &g_NetJoinAddrPtr) < 0) { + if (inputTextHandler(g_NetJoinAddr, NET_MAX_ADDR, &g_NetJoinAddrPtr, false) < 0) { // escape has been pressed, stop editing inputStopTextInput(); menuPopDialog(); diff --git a/src/game/menuitem.c b/src/game/menuitem.c index 2a40f0981..31bce2d81 100644 --- a/src/game/menuitem.c +++ b/src/game/menuitem.c @@ -24,6 +24,7 @@ #include "types.h" #ifndef PLATFORM_N64 #include "input.h" +#include "console.h" #define MENU_KEYBOARD_ROWS 6 #else #define MENU_KEYBOARD_ROWS 5 @@ -1588,15 +1589,17 @@ bool menuitemKeyboardTick(struct menuitem *item, struct menuinputs *inputs, u32 } } else if (kb->row == 5) { #ifndef PLATFORM_N64 - if (g_MenuKeyboardPlayer == -1) { - g_MenuKeyboardPlayer = g_MpPlayerNum; - inputClearLastTextChar(); - inputStartTextInput(); - menuPlaySound(MENUSOUND_SELECT); - } else { - g_MenuKeyboardPlayer = -1; - inputStopTextInput(); - menuPlaySound(MENUSOUND_KEYBOARDCANCEL); + if (!conIsOpen()) { + if (g_MenuKeyboardPlayer == -1) { + g_MenuKeyboardPlayer = g_MpPlayerNum; + inputClearLastTextChar(); + inputStartTextInput(); + menuPlaySound(MENUSOUND_SELECT); + } else { + g_MenuKeyboardPlayer = -1; + inputStopTextInput(); + menuPlaySound(MENUSOUND_KEYBOARDCANCEL); + } } #endif } else {