Skip to content

Commit

Permalink
Add another DPAD Shifting method R3 + Left Joystick
Browse files Browse the repository at this point in the history
  • Loading branch information
wdoo02 committed Jan 11, 2024
1 parent 54990a2 commit 7cca8b8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/mods/VR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
4 changes: 3 additions & 1 deletion src/mods/VR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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) };
Expand Down

0 comments on commit 7cca8b8

Please sign in to comment.