diff --git a/Source/OpenTK/Platform/Windows/WinRawInput.cs b/Source/OpenTK/Platform/Windows/WinRawInput.cs index 04025efd..08e57201 100644 --- a/Source/OpenTK/Platform/Windows/WinRawInput.cs +++ b/Source/OpenTK/Platform/Windows/WinRawInput.cs @@ -43,7 +43,8 @@ namespace OpenTK.Platform.Windows WinRawKeyboard keyboard_driver; WinRawMouse mouse_driver; - WinMMJoystick joystick_driver; + IGamePadDriver gamepad_driver; + IJoystickDriver2 joystick_driver; IntPtr DevNotifyHandle; static readonly Guid DeviceInterfaceHid = new Guid("4D1E55B2-F16F-11CF-88CB-001111000030"); @@ -138,6 +139,15 @@ namespace OpenTK.Platform.Windows keyboard_driver = new WinRawKeyboard(Parent.Handle); mouse_driver = new WinRawMouse(Parent.Handle); joystick_driver = new WinMMJoystick(); + try + { + gamepad_driver = new XInputJoystick(); + } + catch (Exception e) + { + Debug.Print("[Win] XInput driver not supported, falling back to WinMM"); + gamepad_driver = new MappedGamePadDriver(); + } DevNotifyHandle = RegisterForDeviceNotifications(Parent); } @@ -187,12 +197,12 @@ namespace OpenTK.Platform.Windows public override IGamePadDriver GamePadDriver { - get { return joystick_driver; } + get { return gamepad_driver; } } public override IJoystickDriver2 JoystickDriver { - get { throw new NotImplementedException(); } + get { return joystick_driver; } } #endregion