mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 06:15:38 +00:00
Merge pull request #1146 from CookiePLMonster/xinput-axis-fix
XInput: Fix mapping triggers to axes
This commit is contained in:
commit
6b147d8a59
|
@ -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];
|
const AxisCallback& cb = m_controllers[index].axis_mapping[static_cast<u32>(axis)][AxisSide::Full];
|
||||||
if (cb)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue