src/joystick/windows/SDL_windows_gaming_input.c


Log

Author Commit Date CI Message
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