From f95c9d1bf3849f98f18f86e2eceb24f10d06b2b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 4 Aug 2017 02:05:08 +0200 Subject: [PATCH] Win32: Fix XInput axis normalization Fixes #1045. --- README.md | 1 + src/win32_joystick.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7fe97897..0954d106 100644 --- a/README.md +++ b/README.md @@ -187,6 +187,7 @@ information on what to include when reporting a bug. - [Win32] Bugfix: Monitors with no display devices were not enumerated (#960) - [Win32] Bugfix: Monitor events were not emitted (#784) - [Win32] Bugfix: The Cygwin DLL was installed to the wrong directory (#1035) +- [Win32] Bugfix: Normalization of axis data via XInput was incorrect (#1045) - [X11] Moved to XI2 `XI_RawMotion` for disable cursor mode motion input (#125) - [X11] Replaced `_GLFW_HAS_XF86VM` compile-time option with dynamic loading - [X11] Bugfix: `glfwGetVideoMode` would segfault on Cygwin/X diff --git a/src/win32_joystick.c b/src/win32_joystick.c index c3a7c767..394d371a 100644 --- a/src/win32_joystick.c +++ b/src/win32_joystick.c @@ -701,10 +701,10 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode) if (mode == _GLFW_POLL_PRESENCE) return GLFW_TRUE; - _glfwInputJoystickAxis(js, 0, (xis.Gamepad.sThumbLX + 0.5f) / 32767.f); - _glfwInputJoystickAxis(js, 1, (xis.Gamepad.sThumbLY + 0.5f) / 32767.f); - _glfwInputJoystickAxis(js, 2, (xis.Gamepad.sThumbRX + 0.5f) / 32767.f); - _glfwInputJoystickAxis(js, 3, (xis.Gamepad.sThumbRY + 0.5f) / 32767.f); + _glfwInputJoystickAxis(js, 0, (xis.Gamepad.sThumbLX + 0.5f) / 32767.5f); + _glfwInputJoystickAxis(js, 1, (xis.Gamepad.sThumbLY + 0.5f) / 32767.5f); + _glfwInputJoystickAxis(js, 2, (xis.Gamepad.sThumbRX + 0.5f) / 32767.5f); + _glfwInputJoystickAxis(js, 3, (xis.Gamepad.sThumbRY + 0.5f) / 32767.5f); _glfwInputJoystickAxis(js, 4, xis.Gamepad.bLeftTrigger / 127.5f - 1.f); _glfwInputJoystickAxis(js, 5, xis.Gamepad.bRightTrigger / 127.5f - 1.f);