src/joystick


Log

Author Commit Date CI Message
Ryan C. Gordon e99daaf8 2018-01-22T09:45:16 android: Fixed compiler warning about nested '/*' comments.
Sam Lantinga e3cc5b2c 2018-01-03T10:03:25 Updated copyright for 2018
Sam Lantinga fee2469c 2017-12-19T10:48:29 Fixed bug 4005 - Android, SDL_IsGameController() crashes is index is out of range Sylvain On Android, if you give an invalid index to SDL_IsGameController(), it will crash in SDL_SYS_IsDPAD_DeviceIndex().
Sam Lantinga e5cfa241 2017-12-16T10:40:47 Fixed default Android D-PAD mapping so the back button is treated as B
Sam Lantinga 255362a3 2017-12-16T10:40:45 Fixed handling of the Apple TV remote buttons The menu button on the remote is the back button
Sam Lantinga cc30e1eb 2017-12-16T10:40:43 Added support for the ASUS TV500BG Android gamepad
Ethan Lee 688bc285 2017-11-20T13:59:43 Steam Virtual GamePad config for macOS
Sam Lantinga c954b538 2017-11-02T08:48:14 Fixed bug 3935 - Not find joysticks if android run 24-48 days. Alexander Orefkov In src\joystick\android\SDL_sysjoystick.c in SDL_SYS_JoystickDetect when SDL_GetTicks return number grater 2147483648 (after 24.85 days uptime) SDL_TICKS_PASSED(SDL_GetTicks(), timeout) return FALSE and Android_JNI_PollInputDevices is never calling. And in JoystickByDeviceId - when search for newly added joystic - after SDL_SYS_JoystickDetect item not reinitilized, and always stay NULL, cause return NULL instead of added joystick.
Sam Lantinga a7d2d12c 2017-11-01T10:07:04 Fixed building on non-Android platforms
Sam Lantinga a90be440 2017-11-01T10:06:58 Added controller mapping for Android TV remotes Also fixed the back button on the remote exiting the application
Sam Lantinga 556a8544 2017-10-16T15:22:40 Fixed compiler warning on iOS
Sam Lantinga b647bd06 2017-10-10T17:41:41 The event filter and event watch functions are now thread-safe
Sam Lantinga d90fce3c 2017-10-10T11:10:15 Exposed the joystick locking functions for multi-threaded access to the joystick API
Sam Lantinga 2657dfae 2017-10-09T11:45:15 Fixed crash in SDL_IsGameController() on Windows if called when a controller is being removed
Sam Lantinga b120fb87 2017-10-08T10:59:03 Fixed bug 3865 - [PATCH] Support for GreenAsia Inc. PSX to USB converter as SDL_GameController Manuel I would like this small patch merged that adds support for my GreenAsia Inc. PSX to USB converter, so SDL_IsGameController() returns true when using this adaptor. It's interesting because PSX/PS2 controllers connected using this model won't be detected as gamecontrollers otherwise, only as joysticks.
Sam Lantinga 5ab5c9b7 2017-09-22T08:56:09 Avoid duplicate joystick axis events
Sam Lantinga 2fd52351 2017-09-22T08:32:31 Added stubs for simple Steam Controller support
Sam Lantinga d8286479 2017-09-22T08:30:52 Added stubs for simple Steam Controller support
Sam Lantinga eaab6098 2017-09-21T10:29:17 Only apply the jitter filter to prevent unexpected motion on axes that haven't been touched.
Patrice Mandin 46ec1305 2017-09-14T21:45:14 Fix for 3829. Revert adding GameSir G4s, uses same GUID as PS3 controller.
Patrice Mandin 73c85e98 2017-09-14T19:33:32 Readd support for GameSir G4s, lost with changeset 11431
Sam Lantinga ac782d71 2017-09-12T05:53:47 Added support for the PDP Battlefield One Xbox One controller on Linux
Sam Lantinga 0ddac338 2017-09-08T07:15:47 keep joystick thread from waking unnecessarily, and from possibly blocking for 300ms at shutdown if a joystick was just plugged in CR: SamL
Alex Szpakowski 20207abf 2017-08-31T22:07:28 macOS: Update controller mapping of Steelseries Stratus XL to account for reversed thumbstick y-axis values (bug #3483).
Sam Lantinga b54bcb34 2017-08-30T23:30:24 Fixed bug 3483 - Steelseries Nimbus MFi controller reversed Y-axis analog stick benjamin.feng Probable underlying cause: https://bugzilla.libsdl.org/show_bug.cgi?id=3124#c5 "If you download and build the HID Calibrator sample you can see that these are totally legitimate HID devices (except for inverting the Y-axis of joysticks, which is contrary to the HID specification but does make them more compatible with games compiled expecting XBOX controllers)."
Sam Lantinga 8e160a34 2017-08-30T23:02:39 Convert tabs to spaces in game controller database entries
Sam Lantinga 2a945b44 2017-08-28T10:03:39 Fixed bug 2361 - [Android] Joysticks do not have unique IDs David Brady When I attempted to make a mapping file for Android gamepads, I quickly discovered that most of the ones that I have here show up as the same device (Broadcom Bluetooth HID), meaning that it was impossible to make mappings on Android, since every device looked the same. This patch will check for the existence of the getDescriptor function added in Jelly Bean, and use it if it's there. The Android Dashboard says that the majority of Android phones should support this function, and doing it this way will not force us to bump up our API version.
Sam Lantinga 0d011ec6 2017-08-28T00:22:23 Renaming of guard header names to quiet -Wreserved-id-macro
Patrice Mandin bbd9acdd 2017-08-26T21:20:20 Add support for GameSir G4s
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