diff options
author | hap <happppp@users.noreply.github.com> | 2017-10-17 19:58:26 +0200 |
---|---|---|
committer | hap <happppp@users.noreply.github.com> | 2017-10-17 19:58:38 +0200 |
commit | f407c554596ebdba0bb7166d7d95936f2aa817c5 (patch) | |
tree | 56d4daa3455bcfc793052fa1c9d4836561e9e9c7 /src/osd/modules/input | |
parent | f61a7177661da922de5b772e12b6339866034a2d (diff) |
input: make xinput analog triggers half-axes and default IPT_PEDAL2 to RZ- instead of Z+, placing IPT_PEDAL and IPT_PEDAL2 on separate axes. (nw)
Diffstat (limited to 'src/osd/modules/input')
-rw-r--r-- | src/osd/modules/input/input_xinput.cpp | 14 | ||||
-rw-r--r-- | src/osd/modules/input/input_xinput.h | 10 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/osd/modules/input/input_xinput.cpp b/src/osd/modules/input/input_xinput.cpp index e6ecdd4d177..67348ebe162 100644 --- a/src/osd/modules/input/input_xinput.cpp +++ b/src/osd/modules/input/input_xinput.cpp @@ -130,9 +130,9 @@ void xinput_joystick_device::poll() gamepad.right_thumb_x = normalize_absolute_axis(xinput_state.xstate.Gamepad.sThumbRX, XINPUT_AXIS_MINVALUE, XINPUT_AXIS_MAXVALUE); gamepad.right_thumb_y = normalize_absolute_axis(-xinput_state.xstate.Gamepad.sThumbRY, XINPUT_AXIS_MINVALUE, XINPUT_AXIS_MAXVALUE); - // Now the triggers - gamepad.left_trigger = normalize_absolute_axis(xinput_state.xstate.Gamepad.bLeftTrigger, 0, 255); - gamepad.right_trigger = normalize_absolute_axis(xinput_state.xstate.Gamepad.bRightTrigger, 0, 255); + // Now the triggers, place them on half-axes (negative side) + gamepad.left_trigger = -normalize_absolute_axis(xinput_state.xstate.Gamepad.bLeftTrigger, -255, 255); + gamepad.right_trigger = -normalize_absolute_axis(xinput_state.xstate.Gamepad.bRightTrigger, -255, 255); } void xinput_joystick_device::reset() @@ -179,16 +179,16 @@ void xinput_joystick_device::configure() } device()->add_item( - "Left Trigger", + "RT", ITEM_ID_ZAXIS, generic_axis_get_state<LONG>, - &gamepad.left_trigger); + &gamepad.right_trigger); device()->add_item( - "Right Trigger", + "LT", ITEM_ID_RZAXIS, generic_axis_get_state<LONG>, - &gamepad.right_trigger); + &gamepad.left_trigger); m_configured = true; } diff --git a/src/osd/modules/input/input_xinput.h b/src/osd/modules/input/input_xinput.h index 2cd8f15a250..9772e941bb7 100644 --- a/src/osd/modules/input/input_xinput.h +++ b/src/osd/modules/input/input_xinput.h @@ -62,12 +62,12 @@ static const char *const xinput_button_names[] = { "B", "X", "Y", - "Left Shoulder", - "Right Shoulder", + "LB", + "RB", "Start", "Back", - "Left Thumb", - "Right Thumb" + "LS", + "RS" }; struct gamepad_state @@ -85,7 +85,7 @@ struct gamepad_state // state information for a gamepad; state must be first element struct xinput_api_state { - uint32_t player_index; + uint32_t player_index; XINPUT_STATE xstate; XINPUT_CAPABILITIES caps; }; |