src/joystick/windows/SDL_xinputjoystick.c


Log

Author Commit Date CI Message
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Sam Lantinga cb361896 2020-12-09T07:16:22 Fixed bug 5235 - All internal sources should include SDL_assert.h Ryan C. Gordon We should really stick this in SDL_internal.h or something so it's always available.
Sam Lantinga 1031231b 2020-12-03T18:17:03 Fixed duplicating a device between XInput and HIDAPI
Sam Lantinga 8a449de2 2020-11-27T10:44:47 Fixed Xbox 360 wireless controller being picked up by WGI when it's being managed by RAWINPUT
Sam Lantinga 2931eccd 2020-11-27T05:53:52 Fixed detecting Bluetooth raw input devices, which have device names longer than 128 characters
Sam Lantinga 268aa456 2020-11-23T20:26:28 Fixed compiling with SDL_JOYSTICK_RAWINPUT disabled
Sam Lantinga 5b3616c3 2020-11-23T18:24:05 Generalized the raw input controller driver and moved XInput/WGI detection into it for XInput devices This fixes bad report parsing for various newer Xbox controllers, and this driver is now preferred over XInput, since it handles more than 4 controllers.
Sam Lantinga ac1f174a 2020-06-02T17:02:37 Fixed bug 5167 - Memory leak in GuessXInputDevice meyraud705 Variable 'devices' is not freed if function GuessXInputDevice, in SDL_xinputjoystick.c, return early.
Sam Lantinga b6afbe63 2020-04-07T09:38:57 Added SDL_log.h to SDL_internal.h so logging is available everywhere
Sam Lantinga 4dea340c 2020-03-16T12:23:38 Fixed bug 4477 - Support more than 4 XInput-capable devices on Windows Jimb Esser Add new RawInput controller API, and improved correlation with XInput/WGI Reorder joystick init so drivers can ask the others if they handle a device reliably Do not poll disconnected XInput devices (major perf issue) Fix various cases where incorrect correlation could happen Simple mechanism for propagating unhandled Guide button presses even before guaranteed correlation Correlate by axis motion as well as button presses Fix failing to zero other trigger Fix SDL_HINT_JOYSTICK_HIDAPI not working if set before calling SDL_Init() Add missing device to device names Disable RawInput if we have a mismatch of XInput-capable but not RawInput-capable devices Updated to SDL 2.0.13 code with the following notes: New HID driver: xbox360w - no idea what that is, hopefully urelated SDL_hidapijoystick.c had been refactored to couple data handling logic with device opening logic and device lists caused some problems, yields slightly uglier integration than previously when the 360 HID device driver was just handling the data. SDL_hidapijoystick.c now often pulls the device off of the joystick_hwdata structure for some rumble logic, but it appears that code path is never reached, so probably not a problem. Looks like joystick_hwdata was refactored to not include a mutex in other drivers, maintainers may want to do the same refactor here if that's useful for some reason. Something changed in how devices get names, so getting generic names. Had to fix a (new?) bug where removing an XInput controller caused existing controllers (that moved to a new XInput index) to get identified as 0x045e/0x02fd ("it's probably Bluetooth" in code), rendering the existing HIDAPI_IsDevicePresent and new RAWINPUT_IsDevicePresent unreliable.
Sam Lantinga 80d075a0 2020-03-13T09:43:48 Fixed compiler warnings
Sam Lantinga c44473ba 2020-03-12T19:47:30 Unified code to standardize joystick names
Sam Lantinga 6efebf17 2020-02-04T12:48:53 Moved rumble expiration to the main joystick handling level, and prevent sending the driver layer duplicate rumble requests.
Sam Lantinga 7ea3f5b4 2020-01-26T12:48:35 Fixed bug 4898 - No rumble because of integer overflow in SDL_JoystickRumble meyraud705 Switch hidapi and xinput also need to check for overflow, attached a patch for them.
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Sam Lantinga d000a592 2019-12-21T22:33:21 Fixed windows build
Sam Lantinga 0f529160 2019-12-11T17:47:01 Added custom names for some controllers
Sam Lantinga 65096446 2019-11-20T16:42:50 Improved XInput VID/PID detection and added SDL_wcsstr() and SDL_wcsncmp()
Sam Lantinga 9da4bfc1 2019-10-22T10:57:07 Added support for the Power A Nintendo Switch Enhanced Wireless Controller
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
Sam Lantinga 14329256 2018-10-25T16:53:14 Generalized the XInput user index into a player index
Sam Lantinga 9987ca69 2018-10-25T12:54:42 Added SDL_JoystickGetXInputUserIndex()
Sam Lantinga a2add1f6 2018-08-15T23:14:45 Use the HIDAPI driver for Xbox controllers on Windows, and determine the XInput mapping at runtime for extended functionality like rumble and guide button.
Sam Lantinga 63107524 2018-08-15T19:53:34 Fixed input from the Steam Virtual Gamepad on Mac OS X
Sam Lantinga 99759bac 2018-08-09T16:04:34 There's no controller that's supported by both XInput and HIDAPI
Sam Lantinga 888bf1af 2018-08-09T16:03:50 Worked around bug with Sony PS Now PS3 controller where DirectInput polling will continue to return success after the controller is unplugged. The code is now reliant on SDL_PrivateJoystickAdded() and SDL_PrivateJoystickRemoved() being called correctly when devices are added or removed on Windows
Sam Lantinga d2042e1e 2018-08-09T16:00:17 Added HIDAPI joystick drivers for more consistent support for Xbox, PS4 and Nintendo Switch Pro controller support across platforms. Added SDL_GameControllerRumble() and SDL_JoystickRumble() for simple force feedback outside of the SDL haptics API
Sam Lantinga a8ac5885 2018-03-07T13:30:40 Added SDL_GameControllerMappingForDeviceIndex() to get the mapping for a controller before it's opened
Ethan Lee 6e3d0a13 2018-02-21T12:42:30 Use new XInput mapping for Win10+ (Bugzilla #3960)
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
Sam Lantinga c49fa37c 2017-08-09T11:59:29 Added SDL hints to filter the set of game controllers reported by SDL
Philipp Wiesemann 8eee82cd 2017-02-03T23:30:43 Windows: Fixed warning about unused variable. Found by buildbot.
Sam Lantinga 710ae62a 2017-02-02T17:33:40 Remember XInput controllers that we've already seen, so when the raw device list changes we don't assign the old device to the new XInput userid. This isn't perfect, but at least we won't report the same device twice.
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
David Ludwig d6bcec8f 2016-12-10T15:23:17 WinRT: build fixes These fixes are lumped into two categories: 1. add new file, SDL_dataqueue.c, to UWP/WinRT build-inputs (via MSVC project files) 2. implement a temporary, hack-fix for a build error in SDL_xinputjoystick.c. Win32's Raw Input APIs are, unfortunately, not available for use in UWP/WinRT APIs. There does appear to be a replacement API, available in the Windows.Devices.HumanInterfaceDevice namespace. This fix should be sufficient to get SDL compiling again, without affecting Win32 builds, however using the UWP/WinRT API (in UWP/WinRT builds) would almost certainly be better (for UWP/WinRT builds). TODO: research Windows.Devices.HumanInterfaceDevice, and use that if and as appropriate.
Sam Lantinga 2f6ba615 2016-11-24T12:24:22 Guess the USB VID/PID of XInput devices
Sam Lantinga 27d4f099 2016-10-07T23:40:44 Implemented SDL_GetHintBoolean() to make it easier to check boolean hints
Sam Lantinga 1c2beb21 2016-02-16T13:47:37 Allow using the game controller API with arcade sticks and other XInput devices
Sam Lantinga 42065e78 2016-01-02T10:10:34 Updated copyright to 2016
David Ludwig dc804c0e 2015-11-14T21:29:14 WinRT: fixed build error in latest XInput code This change has also been tested as buildable + runnable on Win32 + MSVC 2015, 2013, 2012, and 2010. It may fix similar build errors (in XInput code) that are appearing in MingW builds (on buildbot).
Sam Lantinga a0c4b56f 2015-09-30T15:39:30 SDL - added new SDL_JoystickCurrentPowerLevel() API that returns the battery level of the selected joystick. Currently only implemented for XInput devices, other platforms are a TODO. CR: Sam
Philipp Wiesemann 0e45984f 2015-06-21T17:33:46 Fixed crash if initialization of EGL failed but was tried again later. The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly uninitialized data structure if loading the library first failed. A later try to use EGL then skipped initialization and assumed it was previously successful because the data structure now already existed. This led to at least one crash in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was dereferenced to make a call to eglBindAPI().
Ryan C. Gordon e90f87ba 2015-05-28T01:08:33 Another attempt to get this to compile.
Ryan C. Gordon 4add1694 2015-05-28T01:02:03 Patched to compile on MingW. (I think!)
Ryan C. Gordon 58447b24 2015-05-28T00:54:52 Move tests from SDL_config higher up in Windows joystick/haptic code. Fixes Bugzilla #2932.
Sam Lantinga 2c4a6ea0 2015-05-26T06:27:46 Updated the copyright year to 2015
Ryan C. Gordon b72938c8 2015-04-20T12:22:44 Windows: Always set the system timer resolution to 1ms by default. An existing hint lets apps that don't need the timer resolution changed avoid this, to save battery, etc, but this fixes several problems in timing, audio callbacks not firing fast enough, etc. Fixes Bugzilla #2944.
Alex Szpakowski fe6c797c 2015-04-10T23:30:31 Fixed an iOS view orientation issue when SDL_GL_CreateContext or SDL_CreateRenderer is called.
Edward Rudd b88ca1b4 2015-02-10T16:28:56 the last parameter of XChangeProperty is the number of elements.. and when the element format is 32.. the element is "long" so we have 5 long elements here. Yes this seems confusing as on mac+linux Long is either 32 or 64bits depending on the architecture, but this is how the X11 protocol is defined. Thus 5 is the correct value for the nelts here. Not 5 or 10 depending on the architecture. More info on the confusion https://bugs.freedesktop.org/show_bug.cgi?id=16802
Philipp Wiesemann b48e54aa 2015-01-26T22:00:29 Fixed bug 2802 - [patch] Fix android build compiling in wrong filesystem implementation Jonas Kulla The configure script didn't differentiate between Linux and Android, unconditionally compiling in the unix implementation of SDL_sysfilesystem.c. I'm probably one of the very few people building SDL for android using classic configure + standalone toolchain, so this has gone undetected all along.
David Ludwig 70438be2 2014-12-03T10:55:23 WinRT: fixed bug whereby SDL would override an app's default orientation WinRT apps can set a default, preferred orientation via a .appxmanifest file. SDL was overriding this on app startup, and making the app use all possible orientations (landscape and portrait). Thanks to Eric Wing for the heads up on this!
Philipp Wiesemann 9c398852 2014-11-22T22:20:40 Corrected header file documentation comment.
Pierre-Loup A. Griffais 24c86b55 2014-09-11T19:24:42 [X11] Reconcile logical keyboard state with physical state on FocusIn since the window system doesn't do it for us like other platforms. This prevents sticky keys and missed keys when going in and out of focus, for example Alt would appear to stick if switching away from an SDL app with Alt-Tab and had to be pressed again. CR: Sam
Sam Lantinga a2d5dd02 2014-07-07T13:19:53 Removed useless assert
Sam Lantinga 1ee96bb9 2014-07-07T10:26:28 Fixed mingw64 build and warnings
Sam Lantinga b79e7f32 2014-07-03T15:39:55 Split the XInput and DirectInput code so Windows RT can use the existing XInput support.