From fb3ade56b9cf25b12d3f278296baa2e7be59427f Mon Sep 17 00:00:00 2001 From: The Dax Date: Fri, 5 Jul 2013 06:02:47 -0400 Subject: [PATCH] Add option to bind right analog stick to left/right dpad buttons only. Can be useful for games that use the dpad as a camera, and horizontal camera movement is more common than vertical(i.e. Monster Hunter). --- Windows/DinputDevice.cpp | 4 ++++ Windows/XinputDevice.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Windows/DinputDevice.cpp b/Windows/DinputDevice.cpp index cc0222578e..ab3776b5b8 100644 --- a/Windows/DinputDevice.cpp +++ b/Windows/DinputDevice.cpp @@ -237,6 +237,10 @@ int DinputDevice::UpdateState(InputState &input_state) if (js.lZ > rthreshold) input_state.pad_buttons |= PAD_BUTTON_Y; else if (js.lZ < -rthreshold) input_state.pad_buttons |= PAD_BUTTON_A; break; + case 5: + if (js.lRz > rthreshold) input_state.pad_buttons |= PAD_BUTTON_RIGHT; + else if (js.lRz < -rthreshold) input_state.pad_buttons |= PAD_BUTTON_LEFT; + break; } return UPDATESTATE_SKIP_PAD; diff --git a/Windows/XinputDevice.cpp b/Windows/XinputDevice.cpp index c1a25a3c6d..d3939ce4a0 100644 --- a/Windows/XinputDevice.cpp +++ b/Windows/XinputDevice.cpp @@ -199,6 +199,10 @@ void XinputDevice::ApplyDiff(XINPUT_STATE &state, InputState &input_state) { if (state.Gamepad.sThumbRY > rthreshold) input_state.pad_buttons |= PAD_BUTTON_Y; else if (state.Gamepad.sThumbRY < -rthreshold) input_state.pad_buttons |= PAD_BUTTON_A; break; + case 5: + if (state.Gamepad.sThumbRX > rthreshold) input_state.pad_buttons |= PAD_BUTTON_RIGHT; + else if (state.Gamepad.sThumbRX < -rthreshold) input_state.pad_buttons |= PAD_BUTTON_LEFT; + break; } }