src/joystick/SDL_gamecontroller.c


Log

Author Commit Date CI Message
Ryan C. Gordon ca0bf151 2017-03-03T16:38:17 Fix some more compiler warnings on armcc.
Philipp Wiesemann 1e482095 2017-01-14T21:36:06 Fixed comments.
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.
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 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 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
Philipp Wiesemann eb9cc030 2016-11-19T23:27:37 Fixed two memory leaks if added game controller mapping has lower priority. Found by buildbot.
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 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 89abbbfe 2016-10-07T18:24:34 Fixed bug 3438 - SDL_GameControllerEventWatcher: Log on event with value >= k_nMaxReverseEntries
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.
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?
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
Ethan Lee 2a754ca7 2016-03-07T08:22:55 Allow mappings to be added before GameControllerInit
Sam Lantinga 42065e78 2016-01-02T10:10:34 Updated copyright to 2016
Sam Lantinga d1e6a2eb 2015-12-09T12:11:40 Added broad support for wireless XBox 360 controllers on Linux
Ryan C. Gordon e6ad29ae 2015-11-14T12:35:45 Added SDL_JoystickFromInstanceID() and SDL_GameControllerFromInstanceID().
Philipp Wiesemann 0e45984f 2015-06-21T17:33:46 Fixed crash if initialization of EGL failed but was tried again later. The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly uninitialized data structure if loading the library first failed. A later try to use EGL then skipped initialization and assumed it was previously successful because the data structure now already existed. This led to at least one crash in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was dereferenced to make a call to eglBindAPI().
Sam Lantinga 2c4a6ea0 2015-05-26T06:27:46 Updated the copyright year to 2015
Sam Lantinga 094c4a16 2015-05-13T22:37:26 Added generic xinput fallback for XBox compatible controllers on Linux
Ryan C. Gordon b72938c8 2015-04-20T12:22:44 Windows: Always set the system timer resolution to 1ms by default. An existing hint lets apps that don't need the timer resolution changed avoid this, to save battery, etc, but this fixes several problems in timing, audio callbacks not firing fast enough, etc. Fixes Bugzilla #2944.
Alex Szpakowski fe6c797c 2015-04-10T23:30:31 Fixed an iOS view orientation issue when SDL_GL_CreateContext or SDL_CreateRenderer is called.
Edward Rudd b88ca1b4 2015-02-10T16:28:56 the last parameter of XChangeProperty is the number of elements.. and when the element format is 32.. the element is "long" so we have 5 long elements here. Yes this seems confusing as on mac+linux Long is either 32 or 64bits depending on the architecture, but this is how the X11 protocol is defined. Thus 5 is the correct value for the nelts here. Not 5 or 10 depending on the architecture. More info on the confusion https://bugs.freedesktop.org/show_bug.cgi?id=16802
Philipp Wiesemann b48e54aa 2015-01-26T22:00:29 Fixed bug 2802 - [patch] Fix android build compiling in wrong filesystem implementation Jonas Kulla The configure script didn't differentiate between Linux and Android, unconditionally compiling in the unix implementation of SDL_sysfilesystem.c. I'm probably one of the very few people building SDL for android using classic configure + standalone toolchain, so this has gone undetected all along.
Ryan C. Gordon fe40a172 2014-12-18T00:19:52 Initial merge of Emscripten port! With this commit, you can compile SDL2 with Emscripten ( http://emscripten.org/ ), and make your SDL-based C/C++ program into a web app. This port was due to the efforts of several people, including: Charlie Birks, Sathyanarayanan Gunasekaran, Jukka Jyl?nki, Alon Zakai, Edward Rudd, Bruce Mitchener, and Martin Gerhardy. (Thanks, everyone!)
David Ludwig 70438be2 2014-12-03T10:55:23 WinRT: fixed bug whereby SDL would override an app's default orientation WinRT apps can set a default, preferred orientation via a .appxmanifest file. SDL was overriding this on app startup, and making the app use all possible orientations (landscape and portrait). Thanks to Eric Wing for the heads up on this!
Philipp Wiesemann 9c398852 2014-11-22T22:20:40 Corrected header file documentation comment.
Philipp Wiesemann 7268eabb 2014-10-26T23:28:45 Added handling of NULL as input for SDL_GameControllerAddMapping().
Philipp Wiesemann 33a2b58c 2014-10-26T23:22:53 Fixed SDL_GameControllerMappingForGUID() crashing if no more memory available. The return value of SDL_malloc() was not checked and NULL therefore not handled. NULL returned by SDL_GameControllerMapping()/SDL_GameControllerMappingForGUID() now either means "no mapping" (as before) or "no memory" (just crashed before).
Philipp Wiesemann 30d6cec1 2014-10-26T17:53:16 Added handling of NULL as input for SDL_GameControllerMapping(). For consistency with the similar functions getting SDL_GameController as input. Also NULL is no SDL_GameController and therefore can not have a mapping anyway.
Philipp Wiesemann 90387daf 2014-10-26T17:46:11 Removed two wrong documentation comments from gamecontroller source. No replacement because correct documentation is already in SDL_gamecontroller.h.
Philipp Wiesemann 0a053ed6 2014-10-26T17:44:00 Fixed wording in SDL_GameControllerAddMappingsFromRW() error message.
Pierre-Loup A. Griffais 24c86b55 2014-09-11T19:24:42 [X11] Reconcile logical keyboard state with physical state on FocusIn since the window system doesn't do it for us like other platforms. This prevents sticky keys and missed keys when going in and out of focus, for example Alt would appear to stick if switching away from an SDL app with Alt-Tab and had to be pressed again. CR: Sam
Sam Lantinga 1ee96bb9 2014-07-07T10:26:28 Fixed mingw64 build and warnings
Sam Lantinga b79e7f32 2014-07-03T15:39:55 Split the XInput and DirectInput code so Windows RT can use the existing XInput support.
Sam Lantinga 52ec151f 2014-06-24T13:31:25 Fixed bug 2553 - Add support to all XInput devices This adds support for all XInput devices, exposed through the SDL joystick API. The button and axis reporting for XInput devices has been changed to match DirectInput and other platforms. The game controller xinput mapping has been updated so this change is seamless. There is a new hint, SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING, for any applications that have hardcoded the old xinput button and axis set. This hint will be removed in SDL 2.1.
Sam Lantinga 67350973 2014-05-13T11:32:36 Updated coding style to match the rest of SDL
David Ludwig 3dcb451f 2014-04-09T21:29:19 Added a README file regarding WinRT support To note, this file is currently formatted with CRLF line endings, rather than LF, to allow the file to be viewed with Notepad.
Sam Lantinga 1367bf87 2014-03-09T11:36:47 Integrated David Ludwig's support for Windows RT
Sam Lantinga 05c23063 2014-03-09T11:06:11 Fixed line endings on WinRT source code
Sam Lantinga ab9345a8 2014-02-28T16:24:41 Null termnate the pUserMappings variable to prevent memory corruption.
Gabriel Jacobo 2ed47d83 2014-02-24T10:00:10 Fixes #2417, memory leak in SDL_gamecontroller.c (thanks Leonardo!)
Sam Lantinga 58edac3e 2014-02-02T00:53:27 Fixed bug 2374 - Update copyright for 2014... Is it that time already??
Philipp Wiesemann 54a1f61a 2013-12-25T17:02:15 Changed return -1 after SDL_SetError() to return SDL_SetError().
Sam Lantinga 03aece54 2013-12-23T15:10:03 Generate SDL_CONTROLLERDEVICEADDED events for controllers connected at startup
Sam Lantinga 4ab350d4 2013-12-06T09:13:31 Fixed detecting the wired XBox 360 controller on Linux Also added some more debug output to detect issues
Sam Lantinga c78476da 2013-12-06T08:24:00 Fixed compiler warning on Visual Studio
Gabriel Jacobo 5ac18134 2013-12-03T12:01:28 Adds SDL_GameControllerAddMappingsFromRW, updates controllermap SDL_GameControllerAddMappingsFromFile is now a convenience macro. controllermap can now skip bindings by pressing space or clicking/touching the screen.
Gabriel Jacobo 45ae148a 2013-12-02T19:34:08 Adds SDL_GameControllerAddMappingsFromFile
Gabriel Jacobo f848adff 2013-11-29T10:06:08 Improve Android pause/resume behavior.
David Ludwig 46740a5a 2013-11-28T22:09:21 WinRT: merged with latest SDL 2.x/HG code SDL 2.x recently accepted patches to enable OpenGL ES 2 support via Google's ANGLE library. The thought is to try to eventually merge SDL/WinRT's OpenGL code with SDL-official's.
Ryan C. Gordon 7e1289af 2013-11-24T23:56:17 Make internal SDL sources include SDL_internal.h instead of SDL_config.h The new header will include SDL_config.h, but allows for other global stuff.
Philipp Wiesemann 3cba7997 2013-11-18T23:43:15 Fixed unreachable return statement warning in gamecontroller source.
David Ludwig 69c5d21d 2013-10-27T21:26:46 WinRT: merged with SDL 2.0.1 codebase
Sam Lantinga b8b9bfbe 2013-10-21T01:16:16 Fixed some warnings building for 64-bit Windows
Ryan C. Gordon 4b255c63 2013-08-28T16:43:47 Reworked XInput and DirectInput joystick code. Now multiple XInput controllers map correctly to device indexes instead of grabbing the first available userid, and are completely separated out from DirectInput. Also, the hardcoded limitation on number of DirectInput devices is gone. I don't expect there to really ever be more than eight joysticks plugged into a machine, but it was a leftover limitation for a static array we didn't actually use anymore. Fixes Bugzilla #1984. (etc?)
Sam Lantinga 9faefccd 2013-08-21T10:32:04 SDL - detect that you tried to open a gamecontroller in xinput mode and failed, then re-get the mapping for the dinput variant you did open (and most likely now just fail the open) CR: SamL
Gabriel Jacobo 695344d1 2013-08-21T09:43:09 OCD fixes: Adds a space before */
David Ludwig f7049b93 2013-08-12T22:29:55 WinRT: merged with SDL 2.0.0 codebase (aka. SDL hg rev d4ce48ff30d1)
Gabriel Jacobo dad42067 2013-08-12T11:13:50 Fixes #2022, do not resume on Android when surfaceChanged If the app is in landscape mode and the user presses the power button, a pause is followed immediately by a surfaceChanged event because the lock screen is shown in portrait mode. This triggers a "false" resume. So, we just pause and resume following the onWindowFocusChanged events. Also, wait for SDL_APP_WILLENTERBACKGROUND and SDL_APP_DIDENTERBACKGROUND before blocking the event pump.
Sam Lantinga 1ad936eb 2013-08-11T19:56:43 Fixed bug 2027 - Full-screen appears to be broken - hang in SDL_DestroyWindow() Rainer Deyke I'm running Linux Mint 15 with the Cinnamon window manager. SDL_DestroyWindow consistently locks up for me when the window if fullscreen.