From 12e8312eda27ed83017db4809cd67660ec37fda1 Mon Sep 17 00:00:00 2001 From: iZePlayzYT <69536095+iZePlayzYT@users.noreply.github.com> Date: Tue, 23 Apr 2024 01:32:28 +0200 Subject: [PATCH] Streamlined Development and Enhanced Customization: Updates to .gitignore, and Keyboard Controls in Chat (#17) * Ignore Visual Studio Stuff * Added a few scripts for development * Improved the development scripts * Added option to choose between 2 different keyboard control variants in the chat * Improved and added new batch scripts for development purposes * Hotfix * Converted the .BAT-Scripts to .SH-Scripts and moved them to the "development" folder and fixed a bug in the already existing "compile.sh" file * Fixed some stuff * Removed 7 .sh-scripts --- .gitignore | 1 + developer/compile.sh | 4 ++-- developer/recompile-and-restart.sh | 3 +++ lang/Czech.ini | 1 + lang/Dutch.ini | 1 + lang/English.ini | 1 + lang/French.ini | 1 + lang/German.ini | 1 + lang/Italian.ini | 1 + lang/Polish.ini | 1 + lang/Portuguese.ini | 1 + lang/Russian.ini | 1 + lang/Spanish.ini | 1 + src/pc/configfile.c | 2 ++ src/pc/configfile.h | 1 + src/pc/djui/djui_chat_box.c | 34 +++++++++++++++++++----------- src/pc/djui/djui_panel_misc.c | 1 + 17 files changed, 42 insertions(+), 14 deletions(-) create mode 100644 developer/recompile-and-restart.sh diff --git a/.gitignore b/.gitignore index 706f7da5..6a1fdac0 100644 --- a/.gitignore +++ b/.gitignore @@ -90,3 +90,4 @@ todo.txt todo-old.txt tools/ido5.3_compiler/usr/lib/libc.so.1 +/.vs diff --git a/developer/compile.sh b/developer/compile.sh index 685422b5..85af7692 100755 --- a/developer/compile.sh +++ b/developer/compile.sh @@ -8,9 +8,9 @@ else fi # find file -FILE=./build/us_pc/sm64.us.f3dex2e.exe +FILE=./build/us_pc/sm64coopdx.exe if [ ! -f "$FILE" ]; then - FILE=./build/us_pc/sm64.us.f3dex2e + FILE=./build/us_pc/sm64coopdx fi $FILE & diff --git a/developer/recompile-and-restart.sh b/developer/recompile-and-restart.sh new file mode 100644 index 00000000..76856c64 --- /dev/null +++ b/developer/recompile-and-restart.sh @@ -0,0 +1,3 @@ +#!/bin/bash +cmd //C "taskkill /F /T /IM sm64coopdx.exe" +cd ..; make -j; if [ $? -ne 0 ]; then echo ' '; echo ' '; echo '----------------------------------------'; echo '[BUILDING/COMPILING FAILED]'; echo '----------------------------------------'; echo ' '; else echo ' '; echo ' '; echo '++++++++++++++++++++++++++++++++++++++++'; echo '[BUILDING/COMPILING SUCCESSFUL]'; echo '++++++++++++++++++++++++++++++++++++++++'; echo ' '; start build/us_pc/sm64coopdx.exe --console --server 7777; fi; read -p 'Press [Enter] to close...' diff --git a/lang/Czech.ini b/lang/Czech.ini index 3d609cdd..28e75468 100644 --- a/lang/Czech.ini +++ b/lang/Czech.ini @@ -259,6 +259,7 @@ DEBUG_ERRORS = "Debug Errors" MISC_TITLE = "JINE" PAUSE_IN_SINGLEPLAYER = "Pauza v hře s jedním hráčem" DISABLE_POPUPS = "Vypnout vyskakovací okna" +USE_STANDARD_KEY_BINDINGS_CHAT = "Použij standardní ovládání klávesnice pro chat" MENU_OPTIONS = "Nastavení hlavního menu" INFORMATION = "Informace" DEBUG = "Debug" diff --git a/lang/Dutch.ini b/lang/Dutch.ini index 2b8ea67f..27386fea 100644 --- a/lang/Dutch.ini +++ b/lang/Dutch.ini @@ -259,6 +259,7 @@ DEBUG_ERRORS = "Debug Errors" MISC_TITLE = "MISC" PAUSE_IN_SINGLEPLAYER = "Pauzeer in een speler" DISABLE_POPUPS = "Popups uitzetten" +USE_STANDARD_KEY_BINDINGS_CHAT = "Gebruik standaard toetsenbordbediening voor chat" MENU_OPTIONS = "Menu Instellingen" INFORMATION = "Informatie" DEBUG = "Debug" diff --git a/lang/English.ini b/lang/English.ini index 93032b40..c6fa4830 100644 --- a/lang/English.ini +++ b/lang/English.ini @@ -259,6 +259,7 @@ DEBUG_ERRORS = "Debug Errors" MISC_TITLE = "MISC" PAUSE_IN_SINGLEPLAYER = "Pause In Singleplayer" DISABLE_POPUPS = "Disable Popups" +USE_STANDARD_KEY_BINDINGS_CHAT = "Use Standard Keyboard Controls for Chat" MENU_OPTIONS = "Menu Options" INFORMATION = "Info" DEBUG = "Debug" diff --git a/lang/French.ini b/lang/French.ini index ec6ae098..1e1e411e 100644 --- a/lang/French.ini +++ b/lang/French.ini @@ -259,6 +259,7 @@ DEBUG_ERRORS = "Erreurs de Débogage" MISC_TITLE = "AUTRES" PAUSE_IN_SINGLEPLAYER = "Pause en Solo" DISABLE_POPUPS = "Désactiver les Pop-ups" +USE_STANDARD_KEY_BINDINGS_CHAT = "Utiliser les contrôles clavier standards pour le chat" MENU_OPTIONS = "Options du menu" INFORMATION = "Information" DEBUG = "Débogage" diff --git a/lang/German.ini b/lang/German.ini index cadd10c9..a2b962af 100644 --- a/lang/German.ini +++ b/lang/German.ini @@ -259,6 +259,7 @@ DEBUG_ERRORS = "Debug Fehler" MISC_TITLE = "SONSTIGES" PAUSE_IN_SINGLEPLAYER = "Pause im Einzelspieler" DISABLE_POPUPS = "Pop-ups deaktivieren" +USE_STANDARD_KEY_BINDINGS_CHAT = "Standard-Tastatursteuerungen für Chat verwenden" MENU_OPTIONS = "Menüoptionen" INFORMATION = "Information" DEBUG = "Debug" diff --git a/lang/Italian.ini b/lang/Italian.ini index e6855220..df36c6bf 100644 --- a/lang/Italian.ini +++ b/lang/Italian.ini @@ -257,6 +257,7 @@ DEBUG_ERRORS = "Errori di debug" MISC_TITLE = "VARIE" PAUSE_IN_SINGLEPLAYER = "Metti in pausa in giocatore singolo" DISABLE_POPUPS = "Disabilita Popups" +USE_STANDARD_KEY_BINDINGS_CHAT = "Usa i controlli standard della tastiera per la chat" MENU_OPTIONS = "Opzioni Menù" INFORMATION = "Informazione" DEBUG = "Debug" diff --git a/lang/Polish.ini b/lang/Polish.ini index edc37b36..3ae7f035 100644 --- a/lang/Polish.ini +++ b/lang/Polish.ini @@ -259,6 +259,7 @@ DEBUG_ERRORS = "Bledy Debugowania" MISC_TITLE = "ROZNE" PAUSE_IN_SINGLEPLAYER = "Pauza w Trybie Pojedynczego Gracza" DISABLE_POPUPS = "Wylacz Popupy" +USE_STANDARD_KEY_BINDINGS_CHAT = "Użyj standardowych ustawień klawiatury dla czatu" MENU_OPTIONS = "Opcje Menu" INFORMATION = "Info" DEBUG = "Debugowanie" diff --git a/lang/Portuguese.ini b/lang/Portuguese.ini index 83108746..c56443df 100644 --- a/lang/Portuguese.ini +++ b/lang/Portuguese.ini @@ -259,6 +259,7 @@ DEBUG_ERRORS = "Erros debug" MISC_TITLE = "MAIS" PAUSE_IN_SINGLEPLAYER = "Pausa com jogador único" DISABLE_POPUPS = "Desativar popups" +USE_STANDARD_KEY_BINDINGS_CHAT = "Usar controles padrão do teclado para chat" MENU_OPTIONS = "Opções de menu" INFORMATION = "Informação" DEBUG = "Debug" diff --git a/lang/Russian.ini b/lang/Russian.ini index 60cf7ec1..12fb0b6c 100644 --- a/lang/Russian.ini +++ b/lang/Russian.ini @@ -258,6 +258,7 @@ DEBUG_ERRORS = "Ошибки отладки" MISC_TITLE = "MISC" PAUSE_IN_SINGLEPLAYER = "Пауза в одиночной игре" DISABLE_POPUPS = "Отключить всплывающие окна" +USE_STANDARD_KEY_BINDINGS_CHAT = "Использовать стандартные управления клавиатурой для чата" MENU_OPTIONS = "Параметры меню" INFORMATION = "Информация" DEBUG = "Отладка" diff --git a/lang/Spanish.ini b/lang/Spanish.ini index b4025a17..4699add0 100644 --- a/lang/Spanish.ini +++ b/lang/Spanish.ini @@ -259,6 +259,7 @@ DEBUG_ERRORS = "Errores de Depuración" MISC_TITLE = "OTROS" PAUSE_IN_SINGLEPLAYER = "Pausa en modo de un jugador" DISABLE_POPUPS = "Deshabilitar mensajes emergentes" +USE_STANDARD_KEY_BINDINGS_CHAT = "Usar controles estándar del teclado para chat" MENU_OPTIONS = "Opciones del menú" INFORMATION = "Información" DEBUG = "Depuración" diff --git a/src/pc/configfile.c b/src/pc/configfile.c index ddd0156d..42707116 100644 --- a/src/pc/configfile.c +++ b/src/pc/configfile.c @@ -144,6 +144,7 @@ bool configUncappedFramerate = false; unsigned int configFrameLimit = 144; unsigned int configDrawDistance = 4; bool configDisablePopups = false; +bool configUseStandardKeyBindingsChat = false; bool configLuaProfiler = false; #ifdef DEVELOPMENT bool configCtxProfiler = false; @@ -265,6 +266,7 @@ static const struct ConfigOption options[] = { {.name = "coop_stay_in_level_after_star", .type = CONFIG_TYPE_UINT , .uintValue = &configStayInLevelAfterStar}, {.name = "coop_global_player_models", .type = CONFIG_TYPE_BOOL , .boolValue = &configGlobalPlayerModels}, {.name = "disable_popups", .type = CONFIG_TYPE_BOOL , .boolValue = &configDisablePopups}, + {.name = "use_standard_key_bindings_chat", .type = CONFIG_TYPE_BOOL , .boolValue = &configUseStandardKeyBindingsChat}, {.name = "lua_profiler", .type = CONFIG_TYPE_BOOL , .boolValue = &configLuaProfiler}, #ifdef DEVELOPMENT {.name = "ctx_profiler", .type = CONFIG_TYPE_BOOL , .boolValue = &configCtxProfiler}, diff --git a/src/pc/configfile.h b/src/pc/configfile.h index 00aff835..6667e32f 100644 --- a/src/pc/configfile.h +++ b/src/pc/configfile.h @@ -103,6 +103,7 @@ extern bool configUncappedFramerate; extern unsigned int configFrameLimit; extern unsigned int configDrawDistance; extern bool configDisablePopups; +extern bool configUseStandardKeyBindingsChat; extern bool configLuaProfiler; #ifdef DEVELOPMENT extern bool configCtxProfiler; diff --git a/src/pc/djui/djui_chat_box.c b/src/pc/djui/djui_chat_box.c index 7518a5d2..5a1da115 100644 --- a/src/pc/djui/djui_chat_box.c +++ b/src/pc/djui/djui_chat_box.c @@ -4,6 +4,7 @@ #include "pc/network/network.h" #include "pc/lua/smlua_hooks.h" #include "pc/chat_commands.h" +#include "pc/configfile.h" #include "djui.h" struct DjuiChatBox* gDjuiChatBox = NULL; @@ -51,7 +52,8 @@ void sent_history_init(ArrayList *arrayList) { } void sent_history_add_message(ArrayList *arrayList, const char *newMessage) { - if (!newMessage || newMessage[0] != '/') { return; } + if (!configUseStandardKeyBindingsChat && (!newMessage || newMessage[0] != '/')) { return; } + if (arrayList->size == MAX_HISTORY_SIZE) { for (s32 i = 1; i < MAX_HISTORY_SIZE; i++) { snprintf(arrayList->messages[i-1], MAX_MSG_LENGTH, "%s", arrayList->messages[i]); @@ -127,7 +129,7 @@ static void djui_chat_box_input_enter(struct DjuiInputbox* chatInput) { if (strlen(chatInput->buffer) != 0) { sent_history_add_message(&sentHistory, chatInput->buffer); if (chatInput->buffer[0] == '/') { - if (strcmp(chatInput->buffer, "/help") == 0 || strcmp(chatInput->buffer, "/?") == 0 || strcmp(chatInput->buffer, "/") == 0) { + if (strcmp(chatInput->buffer, "/help") == 0 || strcmp(chatInput->buffer, "/?") == 0 || (!configUseStandardKeyBindingsChat && strcmp(chatInput->buffer, "/")) == 0) { display_chat_commands(); } else if (!exec_chat_command(chatInput->buffer)) { char extendedUnknownCommandMessage[MAX_MSG_LENGTH]; @@ -417,36 +419,44 @@ static bool djui_chat_box_input_on_key_down(struct DjuiBase* base, int scancode) switch (scancode) { case SCANCODE_UP: - if (gDjuiChatBox->chatInput && gDjuiChatBox->chatInput->buffer && gDjuiChatBox->chatInput->buffer[0] != '/') { + if (!configUseStandardKeyBindingsChat && (gDjuiChatBox->chatInput && gDjuiChatBox->chatInput->buffer && gDjuiChatBox->chatInput->buffer[0] != '/')) { gDjuiChatBox->scrolling = true; if (canScrollDown) { *yValue = fmin(*yValue + 15, 0); } } else { sent_history_update_current_message(&sentHistory, gDjuiChatBox->chatInput->buffer); sent_history_navigate(&sentHistory, true); - if (strcmp(previousText, gDjuiChatBox->chatInput->buffer) != 0) { - reset_tab_completion_all(); - } + if (strcmp(previousText, gDjuiChatBox->chatInput->buffer) != 0) { reset_tab_completion_all(); } } return true; case SCANCODE_DOWN: - if (gDjuiChatBox->chatInput && gDjuiChatBox->chatInput->buffer && gDjuiChatBox->chatInput->buffer[0] != '/') { + if (!configUseStandardKeyBindingsChat && (gDjuiChatBox->chatInput && gDjuiChatBox->chatInput->buffer && gDjuiChatBox->chatInput->buffer[0] != '/')) { gDjuiChatBox->scrolling = true; if (canScrollUp) { *yValue = fmax(*yValue - 15, yMax); } } else { sent_history_update_current_message(&sentHistory, gDjuiChatBox->chatInput->buffer); sent_history_navigate(&sentHistory, false); - if (strcmp(previousText, gDjuiChatBox->chatInput->buffer) != 0) { - reset_tab_completion_all(); - } + if (strcmp(previousText, gDjuiChatBox->chatInput->buffer) != 0) { reset_tab_completion_all(); } } return true; case SCANCODE_PAGE_UP: gDjuiChatBox->scrolling = true; - if (canScrollDown) { *yValue = fmin(*yValue + pageAmount, 0); } + if (canScrollDown) { + if (configUseStandardKeyBindingsChat) { + *yValue = fmin(*yValue + 15, 0); + } else { + *yValue = fmin(*yValue + pageAmount, 0); + } + } return true; case SCANCODE_PAGE_DOWN: gDjuiChatBox->scrolling = true; - if (canScrollUp) { *yValue = fmax(*yValue - pageAmount, yMax); } + if (canScrollUp) { + if (configUseStandardKeyBindingsChat) { + *yValue = fmax(*yValue - 15, yMax); + } else { + *yValue = fmax(*yValue - pageAmount, yMax); + } + } return true; case SCANCODE_POS1: gDjuiChatBox->scrolling = true; diff --git a/src/pc/djui/djui_panel_misc.c b/src/pc/djui/djui_panel_misc.c index 7631297f..3d084e14 100644 --- a/src/pc/djui/djui_panel_misc.c +++ b/src/pc/djui/djui_panel_misc.c @@ -66,6 +66,7 @@ void djui_panel_misc_create(struct DjuiBase* caller) { { djui_checkbox_create(body, DLANG(MISC, DISABLE_POPUPS), &configDisablePopups, NULL); + djui_checkbox_create(body, DLANG(MISC, USE_STANDARD_KEY_BINDINGS_CHAT), &configUseStandardKeyBindingsChat, NULL); #ifndef DEVELOPMENT djui_checkbox_create(body, DLANG(MISC, LUA_PROFILER), &configLuaProfiler, NULL); #endif