summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Brad Hughes <bradhugh@outlook.com>2016-04-06 09:44:02 -0400
committer Brad Hughes <bradhugh@outlook.com>2016-04-06 09:44:02 -0400
commita0ba9bc8c742bcd41a135fec2e92c2e98a081a7c (patch)
tree55e577ee38f0dab1a56633586a8f831509a22d3b /src
parent69f5a2dcc82d18ad80c9dec31d83fb266d3bc337 (diff)
Make Xinput triggers analog
Diffstat (limited to 'src')
-rw-r--r--src/osd/modules/input/input_xinput.cpp12
-rw-r--r--src/osd/modules/input/input_xinput.h4
2 files changed, 8 insertions, 8 deletions
diff --git a/src/osd/modules/input/input_xinput.cpp b/src/osd/modules/input/input_xinput.cpp
index 753fd49a729..bee464054f1 100644
--- a/src/osd/modules/input/input_xinput.cpp
+++ b/src/osd/modules/input/input_xinput.cpp
@@ -155,8 +155,8 @@ void xinput_joystick_device::poll()
gamepad.sThumbRY = normalize_absolute_axis(xinput_state.xstate.Gamepad.sThumbRY * -1, XINPUT_AXIS_MINVALUE, XINPUT_AXIS_MAXVALUE);
// Now the triggers
- gamepad.bLeftTrigger = xinput_state.xstate.Gamepad.bLeftTrigger;
- gamepad.bRightTrigger = xinput_state.xstate.Gamepad.bRightTrigger;
+ gamepad.bLeftTrigger = normalize_absolute_axis(xinput_state.xstate.Gamepad.bLeftTrigger, 0, 0xFF);
+ gamepad.bRightTrigger = normalize_absolute_axis(xinput_state.xstate.Gamepad.bRightTrigger, 0, 0xFF);
}
void xinput_joystick_device::reset()
@@ -204,14 +204,14 @@ void xinput_joystick_device::configure()
device()->add_item(
"Left Trigger",
- static_cast<input_item_id>(ITEM_ID_BUTTON1 + XINPUT_MAX_BUTTONS),
- generic_button_get_state,
+ ITEM_ID_OTHER_AXIS_ABSOLUTE,
+ generic_axis_get_state,
&gamepad.bLeftTrigger);
device()->add_item(
"Right Trigger",
- static_cast<input_item_id>(ITEM_ID_BUTTON1 + XINPUT_MAX_BUTTONS + 1),
- generic_button_get_state,
+ ITEM_ID_OTHER_AXIS_ABSOLUTE,
+ generic_axis_get_state,
&gamepad.bRightTrigger);
m_configured = true;
diff --git a/src/osd/modules/input/input_xinput.h b/src/osd/modules/input/input_xinput.h
index 0a0e4ed0266..81ef71ce03f 100644
--- a/src/osd/modules/input/input_xinput.h
+++ b/src/osd/modules/input/input_xinput.h
@@ -72,8 +72,8 @@ struct gamepad_state
{
BYTE rgbButtons[XINPUT_MAX_BUTTONS];
BYTE rgbPov[XINPUT_MAX_POV];
- BYTE bLeftTrigger;
- BYTE bRightTrigger;
+ LONG bLeftTrigger;
+ LONG bRightTrigger;
LONG sThumbLX;
LONG sThumbLY;
LONG sThumbRX;