From d6d4ab597029be96d70f1babaa0417cfa28e9877 Mon Sep 17 00:00:00 2001 From: nastys <@> Date: Sat, 26 Oct 2019 15:09:56 +0200 Subject: [PATCH] Better keybindings --- source-code/data/plugins/keyconfig.ini | 7 ++++--- .../source/plugins/TLAC/Components/Input/InputEmulator.cpp | 7 +++++++ .../source/plugins/TLAC/Components/Input/InputEmulator.h | 1 + .../plugins/TLAC/Components/Input/TouchSliderEmulator.cpp | 3 ++- source-code/source/plugins/TLAC/Input/KeyConfig/Config.cpp | 2 ++ 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/source-code/data/plugins/keyconfig.ini b/source-code/data/plugins/keyconfig.ini index f6de9e8..cf6700d 100644 --- a/source-code/data/plugins/keyconfig.ini +++ b/source-code/data/plugins/keyconfig.ini @@ -33,8 +33,9 @@ JVS_CIRCLE = D, L, Ds4_Circle, Ds4_DPad_Right, Ds4_L_Trigger, Ds4_R_Trigger, XIN JVS_LEFT = Left, Up, Ds4_L1, Ds4_L_Stick_Up, Ds4_R_Stick_Up, XINPUT_LS JVS_RIGHT = Right, Down, Ds4_R1, Ds4_L_Stick_Down, Ds4_R_Stick_Down, XINPUT_RS -MENU_L = Left, Up, Ds4_L1, Ds4_L_Stick_Up, Ds4_R_Stick_Up, XINPUT_LS, Ds4_DPad_Left, Ds4_DPad_Up, XINPUT_LEFT, XINPUT_UP -MENU_R = Right, Down, Ds4_R1, Ds4_L_Stick_Down, Ds4_R_Stick_Down, XINPUT_RS, Ds4_DPad_Right, Ds4_DPad_Down, XINPUT_RIGHT, XINPUT_DOWN +MENU_L = Left, Up, Ds4_L1, Ds4_L_Stick_Up, Ds4_R_Stick_Up, XINPUT_LS, Ds4_DPad_Left, Ds4_DPad_Up, XINPUT_LEFT, XINPUT_UP, Q, U, Ds4_L_Stick_Left, XINPUT_LLEFT +MENU_R = Right, Down, Ds4_R1, Ds4_L_Stick_Down, Ds4_R_Stick_Down, XINPUT_RS, Ds4_DPad_Right, Ds4_DPad_Down, XINPUT_RIGHT, XINPUT_DOWN, E, O, Ds4_L_Stick_Right, XINPUT_LRIGHT +MENU_CIRCLE = Spacebar, D, L, Ds4_Circle, Ds4_DPad_Right, Ds4_L_Trigger, Ds4_R_Trigger, XINPUT_B, XINPUT_RIGHT, XINPUT_LT, XINPUT_RT # Touch Slider: LEFT_SIDE_SLIDE_LEFT = Q, Ds4_L_Stick_Left, XINPUT_LLEFT @@ -65,7 +66,7 @@ RIGHT_SIDE_SLIDE_RIGHT = O, Ds4_R_Stick_Right, XINPUT_RRIGHT # "Up", "Down", "Left", "Right" # - Special Keys -# "Enter", "Tab", "Backspace", "Insert", "Delete", "Home", "End", "PageUp", "PageDown", "Escape" +# "Enter", "Tab", "Backspace", "Spacebar", "Insert", "Delete", "Home", "End", "PageUp", "PageDown", "Escape" # --- MOUSE BUTTON NAMES: --- # "MouseLeft", "MouseMiddle", "MouseRight", "MouseX1", "MouseX2" diff --git a/source-code/source/plugins/TLAC/Components/Input/InputEmulator.cpp b/source-code/source/plugins/TLAC/Components/Input/InputEmulator.cpp index 96af78b..879b269 100644 --- a/source-code/source/plugins/TLAC/Components/Input/InputEmulator.cpp +++ b/source-code/source/plugins/TLAC/Components/Input/InputEmulator.cpp @@ -42,6 +42,10 @@ namespace TLAC::Components delete LeftBinding; delete RightBinding; + + delete MenuLBinding; + delete MenuRBinding; + delete MenuCircleBinding; } const char* InputEmulator::GetDisplayName() @@ -72,6 +76,8 @@ namespace TLAC::Components MenuLBinding = new Binding(); MenuRBinding = new Binding(); + MenuCircleBinding = new Binding(); + FileSystem::ConfigFile configFile(framework::GetModuleDirectory(), KEY_CONFIG_FILE_NAME); configFile.OpenRead(); @@ -86,6 +92,7 @@ namespace TLAC::Components Config::BindConfigKeys(configFile.ConfigMap, "JVS_RIGHT", *RightBinding, { "E", "O" }); Config::BindConfigKeys(configFile.ConfigMap, "MENU_L", *MenuLBinding, { "Left", "Up" }); Config::BindConfigKeys(configFile.ConfigMap, "MENU_R", *MenuRBinding, { "Down", "Right" }); + Config::BindConfigKeys(configFile.ConfigMap, "MENU_CIRCLE", *MenuCircleBinding, { "D", "L", "Spacebar" }); mouseScrollPvSelection = configFile.GetBooleanValue("mouse_scroll_pv_selection"); } diff --git a/source-code/source/plugins/TLAC/Components/Input/InputEmulator.h b/source-code/source/plugins/TLAC/Components/Input/InputEmulator.h index 309dfd9..58d5b57 100644 --- a/source-code/source/plugins/TLAC/Components/Input/InputEmulator.h +++ b/source-code/source/plugins/TLAC/Components/Input/InputEmulator.h @@ -34,6 +34,7 @@ namespace TLAC::Components Input::Binding* MenuLBinding; Input::Binding* MenuRBinding; + Input::Binding* MenuCircleBinding; InputEmulator(); ~InputEmulator(); diff --git a/source-code/source/plugins/TLAC/Components/Input/TouchSliderEmulator.cpp b/source-code/source/plugins/TLAC/Components/Input/TouchSliderEmulator.cpp index 94034d0..9d22c6e 100644 --- a/source-code/source/plugins/TLAC/Components/Input/TouchSliderEmulator.cpp +++ b/source-code/source/plugins/TLAC/Components/Input/TouchSliderEmulator.cpp @@ -10,6 +10,7 @@ #include "../../Utilities/Math.h" #include #include +#include "../GameState.h" using namespace TLAC::Input; using namespace TLAC::Input::KeyConfig; @@ -73,7 +74,7 @@ namespace TLAC::Components void TouchSliderEmulator::UpdateInput() { - if (!componentsManager->GetUpdateGameInput() || componentsManager->IsDwGuiActive()) + if (!componentsManager->GetUpdateGameInput() || componentsManager->IsDwGuiActive() || !(*(GameState*)CURRENT_GAME_STATE_ADDRESS == GS_GAME && *(SubGameState*)CURRENT_GAME_SUB_STATE_ADDRESS == SUB_GAME_MAIN)) return; sliderIncrement = GetElapsedTime() / sliderSpeed; diff --git a/source-code/source/plugins/TLAC/Input/KeyConfig/Config.cpp b/source-code/source/plugins/TLAC/Input/KeyConfig/Config.cpp index ad8e3c0..80324b2 100644 --- a/source-code/source/plugins/TLAC/Input/KeyConfig/Config.cpp +++ b/source-code/source/plugins/TLAC/Input/KeyConfig/Config.cpp @@ -76,6 +76,8 @@ namespace TLAC::Input::KeyConfig { "Tab", VK_TAB }, { "Back", VK_BACK }, { "Backspace", VK_BACK }, + { "Space", VK_SPACE }, + { "Spacebar", VK_SPACE }, { "Insert", VK_INSERT }, { "Ins", VK_INSERT }, { "Delete", VK_DELETE },