mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 23:55:40 +00:00
Merge pull request #1146 from CookiePLMonster/xinput-axis-fix
XInput: Fix mapping triggers to axes
This commit is contained in:
commit
6b147d8a59
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue