Fix HID WinRaw driver to handle PS4 controller

This commit is contained in:
Thomas Altenburger 2016-01-08 11:43:39 +01:00
parent 32b0c8e985
commit 8488bb6229

View file

@ -80,10 +80,13 @@ namespace OpenTK.Platform.Windows
} }
public void SetAxis(short collection, HIDPage page, short usage, short value) public void SetAxis(short collection, HIDPage page, short usage, short value)
{
if (page == HIDPage.GenericDesktop || page == HIDPage.Simulation) // set axis only when HIDPage is known by HidHelper.TranslateJoystickAxis() to avoid axis0 to be overwritten by unknown HIDPage
{ {
JoystickAxis axis = GetAxis(collection, page, usage); JoystickAxis axis = GetAxis(collection, page, usage);
State.SetAxis(axis, value); State.SetAxis(axis, value);
} }
}
public void SetButton(short collection, HIDPage page, short usage, bool value) public void SetButton(short collection, HIDPage page, short usage, bool value)
{ {
@ -351,6 +354,12 @@ namespace OpenTK.Platform.Windows
{ {
if (caps.LogicalMax == 8) if (caps.LogicalMax == 8)
return (HatPosition)value; return (HatPosition)value;
else if (caps.LogicalMax == 7)
{
value++;
value %= 9;
return (HatPosition)value;
}
else else
return HatPosition.Centered; return HatPosition.Centered;
} }