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)

This commit is contained in:
hap 2017-10-13 22:10:53 +02:00
parent 5eef586447
commit 80a64430a3
2 changed files with 5 additions and 13 deletions

View File

@ -131,8 +131,7 @@ 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.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);
gamepad.z_axis = normalize_absolute_axis(xinput_state.xstate.Gamepad.bLeftTrigger - xinput_state.xstate.Gamepad.bRightTrigger, -255, 255);
}
void xinput_joystick_device::reset()
@ -179,16 +178,10 @@ void xinput_joystick_device::configure()
}
device()->add_item(
"Left Trigger",
"Z",
ITEM_ID_ZAXIS,
generic_axis_get_state<LONG>,
&gamepad.left_trigger);
device()->add_item(
"Right Trigger",
ITEM_ID_RZAXIS,
generic_axis_get_state<LONG>,
&gamepad.right_trigger);
&gamepad.z_axis);
m_configured = true;
}

View File

@ -74,8 +74,7 @@ struct gamepad_state
{
BYTE buttons[XINPUT_MAX_BUTTONS];
BYTE povs[XINPUT_MAX_POV];
LONG left_trigger;
LONG right_trigger;
LONG z_axis;
LONG left_thumb_x;
LONG left_thumb_y;
LONG right_thumb_x;
@ -85,7 +84,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;
};