src/joystick


Log

Author Commit Date CI Message
Sam Lantinga de91b124 2017-08-14T06:28:21 Fixed bug 3745 - specify SDLCALL as the calling convention for API callbacks Patches contributed by Ozkan Sezer
Sam Lantinga ca5c3048 2017-08-13T21:06:52 Fixed bug 3744 - missing SDLCALL in several functions Ozkan Sezer The attached patch adds missing SDLCALL to several functions, so that they properly match the headers as intended.
Sam Lantinga ddeaa601 2017-08-13T20:42:41 Fixed bug 3299 - DirectInput: Incorrect joystick mapping when attaching new joysticks Jimb Esser Note: This is using DirectInput, I have to disable XInput as that causes all but the first 4 controllers to be completely ignored by SDL (I can find no way to reconcile XInput devices with DirectInput devices, otherwise I would make a patch that accepts the fifth and later controllers with DirectInput...). XInput does not seem to have the problem below, only DirectInput. I plug in 3 identical wireless Xbox 360 controllers, call them J1, J2, J3. Direct Input shows them as having GUIDs G1, G2, G3. I unplug J1, then J2 and J3 show up as having GUIDs G1 and G2! Not so "unique"... I start my SDL app when just J2 and J3 are plugged in, and open J2 and J3. Then I plug in a new controller, SDL sees that now G3 exists, assigns that a new SDL joystick instance ID, which I request to be opened, but G3 at this point is J3, which I already had opened! So I end up with two instances of J3 opened, and none of J1. "Re-"opening G1 would get the actual handle to the newly attached controller, but there's no current way to know this. This is clearly a bug or poor design in DirectInput or my wireless receiver drivers, but is a showstopping bug for my 8-20 player games (as soon as any one controller runs out of battery or goes to sleep and gets turned back on, suddenly things are busted requiring a restart (or, at least, a reinitialization of all controllers - the game can't go on)). The solution I found is to use HID paths instead of GUIDs to uniquely identify joysticks. GUIDs are still needed to open a controller, however I have added code to re-find the GUIDs for all joysticks whenever a new joystick is attached or removed. This does now require opening of all joysticks (instead of just enumerating them), though if your app, like mine, is opening all of them anyway so that any can press a button to join, that doesn't change much (although perhaps they joysticks should be kept open in this case, instead of closed and re-opened). If your app only ever opens one joystick, this will do more work at startup than it did previously.
Sam Lantinga ea9bc659 2017-08-13T20:39:00 Added check for XBOX in addition to Xbox and X-Box
Sam Lantinga 059d9e46 2017-08-12T17:41:59 Fixed bug 2950 - wrong axes values are set on joystick initialization Edward Rudd Device: Logitech Rumble Gamepad F510 in Xinput mode. Upon opening the joystick the values of the axes are queried via PollAllValues are not actually set on the device all the time. This can easily be seen in the testjoystick or testgamecontroller test programs,as the testjoystick shows all axes in the center until one 'tickles' the triggers., and the testgamecontroller will show the triggers as 'on' until on 'tickles' the triggers. Upon further research the culprit is the SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS hint. In the default value events are ignored until there is an active window, Thus in cases where the joystick system is initialized and controllers opened before the initial window is created & focuses, the initial values will be incorrect. Here is my current workaround in the game I'm working on porting.. SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1"); SDL_GameController* gamepad = SDL_GameControllerOpen(index); SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "0");
Sam Lantinga 0a52db54 2017-08-12T08:15:09 Fixed bug 3191 - haptic system on android? Patch provided by jintiao and Milan Nikolic, thanks!
Sam Lantinga b425050b 2017-08-12T00:04:46 Fixed compiler warnings on Visual Studio 2013
Sam Lantinga af44a595 2017-08-09T20:20:35 Fixed bug 3672 - Add joystick to controllerdb Moritz M-H The following entry needs to be added to the gamecontrollerdb for the Qanba fighter stick under linux
Sam Lantinga 03250690 2017-08-09T12:38:20 Added a private hint for Steam to bypass the controller filtering for the Steam virtual gamepad
Sam Lantinga f15dbc8f 2017-08-09T12:11:59 Fixed Linux build
Sam Lantinga c49fa37c 2017-08-09T11:59:29 Added SDL hints to filter the set of game controllers reported by SDL
Sam Lantinga 4e43c631 2017-08-08T20:38:23 Re-added missing entry for the Steam Virtual Gamepad (was Valve Streaming Gamepad)
Patrice Mandin c544d2b9 2017-08-02T23:42:08 Add support for Saitek P990 Dual Analog Pad
Philipp Wiesemann 84aeab17 2017-07-29T23:00:14 haiku: Changed header paths to be more compatible.
Sam Lantinga 49f846f1 2017-07-11T19:27:50 Added support for an XBox One wired controller for Leo L?nnenm?ki
Philipp Wiesemann 22c221f3 2017-06-11T22:30:58 linux: Changed internal functions to be static.
Philipp Wiesemann 871d43a8 2017-06-08T22:40:09 Removed unused hint includes.
Philipp Wiesemann 4b47fa38 2017-06-04T23:15:47 Removed duplicate includes.
Philipp Wiesemann cc5b4f45 2017-05-12T23:01:17 emscripten: Changed internal functions to be static.
Philipp Wiesemann 60f28484 2017-05-07T21:02:46 haiku: Fixed crash on quit if max number of joysticks was connected.
Sam Lantinga d7cd6537 2017-04-27T15:52:37 Added Steam Controller mappings for Linux and iOS
Sam Lantinga 27023ed2 2017-04-07T03:39:43 Added support for the Cyborg V.3 Rumble Pad and the Mad Catz FightPad PRO
Sam Lantinga 1eb92f63 2017-04-06T06:30:43 Implemented Linux joystick blacklist Based on https://raw.githubusercontent.com/denilsonsa/udev-joystick-blacklist/master/generate_rules.py This fixes a few devices that are not actually joysticks showing up as such in SDL
Sam Lantinga 53f3786b 2017-04-04T08:43:44 Added support for a number of game controllers, including the Nintendo Switch Pro Controller
Sam Lantinga 00da0824 2017-03-23T13:53:09 Updated axis/button mapping for Dualshock 3, for upcoming Sony driver changes
Sam Lantinga 763e1389 2017-03-09T16:09:16 Added an API to get the joystick instance ID before opening the device: SDL_JoystickGetDeviceInstanceID()
Ryan C. Gordon ca0bf151 2017-03-03T16:38:17 Fix some more compiler warnings on armcc.
Sam Lantinga a9762551 2017-02-20T11:02:35 Added config for the Razer Wildcat on Mac OS X
Sam Lantinga 9428ff19 2017-02-17T17:46:58 Added support for the Razer Wildcat on Linux
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 8f78f5bb 2017-02-02T16:56:02 Fixed build on Apple TV
Sam Lantinga be28d7c8 2017-01-31T12:30:55 Added support for the Saitek Pro Flight X-56 Rhino
Sam Lantinga 6717a3d3 2017-01-31T12:23:29 Added support for the HOTAS Warthog throttle
Sam Lantinga a156b0d9 2017-01-31T10:20:09 Added the HOTAS Warthog as a flight stick
Sam Lantinga d0247368 2017-01-27T18:06:50 Sorted controller entries
Sam Lantinga 95ab9dc7 2017-01-27T06:05:50 Added Thrustmaster Wheel FFB entry to the list of wheels
Sam Lantinga 3c90a52a 2017-01-27T05:59:58 Added an API to get the type of a connected joystick
Jessica Stokes aa90b730 2017-01-26T21:25:05 Add a mapping for Xbox Wireless Controllers running old firmware Also updates the naming of these Xbox Wireless Controllers connected via USB (and thus the third-party Xbox Controller Driver) to match. The Xbox Wireless Controller entries are now listed, in order, via USB, bia Bluetooh (with older firmware) and via Bluetooth (with firmware 3.1.1221.0).
Misty De Meo ae5e9a31 2017-01-25T22:24:54 Add gamecontrollerdb mapping for Xbox One S on Mac This is valid for firmware version 3.1.1221.0; earlier versions of the firmware need a different mapping (and have different GUIDs).
Misty De Meo ca89d9b5 2017-01-25T22:22:05 Darwin: fix detection of Xbox One S controller Firmware revision 3.1.1221.0 changes the mapping of the Xbox One S controller in Bluetooth mode. Aside from changing the layout of other buttons, this revision also changes the triggers to act as Accelerator and Brake axes from the simulation controls page. The Darwin sysjoystick code didn't previously map anything at these axes, making it impossible to detect input on these two buttons.
Sam Lantinga 8fa0b088 2017-01-20T08:13:23 Added support for the 8Bitdo Zero GamePad
Sam Lantinga f3540242 2017-01-18T12:19:57 Removed unused variable
Sam Lantinga b0c5ceef 2017-01-18T12:18:50 Fixed bug 3533 - Enumeration joystick devices omitted during directinput enumeration white.magic The logic which decides if a device enumerated via the direct input system in the function EnumJoysticksCallback in SDL_dinputjoystick.c is processed is discarding valid joystick devices due to the assumption that devices of the type DI8DEVTYPE_SUPPLEMENTAL are not valid devices. This change was added with 2.0.4 with this commit http://hg.libsdl.org/SDL/rev/1b9d40126645 that is linked to this bug report https://bugzilla.libsdl.org/show_bug.cgi?id=2460 which indicates that in that case devices of the type DI8DEVTYPE_SUPPLEMENTAL were not desirable as they caused a singular device to emit multiple "device added" events. Since then there appear to have been a few fixes to handle devices that fall into various other classes in the following two commits: http://hg.libsdl.org/SDL/rev/10ffb4787d7a and http://hg.libsdl.org/SDL/rev/6a2bbac05728 Two devices I have reports of failing to be listed when the DI8DEVTYPE_SUPPLEMENTAL type is excluded are ECS Gametric Throttle and Thrustmaster MFD Cougar. Sam Lantinga I verified that the OUYA controller shows up as a single device with this change, so I've reverted the change to ignore supplemental devices, leaving framework in place to easily add devices that we want to ignore.
Sam Lantinga 5cb1ca55 2017-01-18T11:57:27 Fixed building with mingw32
Philipp Wiesemann 1e482095 2017-01-14T21:36:06 Fixed comments.
Ryan C. Gordon 61a3ba30 2017-01-07T17:09:14 Replaced a few single-line "//" comments.
Sam Lantinga 267c9509 2017-01-07T13:47:34 Added mappings for the 8Bitdo NES30 Pro and iBuffalo SNES Controller Also swapped the Wii U Pro controller button mappings to position instead of label, as emulators expect from XBox controllers.
Sam Lantinga e6e6613c 2017-01-05T02:53:29 Fixed build warning on Haiku
Sam Lantinga 4938c505 2017-01-04T10:28:07 Added SDL_JoystickGetAxisInitialState() to get a joystick axis' initial value. This is useful for controller mapping programs to determine an axis' zero state
Sam Lantinga 99e10ef5 2017-01-04T07:06:48 Assume D-pad or thumbstick style axes are centered at 0
Sam Lantinga 26f84d74 2017-01-04T06:21:17 Added mappings for several GameCube and SNES controllers
Sam Lantinga d2a01b6e 2017-01-04T06:19:56 Added the NEXT SNES Controller to the list of zero-centered joysticks
Sam Lantinga c7780497 2017-01-04T05:56:47 Increased joystick jitter tolerance for PS3 controllers
Sam Lantinga 082132a7 2017-01-03T23:39:28 Fixed binding the D-pad on some Super NES style controllers Fixed a case where partial trigger pull could be bound to another button There is a fundamental problem not resolved by this commit: Some controllers have axes (triggers, pedals, etc.) that don't start at zero, but we're guaranteed that if we get a value that it's correct. For these controllers, the current code works, where we take the first value we get and use that as the zero point and generate axis motion starting from that point on. Other controllers have digital axes (D-pad) that assume a zero starting point, and the first value we get is the min or max axis value when the D-pad is moved. For these controllers, the current code thinks that the zero point is the axis value after the D-pad motion and this doesn't work. My hypothesis is that the first class of devices is more common and that we should solve for that, and add an exception to SDL_JoystickAxesCenteredAtZero() as needed for the second class of devices.
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Philipp Wiesemann af263798 2016-12-28T20:10:48 Fixed crash if allocating memory for game controller failed.
Sam Lantinga cb8685c0 2016-12-27T02:04:38 Fixed comment style
Sam Lantinga 6d7da088 2016-12-27T01:39:07 Split controller axes into positive and negative sides so each can be bound independently. Using this a D-Pad can be mapped to a thumbstick and vice versa. Also added support for inverted axes, improving trigger binding support
Sam Lantinga b4e069e7 2016-12-26T02:12:21 Fixed bug 3517 - Compiler warnings with gcc -Wstrict-prototypes felix Compiling even a simple SDL2 'hello world' program with gcc -Wstrict-prototypes (GCC 6.2.1) results in warnings like: /usr/include/SDL2/SDL_gamecontroller.h:143:1: attention : function declaration isn't a prototype [-Wstrict-prototypes] extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(); ^~~~~~ It seems there is a missing 'void' between the parentheses.
Philipp Wiesemann 3e928451 2016-12-23T20:36:24 Windows: Fixed compile error.
Sam Lantinga 4fc0fe1f 2016-12-23T02:23:44 Removed debug print statements
Sam Lantinga ad26769c 2016-12-22T18:43:00 Fixed compile errors on various platforms
Sam Lantinga ca019dad 2016-12-22T17:33:45 Fixed issue where the throttle and other axes on racing wheels don't start at zero and show up as immediate input when the wheel is turned for the first time. Wait until they are actually moved before generating input from them.
Sam Lantinga b4ea63ec 2016-12-14T06:25:09 Fixed crash if there are multiple joysticks closed during the joystick update loop
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 b936a4c3 2016-12-09T04:57:54 Added support for the XiaoMi Game Controller
Sam Lantinga 3b18c796 2016-12-09T01:29:52 Fixed bug 3512 - Memory leak of SDL_Joystick axes_zero array Benjamin Harris Found with valgrind and confirmed in the 2.0.5 source code. One-line fix in SDL_JoystickClose?
Sam Lantinga a5250171 2016-12-08T10:13:45 Protect the game controller API the same way the joystick API is protected from multi-threaded access
Sam Lantinga 1b08f0c1 2016-12-07T11:41:20 Added the guide button for the NVIDIA Shield Controller
Sam Lantinga acabb5d5 2016-12-06T14:22:28 Added support for XBox One controllers on Mac OS X, using the driver at: https://github.com/360Controller/360Controller/releases
Sam Lantinga 264138cc 2016-12-03T08:39:21 Added support for the Hori Fighting Commander 4
Sam Lantinga e7efcfba 2016-12-03T00:40:13 Added Linux mapping for the DragonRise Inc. Generic USB Joystick
Sam Lantinga 26f05ecb 2016-12-02T02:25:12 Fixed missing prototypes on Android, patch from Sylvain
Sam Lantinga a738a6fb 2016-12-01T07:31:08 Added Linux controller mapping for the Nostromo n45 Dual Analog Gamepad
Philipp Wiesemann a7655d77 2016-11-30T23:31:23 Fixed warning about storing an unused value. Found by buildbot.
Sam Lantinga cb8748b7 2016-11-30T12:58:03 Fixed the controller mappings for the OUYA controller
Sam Lantinga 5fcf2577 2016-11-30T12:34:50 Added PS4 controller entries for the new Sony HID driver https://git.kernel.org/cgit/linux/kernel/git/jikos/hid.git/log/?h=for-4.10/sony
Sam Lantinga 663afa91 2016-11-30T12:25:19 Added support for the DS4 USB Wireless Adaptor
Sam Lantinga d834c08a 2016-11-29T22:02:37 Add the controller mappings to the linked list in order
Sam Lantinga dd5d85a4 2016-11-29T06:36:57 Added an API to iterate over game controller mappings
Sam Lantinga 5220759f 2016-11-29T05:04:42 Made it safe to update joysticks from multiple threads, fixes crash in Steam
Sam Lantinga 2f6ba615 2016-11-24T12:24:22 Guess the USB VID/PID of XInput devices
Sam Lantinga e9983c7b 2016-11-24T11:53:23 We are comparing 16-bit values
Sam Lantinga 5232b8e9 2016-11-23T06:54:19 Fixed XBox One S controller mapping for firmware revision 3.1.1221.0, including back and guide buttons
Sam Lantinga aa03b9d7 2016-11-22T22:14:28 The XBox One S controller sends keys outside the standard joystick button range
Sam Lantinga 6558ecdb 2016-11-22T04:42:07 Added mapping for XBox One S controller firmware version 3.1.1221.0
Sam Lantinga 36156335 2016-11-20T21:34:54 Renaming of guard header names to quiet -Wreserved-id-macro Patch contributed by Sylvain
Philipp Wiesemann eb9cc030 2016-11-19T23:27:37 Fixed two memory leaks if added game controller mapping has lower priority. Found by buildbot.
Philipp Wiesemann 97aa5775 2016-11-16T22:08:51 Fixed empty parameter list in signatures of internal functions.
Sam Lantinga 57d01d7d 2016-11-13T22:57:41 Patch from Sylvain to fix clang warnings
Sam Lantinga 23c01c18 2016-11-11T13:29:23 Fixed bug 3079 - Allow non destructive SDL_GameControllerAddMappingsFromFile x414e54 It is a bit of a pain to update the library or rely on whatever version the user has on their computer for default mappings. So providing an easily updatable text file via SDL_GameControllerAddMappingsFromFile is still currently the most viable way. However using this replaces all mappings provided by the SDL_HINT_GAMECONTROLLERCONFIG environment variable which may have come from the user's custom Steam mapping. There should be an easy way for games to supply extra game controller mappings to fill in the differences between SDL versions without it clobbering the SDL_HINT_GAMECONTROLLERCONFIG environment variable. Internally the mappings could use a priority system and if the priority is lower then it will not overwrite the mappings. For now it just assumes SDL_HINT_GAMECONTROLLERCONFIG is the highest priority, the default hardcoded are the lowest and anything set via the API is medium.
Sam Lantinga 160e7194 2016-11-11T04:35:06 Fixed whitespace and added code to support older game controller GUIDs
Sam Lantinga b6542ab2 2016-11-11T04:30:09 Fixed whitespace
Sam Lantinga 47418f2d 2016-11-11T03:35:37 Updated Windows game controller support
Sam Lantinga 801a9eaf 2016-11-11T04:06:00 Updated Mac OS X game controller support
Sam Lantinga 0cc6207c 2016-11-10T18:53:29 Added Linux entries for the Logitech Dual Action game controller
Sam Lantinga ac74e16c 2016-11-10T17:19:34 Standardized the format of the SDL joystick GUID and added functions to retrieve the USB VID/PID from a joystick and game controller.
Sam Lantinga acae3ebf 2016-11-02T02:50:27 Added mapping for the PS3 controller in Bluetooth mode
Sam Lantinga ae8ca7c5 2016-10-17T22:09:22 Fixed bug 3444 - Android-TV: no more handling of back button on remote ny00 Unfortunately, simply checking the return codes of "onNativePadDown/Up" as previously done has its own issue: If an SDL joystick is connected *and* opened, then a proper KeyEvent, say with keycode KEYCODE_BUTTON_1, should lead to an SDL joystick button event as expected. If, however, the joystick was *not* opened, then "onNativePadDown/Up" will return a negative value, so before the commit from bug 3426, you could unexpectedly get a keyboard event. (In practice, you'll just get a log message, since KEYCODE_BUTTON_1 has no mapping to a proper SDL_ScanCode value, but it's still an problem). What should still be done, though, is checking the key code itself. We do have the KeyEvent.isGamepadButton method, but according my test, it returns "true" exactly (and only) for the KEYCODE_BUTTON* values, and not for KEYCODE_DPAD* or any other key code. Here is a possible solution: - Do check the return codes of "onNativePadDown/Up" as previously done. - In addition, in "Android_OnPadDown/Up" from src/joystick/android/SDL_sysjoystick.c, 0 should *always* be returned in case the key code can be translated to an SDL_joystick button; Even if no matching joystick can be found.