Merge pull request #476 from leezer3/develop

Fix: Some joysticks return an invalid HID page of 1
This commit is contained in:
varon 2017-01-30 22:34:22 +02:00 committed by GitHub
commit 0abd2cc361

View file

@ -82,11 +82,16 @@ 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 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
{
//Certain joysticks (Speedlink Black Widow, PS3 pad connected via USB)
//return an invalid HID page of 1, so
if ((int)usage != 1)
{ {
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)
{ {