src/joystick/windows/SDL_windows_gaming_input.c


Log

Author Commit Date CI Message
Sam Lantinga d2c4d74d 2022-05-27T15:49:35 Fixed build with MinGW-64 windows.devices.power.h The MinGW-64 header defines the parameters as ABI::Windows::Foundation::IReference<INT32 > **, but the Windows header defines the parameters as __FIReference_1_int**
Sam Lantinga bd22ca76 2022-05-27T15:40:50 Revert "Workaround for compiling with MinGW-w64" This reverts commit efdf43aa9b4f4d623ffba01f503d9793d5021330. The broken mingw headers aren't in an official release yet, so reporting this upstream.
Sam Lantinga efdf43aa 2022-05-27T15:34:45 Workaround for compiling with MinGW-w64 Fixes bug https://github.com/libsdl-org/SDL/issues/5589
Sam Lantinga e551384a 2022-04-26T14:54:14 Added functions to get the platform dependent name for a joystick or game controller
Cameron Gutman 145824f6 2022-04-21T01:38:53 WGI: Only call RoUninitialize() if RoInitialize() succeeded
Cameron Gutman 00b2e10a 2022-04-20T20:58:29 WGI: Keep a reference to the MTA to avoid crashing on COM teardown Fixes #5552 Fixes #5270
Sam Lantinga 8ebef12d 2022-04-01T14:58:33 Use RoInitialize/RoUninitialize for Windows.Gaming.Input Thanks @walbourn! Fixes https://github.com/libsdl-org/SDL/issues/5270
Sam Lantinga 006aafab 2022-03-22T20:23:09 Fixed freeing a constant string (thanks @gnrlwart)
Sam Lantinga b22ce2b5 2022-03-17T17:10:40 Workaround for bug in Microsoft WGI support Fixes https://github.com/libsdl-org/SDL/issues/5270
Ryan C. Gordon 43f0271b 2022-01-24T08:56:33 Revert "fix compiler warnings in SDL_windows_gaming_input.c" This reverts commit ca36cdb185f2f26241598068927821896f36b904. The older Windows SDK's headers are wrong, and this change would crash if you hotplug a device.
pionere d7110b44 2022-01-08T12:07:16 fix compiler warnings in SDL_windows_gaming_input.c
Sam Lantinga 120c76c8 2022-01-03T09:40:00 Updated copyright for 2022
Sam Lantinga dd2f9111 2021-11-27T20:18:29 Fixed warnings with Windows SDK 10.0.19041 Fixes https://github.com/libsdl-org/SDL/issues/4998 Also breaks https://github.com/libsdl-org/SDL/issues/4998 for older SDKs, but we're going to ignore them, they're just incorrect.
Sam Lantinga c2904c8c 2021-11-27T11:16:15 Fixed compile warnings and errors Fixes https://github.com/libsdl-org/SDL/issues/4998
Sam Lantinga 09b7ca27 2021-11-27T10:53:20 Get the current WGI controller list at startup On Win32 this list is empty and we always get controller added events. On UWP, this list is populated and we don't get controlle added events for currently connected controllers.
Sam Lantinga 12895eca 2021-11-27T10:52:58 Fixed WGI initialization on Win32
Sam Lantinga 110e4e13 2021-11-27T10:24:32 Use WGI instead of XInput for Windows 10 UWP apps Fixes https://github.com/libsdl-org/SDL/issues/5017
Sam Lantinga 2ca2ad76 2021-11-26T10:13:45 Fixed build warnings
Ozkan Sezer 3eb9bfac 2021-11-14T22:22:50 win32 rawinput & wgi joystick: avoid -Werror=declaration-after-statement
Cameron Gutman afccabb8 2021-11-11T12:12:05 joystick: Add capability flags for rumble and trigger rumble When API limitations force us to guess, we favor a false positive (reporting support when it doesn't exist) compared to a false negative.
Cameron Gutman 1ccfbf96 2021-11-11T11:13:08 joystick: Convert HasLED() into a generic GetCapabilities() function
Cameron Gutman f6dc47ca 2021-11-07T16:00:47 WGI/DInput: Fix SDL_IsXInputDevice() checks when RawInput is enabled Enabling the RawInput backend causes SDL_XINPUT_Enabled() to return false. That causes WGI and DInput backends to take ownership of XInput-compatible controllers, because they think there's no XInput-specific backend enabled. In WGI's case, it will actually race with RawInput to open the device. By properly excluding XInput devices from WGI, we can ensure that the sets of devices managed by WGI and RawInput don't intersect. This makes the race harmless, since they'll never both go after the same device.
Cameron Gutman b3e909dc 2021-11-07T13:51:34 WGI: Fix SDL_IsXInputDevice() for Xbox One controllers The Xbox One driver stack doesn't propagate the VID/PID down to the HID devices that end up in the GetRawInputDeviceList() output. This means we end up matching against the wrong VID/PID and can't properly exclude Xbox One controllers from WGI. Fortunately, it is possible to walk back up the device tree to find the parent with the matching VID/PID.
Cameron Gutman 6312aaea 2021-11-06T21:52:22 WGI: Add workaround for delayed callbacks after WGI_JoystickQuit()
Sam Lantinga 02223501 2021-08-02T16:40:58 Fixed crash if WGI didn't give us the name for a controller
Sam Lantinga 9d457aa4 2021-07-29T14:24:40 Don't uninitialize COM because of what appears to be a bug in Microsoft WGI reference counting. This fixes https://github.com/libsdl-org/SDL/issues/4488
Sam Lantinga d135c076 2021-07-08T13:22:41 Added SDL_GameControllerSendEffect() and SDL_JoystickSendEffect() to allow applications to send custom effects to the PS4 and PS5 controllers See testgamecontroller.c for an example of a custom PS5 trigger effect
Ozkan Sezer a594b850 2021-01-04T10:00:30 use WIN_StringToUTF8W macro instead of WIN_StringToUTF8, where needed: i.e. where the string is known guaranteed to be WCHAR*, in: - SDL_dinputjoystick.c (WIN_IsXInputDevice): VARIANT->var is BSTR (WCHAR*) - SDL_rawinputjoystick.c (RAWINPUT_AddDevice): string is WCHAR* - SDL_windows_gaming_input.c (IEventHandler_CRawGameControllerVtbl_InvokeAdded): string is WCHAR* There should be more of these..
Ozkan Sezer 398d2764 2021-01-04T01:23:50 RAWINPUT_InitWindowsGamingInput: change pNamespace from LPTSTR to PCWSTR because WindowsCreateStringReference specifically accepts const WCHAR * - WGI_JoystickInit(): ditto. cf. bug #5435.
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Sam Lantinga 797a6910 2020-12-09T20:28:51 Fixed bug 5375 - WGI: Fix HSTRING memory leak. Joel Linn TLDR; https://godbolt.org/z/43fd8G Let's deduce this from C++ reference code: https://docs.microsoft.com/en-us/cpp/cppcx/wrl/how-to-activate-and-use-a-windows-runtime-component-using-wrl?view=msvc-160 At the bottom of the page there is this snippet: ``` int wmain() { /* ... more code ... */ // Get the domain part of the URI. HString domainName; hr = uri->get_Domain(domainName.GetAddressOf()); if (FAILED(hr)) { return PrintError(__LINE__, hr); } // Print the domain name and return. wprintf_s(L"Domain name: %s\n", domainName.GetRawBuffer(nullptr)); // All smart pointers and RAII objects go out of scope here. } ``` `HString` is defined in `corewrappers.h` and the call chain for the destructor is: `~HString() -> Release() -> ::WindowsDeleteString()` QED
Sam Lantinga f2fff217 2020-12-09T06:24:40 Fixed bug 5374 - WGI: Use fast-pass strings. Joel Linn Eliminate additional heap allocation for short-lived HSTRINGs. Uses `WindowsCreateStringReference()` to disable reference counting and memory management by the Window Runtime.
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 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 fcb21aa8 2020-11-17T10:30:20 Added API for sensors on game controllers Added support for the PS4 controller gyro and accelerometer on iOS and HIDAPI drivers Also fixed an issue with the accelerometer on iOS having inverted axes
Sam Lantinga 502cfe31 2020-11-11T19:39:46 Fixed bug 5332 - WGI: Fix wrong level of indirection and implicit truncating cast. Joel Linn This fixes two types of MSVC compiler warnings. - One parameter in the function signatures of two WGI event handlers had one level of indirection too much (and did not match Windows SDK headers). The indirection was cast away so it still worked. - size_t was implicitly cast to UINT32 for a number of (constant) string lengths.
Sam Lantinga 1e2caac5 2020-11-11T18:57:37 Added SDL_JoystickRumbleTriggers() and SDL_GameControllerRumbleTriggers()
Sam Lantinga 4ea1a10b 2020-11-07T02:49:22 Added stub controller LED functions for WGI and RAWINPUT (thanks meyraud!)
Sam Lantinga 345b4d7e 2020-05-29T13:37:21 Fixed bug 5161 - Autodetect controller mappings based on the Linux Gamepad Specification Jan Bujak I wrote a new driver for my gamepad on Linux. I'd like SDL to support it out-of-box, as currently it just treats it as a generic joystick instead of a gamepad. From what I can see the only way to do that is to either 1) pick one of the already supported controllers' PID, VID and button layouts and have my driver send that (effectively lying that it's something else), or 2) submit a preconfigured, hardcoded mapping to SDL. Both of those, in my opinion, are silly when we already have the Linux Gamepad Specification which standarizes this: https://www.kernel.org/doc/html/v4.15/input/gamepad.html Unfortunately SDL doesn't make use of it currently. So I've took it upon myself to add it; patch is in the attachments. Basically what the patch does is that if SDL finds no built-it controller mappings for a given joystick it then asks the joystick backend to autodetect it, and that uses the relevant evdev bits to figure out which button/axis is which. (See the specs for more details.) With this patch applied my own driver for my controller works out-of-box with SDL with no extra configuration and is correctly recognized as a gamepad; this is also going to be the case for any other driver which follows the Linux Gamepad Specification.
Sam Lantinga 01fd8130 2020-04-23T11:13:02 Fixed compiler warning
Sam Lantinga 4727f794 2020-04-23T10:13:17 Don't use the WGI driver if another driver is already handling the joystick
Sam Lantinga 6ca7f510 2020-04-23T09:35:32 Fixed crash trying to get battery status on some devices
Sam Lantinga aba27928 2020-04-18T21:41:37 Added a Windows Gaming Input joystick driver This driver supports the Razer Atrox Arcade Stick Some of the quirks of this driver, inherent in Windows Gaming Input: * There will never appear to be controllers connected at startup. You must support hot-plugging in order to see these controllers. * You can't read the state of the guide button * You can't get controller events in the background