XInput: Fix mapping triggers to axes

This commit is contained in:
Silent 2020-12-04 17:55:01 +01:00
parent 5575950822
commit 39768edd74
No known key found for this signature in database
GPG Key ID: AE53149BB0C45AF1
1 changed files with 9 additions and 1 deletions

View File

@ -237,7 +237,15 @@ bool XInputControllerInterface::HandleAxisEvent(u32 index, Axis axis, s32 value)
const AxisCallback& cb = m_controllers[index].axis_mapping[static_cast<u32>(axis)][AxisSide::Full];
if (cb)
{
cb(f_value);
// Extend triggers from a 0 - 1 range to a -1 - 1 range for consistency with other inputs
if (axis == Axis::LeftTrigger || axis == Axis::RightTrigger)
{
cb((f_value * 2.0f) - 1.0f);
}
else
{
cb(f_value);
}
return true;
}