src/joystick


Log

Author Commit Date CI Message
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.
Philipp Wiesemann c0578f92 2016-10-16T22:46:56 Linux: Removed not needed platform info from entry in controller database.
Sam Lantinga 3f167a5a 2016-10-13T02:19:23 Added support for the PS4 Slim controller, model CUH-ZCT2U
Sam Lantinga 27d4f099 2016-10-07T23:40:44 Implemented SDL_GetHintBoolean() to make it easier to check boolean hints
Sam Lantinga 89abbbfe 2016-10-07T18:24:34 Fixed bug 3438 - SDL_GameControllerEventWatcher: Log on event with value >= k_nMaxReverseEntries
Sam Lantinga 24df68ea 2016-10-07T16:32:58 Fixed bug 2833 - Access Violation on SDL_PollEvent after init, delay and quit of joystick subsystem Jan Klass Not sure if this is limited to the joystick subsystem, but I created a minimal program for reproducibility, which is attached. The issue occurs with my gamepad Razer Onza (an xbox-style gamepad) plugged in. On initialization, the gamepad is being recognized. After quitting the subsystem, the poll will receive the joystick added event, which it instantly handles itself, calling SDL_SYS_JoystickDetect again, which this time calls IDirectInput8_EnumDevices with dinput = NULL (after it was released on quit). This seems to lead to an access violation within said function, which I have no source for.
Sam Lantinga 8bc5c57d 2016-10-07T16:13:37 Fixed recentering triggers when the application doesn't have focus
Sam Lantinga 72164985 2016-10-07T16:04:15 Fixed bug 2823 - Release events for triggers receive wrong centered value Ryochan7 I have been using SDL 2 for a little project that I have been developing for a while. My project is called antimicro and it takes gamepad input and then translates gamepad events into keyboard and mouse events. SDL is used to read the input from an XInput gamepad and it works great for the most part. However, there is one glaring problem that I have encountered. When a device is unplugged and SDL sends the centered value release events for all axes, buttons, and hats, SDL does not use the proper centered value for the triggers. It pushes an SDL_JOYAXISMOTION event onto the queue with a value of 0 for all axes. That value is converted to around 16,000 for a Game Controller. That value is incorrect for triggers and, in my program, that causes any bindings that are assigned to the triggers to get activated. With most profiles, that will typically mean that a mouse right click and left click will be activated before the device is finally seen as removed and then those bindings are released by antimicro.
David Ludwig 3c8a2698 2016-10-01T18:10:50 WinRT: build fix in joystick code
Sam Lantinga 7b34f47e 2016-10-01T14:50:22 Fixed windows build
Sam Lantinga fa0f4176 2016-10-01T14:48:18 Fixed build warnings and errors
Sam Lantinga 64180d22 2016-10-01T14:05:35 Fixed bug 3138 - c_dfDIJoystick2 already defined in dinput8.lib Machiel van Hooren In SDL_dxjoystick.c line 349 there is a constant c_dfDIJoystick2. However, this constant is aparently also defined in dinput8.lib. I encountered a linking error when statically linking to SDL: SDL2_static.lib(SDL_dxjoystick.obj) : error LNK2005: _c_dfDIJoystick2 already defined in dinput8.lib My application is also linking to dinput8.lib because we rolled our own joystick input and are not using the joystick functionality from SDL.
Sam Lantinga c2e25651 2016-10-01T13:02:20 Fixed bug 3424 - SDL_GameController: Increase k_nMaxReverseEntries ny00 On Android, the keycodes KEYCODE_BUTTON_1..16 (actual values 188-203) are translated to SDL_Joystick buttons no. 20-35. These are currently ignored in SDL_gamecontroller.c. The attached patch fixes this, by increasing k_nMaxReverseEntries from 20 to another arbitrary bound of 48. Side-note: Maybe some log should be emitted in case of going over any such bound?
Alex Szpakowski a96b6f21 2016-09-17T01:31:07 Added a new hint SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION. When set to "1", the orientation of the Apple TV remote affects the axes of the corresponding SDL joystick. It is "0" (disabled) by default.
Sam Lantinga 925859aa 2016-09-13T18:43:55 Fixed accidental call to SDL_PrivateJoystickHat()
Alex Szpakowski f0505766 2016-09-13T22:18:06 Initial Apple TV / tvOS support. The Apple TV remote is currently exposed as a joystick with its touch surface treated as two axes. Key presses are also generated when its buttons and touch surface are used. A new hint has been added to help deal with deciding whether to background the app when the remote's menu button is pressed: SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS.
Ryan C. Gordon 35e564a6 2016-08-26T15:46:29 ios: patched to compile.
Sam Lantinga ad1bfea5 2016-08-26T12:18:08 Added SDL_PrivateJoystickAdded() and SDL_PrivateJoystickRemoved() Updated the removal code to iterate over all joystick add messages instead of just the first one.
Sam Lantinga c69bce67 2016-08-26T11:16:44 commit 1170112da3776fdb06425f62d57b63144c33dc51 Author: James Zipperer <james.zipperer@synapse.com> Date: Sun Aug 21 01:19:19 2016 -0700 bugfix for controller / joystick add / remove being in the event queue at the same time
Philipp Wiesemann e79f0009 2016-08-25T22:31:44 Emscripten: Fixed crash if closing removed joystick (thanks, Sylvain!).
Philipp Wiesemann e41e185e 2016-08-25T22:31:33 Android: Fixed crash if closing removed joystick (thanks, Sylvain!). Fixes fix for Bugzilla #3408.
Philipp Wiesemann a1285525 2016-08-17T21:04:50 Emscripten: Fixed opening previously closed joystick.
Philipp Wiesemann c18ff8d2 2016-08-17T21:04:32 Android: Fixed opening previously closed joystick (thanks, Sylvain!). Fixes Bugzilla #3408.
Sam Lantinga 651107a1 2016-08-16T12:02:22 Fixed sorting and name of XBox wireless controller entry
Sam Lantinga 4c148478 2016-08-16T12:02:12 Merged Change: 3576099 from rel/streaming_client Description: SDL - add mapping for xbox one s wireless controller
Sam Lantinga 8097f272 2016-08-08T12:17:53 [ OSX ] enables Xbox One S Guide (System Main Menu) button detection. the one possible impact is that since button identifiers on OSX are just their sequence in the HID report descriptor we might change the button order, and any existing/saved mappings may get their order changed.
Mikkel Krautz a21e6af5 2016-08-06T15:09:20 Add Xbox One controller GUIDs to the XInput filter in the DirectInput joystick driver. The Windows 10 Anniversary Update (1607) breaks the method uses that SDL uses to detect XInput devices. That is, on Windows 10 Anniversary Update, it is no longer possible to query RAWINPUT for HID devices, and check for "IG_" in the device name. Presumably, this will be fixed in the future. This patch works around the issue by adding the Xbox One controller series to the well-known device list. This skips the more expensive RAWINPUT check for those devices, and causes them to be detected as XInput devices once again.
Jonathan Dowland 461336a2 2016-07-01T16:47:27 Add gamecontrollerdb lines for SFC30 controller in various modes SFC30 controller: http://www.8bitdo.com/sfc30/ The SFC30 controller can present itself in a variety of modes and it offers up different names in each. This patch captures data for three modes (one USB and two Bluetooth) on three platforms (Mac OS X, Windows, Linux). However, USB mode on Linux and Windows is missing as the button events did not make it through to SDL's controllermap tool on Fedora 24/Linux 4.5.5 nor Steam Big Picture mode on Windows. The two Bluetooth modes were indistinguishable on Windows. Two modes on OS X were indistinguishable. There exists a similar controller called the SNES30 (And some others) that are very likely identical except for the name, but I have not verified this yet so haven't synthesized lines for those controllers until I can.
Philipp Wiesemann 6ec5e640 2016-06-28T21:08:23 Fixed freeing strings created by strdup() with SDL_free(). This only worked on platforms where SDL_free() wraps free().
Alex Szpakowski 4a468739 2016-05-21T00:20:52 Removed Mac OS 10.5 support (bug #3137). Also fixed a warning about deprecated Carbon code when using SDL_audio (bug #3127, thanks Dominik!)
Ryan C. Gordon 9b4db2b8 2016-04-12T18:11:36 Patched to compile on various platforms.
Ryan C. Gordon c61675dc 2016-04-12T16:45:10 threads: Move SDL's own thread creation to a new internal API. This allows us to set an explicit stack size (overriding the system default and the global hint an app might have set), and remove all the macro salsa for dealing with _beginthreadex and such, as internal threads always set those to NULL anyhow. I've taken some guesses on reasonable (and tiny!) stack sizes for our internal threads, but some of these might turn out to be too small in practice and need an increase. Most of them are simple functions, though.
Ethan Lee 2a754ca7 2016-03-07T08:22:55 Allow mappings to be added before GameControllerInit
Ryan C. Gordon dddd6a5a 2016-02-19T00:28:53 Android: Restored Philipp's joystick change, lost in the previous merge. This patch, specifically: https://hg.libsdl.org/SDL/rev/c0976de9c332
Ryan C. Gordon 03f97117 2016-02-19T00:24:00 Merge Android C89 fixes from Eric Wing.
Sam Lantinga d6699d55 2016-02-17T14:15:37 Added support for the Mad Catz FightStick TE S+ PS3
Sam Lantinga 5c59da2e 2016-02-16T13:51:24 Added support for the Mad Catz FightStick TE S+ PS4
Sam Lantinga 06828577 2016-02-16T13:51:15 Added support for the Akishop Customs PS360+ v1.66 and MadCatz PC USB Wired Stick 8818
Sam Lantinga a38d5b48 2016-02-16T13:48:46 Added support for several Mad Catz arcade sticks
Sam Lantinga 1c2beb21 2016-02-16T13:47:37 Allow using the game controller API with arcade sticks and other XInput devices
Philipp Wiesemann 9cd9925c 2016-02-16T20:32:22 Android: Changed an internal joystick function to return count instead of id. The returned value is currently not used by the caller. The instance id would also not be needed on Java side and providing it just complicated the function. Partially fixes Bugzilla #3234.
Philipp Wiesemann 7da168db 2016-02-10T19:31:23 Fixed spaces in license comments.
Eric Wing 704298c0 2016-02-09T17:36:42 Android: C89 cleanup to avoid warnings/errors since the default gcc mode on Android is still pre-C99.
Sam Lantinga 42065e78 2016-01-02T10:10:34 Updated copyright to 2016
Ryan C. Gordon ce0f90ff 2015-12-29T02:29:56 NetBSD: improved joystick support (thanks, Thomas!). This patch skips non-joystick HID devices and gives joysticks on NetBSD a human readable name. Fixes Bugzilla #3178.
Alex Szpakowski 4ae69e32 2015-12-28T15:44:09 Mac: expose joystick buttons that report themselves as having 'Start' and 'Select' HID usages. I don't know if any joysticks report those usages for any buttons in practice, but other prominent Mac gaming software exposes them, so we might as well too.
Alex Szpakowski cb15bb4c 2015-12-11T16:41:59 iOS: Set the player index of MFi gamepads when the user first presses a button, rather than when it's programatically opened.
Sam Lantinga d1e6a2eb 2015-12-09T12:11:40 Added broad support for wireless XBox 360 controllers on Linux
Edward Rudd 93949534 2015-11-30T10:39:34 Add Logitech F510 Gamepad Direct input mode mapping