From 7cca8b89665e333d18e1fbea44e31ad3a7e5a0d4 Mon Sep 17 00:00:00 2001 From: wdoo02 Date: Thu, 11 Jan 2024 21:50:12 +0800 Subject: [PATCH] Add another DPAD Shifting method R3 + Left Joystick --- src/mods/VR.cpp | 11 ++++++++--- src/mods/VR.hpp | 4 +++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/mods/VR.cpp b/src/mods/VR.cpp index 804d5bd3..d9200bb4 100644 --- a/src/mods/VR.cpp +++ b/src/mods/VR.cpp @@ -869,13 +869,13 @@ void VR::on_xinput_get_state(uint32_t* retval, uint32_t user_index, XINPUT_STATE button_touch_inactive = !is_action_active_any_joystick(m_action_a_button_touch_left) && !is_action_active_any_joystick(m_action_b_button_touch_left); } - const auto dpad_active = (button_touch_inactive && thumbrest_check) || dpad_method == DPadMethod::LEFT_JOYSTICK || dpad_method == DPadMethod::RIGHT_JOYSTICK; + const auto dpad_active = (is_right_joystick_click_down && (dpad_method == DPadMethod::RIGHT_R3) && (! is_left_joystick_click_down)) || (button_touch_inactive && thumbrest_check) || dpad_method == DPadMethod::LEFT_JOYSTICK || dpad_method == DPadMethod::RIGHT_JOYSTICK; if (dpad_active) { SHORT ThumbY{0}; SHORT ThumbX{0}; // If someone is accidentally touching both thumbrests while also moving a joystick, this will default to left joystick. - if (dpad_method == DPadMethod::RIGHT_TOUCH || dpad_method == DPadMethod::LEFT_JOYSTICK) { + if (dpad_method == DPadMethod::RIGHT_TOUCH || dpad_method == DPadMethod::LEFT_JOYSTICK || dpad_method == DPadMethod::RIGHT_R3) { ThumbY = state->Gamepad.sThumbLY; ThumbX = state->Gamepad.sThumbLX; } @@ -900,7 +900,12 @@ void VR::on_xinput_get_state(uint32_t* retval, uint32_t user_index, XINPUT_STATE state->Gamepad.wButtons |= XINPUT_GAMEPAD_DPAD_LEFT; } - if (dpad_method == DPadMethod::RIGHT_TOUCH || dpad_method == DPadMethod::LEFT_JOYSTICK) { + if(dpad_method == DPadMethod::RIGHT_R3) + { + state->Gamepad.wButtons &= ~XINPUT_GAMEPAD_RIGHT_THUMB; + } + + if (dpad_method == DPadMethod::RIGHT_TOUCH || dpad_method == DPadMethod::LEFT_JOYSTICK || dpad_method == DPadMethod::RIGHT_R3) { state->Gamepad.sThumbLY = 0; state->Gamepad.sThumbLX = 0; } diff --git a/src/mods/VR.hpp b/src/mods/VR.hpp index 3340d1b8..20c454ad 100644 --- a/src/mods/VR.hpp +++ b/src/mods/VR.hpp @@ -50,6 +50,7 @@ class VR : public Mod { LEFT_TOUCH, LEFT_JOYSTICK, RIGHT_JOYSTICK, + RIGHT_R3 }; static const inline std::string s_action_pose = "/actions/default/in/Pose"; @@ -744,7 +745,8 @@ class VR : public Mod { "Right Thumbrest + Left Joystick", "Left Thumbrest + Right Joystick", "Left Joystick (Disables Standard Joystick Input)", - "Right Joystick (Disables Standard Joystick Input)" + "Right Joystick (Disables Standard Joystick Input)", + "Right Joystick Press + Left Joystick (Disables R3)" }; const ModCombo::Ptr m_rendering_method{ ModCombo::create(generate_name("RenderingMethod"), s_rendering_method_names) };