From b730916e62996d4f62e4a41a4aafcc2a4c7ae178 Mon Sep 17 00:00:00 2001 From: nastys <@> Date: Sun, 13 Oct 2019 17:32:19 +0200 Subject: [PATCH] Separate menu D-Pad bindings --- appveyor.yml | 2 ++ source-code/data/plugins/keyconfig.ini | 3 +++ .../TLAC/Components/Input/InputEmulator.cpp | 19 +++++++++++++++++++ .../TLAC/Components/Input/InputEmulator.h | 3 +++ 4 files changed, 27 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 57b3209..4dbb127 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -29,6 +29,8 @@ after_build: copy %APPVEYOR_BUILD_FOLDER%\source-code\x64\%CONFIGURATION%\*.dva %TMP%\update\plugins\ copy %APPVEYOR_BUILD_FOLDER%\source-code\data\plugins\ShaderPatch.ini %TMP%\update\plugins\ + + copy %APPVEYOR_BUILD_FOLDER%\source-code\data\plugins\keyconfig.ini %TMP%\update\plugins\ copy %APPVEYOR_BUILD_FOLDER%\source-code\x64\%CONFIGURATION%\dnsapi.dll %TMP%\full\ diff --git a/source-code/data/plugins/keyconfig.ini b/source-code/data/plugins/keyconfig.ini index c41a757..f6de9e8 100644 --- a/source-code/data/plugins/keyconfig.ini +++ b/source-code/data/plugins/keyconfig.ini @@ -33,6 +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 + # Touch Slider: LEFT_SIDE_SLIDE_LEFT = Q, Ds4_L_Stick_Left, XINPUT_LLEFT LEFT_SIDE_SLIDE_RIGHT = E, Ds4_L_Stick_Right, XINPUT_LRIGHT diff --git a/source-code/source/plugins/TLAC/Components/Input/InputEmulator.cpp b/source-code/source/plugins/TLAC/Components/Input/InputEmulator.cpp index e598cc0..a26b38a 100644 --- a/source-code/source/plugins/TLAC/Components/Input/InputEmulator.cpp +++ b/source-code/source/plugins/TLAC/Components/Input/InputEmulator.cpp @@ -12,6 +12,7 @@ #include "../../Utilities/Operations.h" #include "../../Utilities/EnumBitwiseOperations.h" #include "../../FileSystem/ConfigFile.h" +#include "../GameState.h" const std::string KEY_CONFIG_FILE_NAME = "keyconfig.ini"; @@ -67,6 +68,9 @@ namespace TLAC::Components LeftBinding = new Binding(); RightBinding = new Binding(); + MenuLBinding = new Binding(); + MenuRBinding = new Binding(); + FileSystem::ConfigFile configFile(framework::GetModuleDirectory(), KEY_CONFIG_FILE_NAME); configFile.OpenRead(); @@ -79,6 +83,8 @@ namespace TLAC::Components Config::BindConfigKeys(configFile.ConfigMap, "JVS_CIRCLE", *MaruBinding, { "D", "L" }); Config::BindConfigKeys(configFile.ConfigMap, "JVS_LEFT", *LeftBinding, { "Q", "U" }); 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" }); mouseScrollPvSelection = configFile.GetBooleanValue("mouse_scroll_pv_selection"); } @@ -230,6 +236,19 @@ namespace TLAC::Components { JvsButtons buttons = JVS_NONE; + if (!(*(GameState*)CURRENT_GAME_STATE_ADDRESS == GS_GAME && *(SubGameState*)CURRENT_GAME_SUB_STATE_ADDRESS == SUB_GAME_MAIN) && + buttonTestFunc(MenuLBinding)) + { + buttons |= JVS_L; + return buttons; + } + if (!(*(GameState*)CURRENT_GAME_STATE_ADDRESS == GS_GAME && *(SubGameState*)CURRENT_GAME_SUB_STATE_ADDRESS == SUB_GAME_MAIN) && + buttonTestFunc(MenuRBinding)) + { + buttons |= JVS_R; + return buttons; + } + if (buttonTestFunc(TestBinding)) buttons |= JVS_TEST; if (buttonTestFunc(ServiceBinding)) diff --git a/source-code/source/plugins/TLAC/Components/Input/InputEmulator.h b/source-code/source/plugins/TLAC/Components/Input/InputEmulator.h index d962ee0..b795293 100644 --- a/source-code/source/plugins/TLAC/Components/Input/InputEmulator.h +++ b/source-code/source/plugins/TLAC/Components/Input/InputEmulator.h @@ -32,6 +32,9 @@ namespace TLAC::Components Input::Binding* LeftBinding; Input::Binding* RightBinding; + Input::Binding* MenuLBinding; + Input::Binding* MenuRBinding; + InputEmulator(); ~InputEmulator();