From 9308ed99dcf4db9a6a0ff3ea6b423a6be0ba32bf Mon Sep 17 00:00:00 2001 From: AJR Date: Fri, 13 Oct 2017 19:25:43 -0400 Subject: [PATCH] Revert "xinput: the left+right triggers combined are considered the Z Axis, not Z Axis+Z Rotation where the axis resting position was at the middle of the trigger (nw)" The DirectInput Z-axis trigger merger seems more widely considered a bug than a feature, and probably should not be the default MAME behavior. This reverts commit 80a64430a39f306f702766525a093ac1141f7252. --- src/osd/modules/input/input_xinput.cpp | 13 ++++++++++--- src/osd/modules/input/input_xinput.h | 5 +++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/osd/modules/input/input_xinput.cpp b/src/osd/modules/input/input_xinput.cpp index fe5b50ec128..e6ecdd4d177 100644 --- a/src/osd/modules/input/input_xinput.cpp +++ b/src/osd/modules/input/input_xinput.cpp @@ -131,7 +131,8 @@ void xinput_joystick_device::poll() gamepad.right_thumb_y = normalize_absolute_axis(-xinput_state.xstate.Gamepad.sThumbRY, XINPUT_AXIS_MINVALUE, XINPUT_AXIS_MAXVALUE); // Now the triggers - gamepad.z_axis = normalize_absolute_axis(xinput_state.xstate.Gamepad.bLeftTrigger - xinput_state.xstate.Gamepad.bRightTrigger, -255, 255); + 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); } void xinput_joystick_device::reset() @@ -178,10 +179,16 @@ void xinput_joystick_device::configure() } device()->add_item( - "Z", + "Left Trigger", ITEM_ID_ZAXIS, generic_axis_get_state, - &gamepad.z_axis); + &gamepad.left_trigger); + + device()->add_item( + "Right Trigger", + ITEM_ID_RZAXIS, + generic_axis_get_state, + &gamepad.right_trigger); m_configured = true; } diff --git a/src/osd/modules/input/input_xinput.h b/src/osd/modules/input/input_xinput.h index 4083c7f325c..2cd8f15a250 100644 --- a/src/osd/modules/input/input_xinput.h +++ b/src/osd/modules/input/input_xinput.h @@ -74,7 +74,8 @@ struct gamepad_state { BYTE buttons[XINPUT_MAX_BUTTONS]; BYTE povs[XINPUT_MAX_POV]; - LONG z_axis; + LONG left_trigger; + LONG right_trigger; LONG left_thumb_x; LONG left_thumb_y; LONG right_thumb_x; @@ -84,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; };