Merge pull request #1146 from CookiePLMonster/xinput-axis-fix

XInput: Fix mapping triggers to axes
This commit is contained in:
Connor McLaughlin 2020-12-06 00:34:56 +10:00 committed by GitHub
commit 6b147d8a59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -236,8 +236,16 @@ 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)
{
// 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;
}