mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-21 08:28:20 +00:00
Fix: Joysticks with an axis range below zero were inverted
This commit is contained in:
parent
0abd2cc361
commit
bf7e3ffb1e
|
@ -405,12 +405,25 @@ namespace OpenTK.Platform.Windows
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
short scaled_value = (short)HidHelper.ScaleValue(
|
if (stick.AxisCaps[i].LogicalMin > 0)
|
||||||
(int)((long)value + stick.AxisCaps[i].LogicalMin),
|
{
|
||||||
|
short scaled_value = (short) HidHelper.ScaleValue(
|
||||||
|
(int) ((long) value + stick.AxisCaps[i].LogicalMin),
|
||||||
stick.AxisCaps[i].LogicalMin, stick.AxisCaps[i].LogicalMax,
|
stick.AxisCaps[i].LogicalMin, stick.AxisCaps[i].LogicalMax,
|
||||||
Int16.MinValue, Int16.MaxValue);
|
Int16.MinValue, Int16.MaxValue);
|
||||||
stick.SetAxis(collection, page, usage, scaled_value);
|
stick.SetAxis(collection, page, usage, scaled_value);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//If our stick returns a minimum value below zero, we should not add this to our value
|
||||||
|
//before attempting to scale it, as this then inverts the value
|
||||||
|
short scaled_value = (short)HidHelper.ScaleValue(
|
||||||
|
(int)(long)value,
|
||||||
|
stick.AxisCaps[i].LogicalMin, stick.AxisCaps[i].LogicalMax,
|
||||||
|
Int16.MinValue, Int16.MaxValue);
|
||||||
|
stick.SetAxis(collection, page, usage, scaled_value);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue