Commit graph

48 commits

Author SHA1 Message Date
Sam Lantinga
20e65317fa Fixed some warnings building for 64-bit Windows 2013-10-21 01:16:16 -07:00
Ryan C. Gordon
6f21990987 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?)

--HG--
extra : rebase_source : 103ce667c1cdd87a3691c9dd9eea2318bad908c8
2013-08-28 16:43:47 -04:00
Sam Lantinga
54d87dfc28 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
2013-08-21 10:32:04 -07:00
Gabriel Jacobo
271e0d67c4 OCD fixes: Adds a space before */ 2013-08-21 09:43:09 -03:00
Sam Lantinga
06741a5761 Moved the game controller database to a separate file and added a script to sort the entries so we can easily check for duplicates 2013-07-12 10:44:55 -07:00
Sam Lantinga
22aec9f625 Oops, that was supposed to be in the Linux section. 2013-07-12 08:21:28 -07:00
Sam Lantinga
8522bf8e38 Fixed name of the Logitech F710 controller 2013-07-11 23:21:09 -07:00
Sam Lantinga
0b2d15eb61 Fixed bug 1853 - Gamecontroller patch to add support for Logitech F510 (Linux)
Gerry JJ

Same mapping as for F710. Xinput mode only since I couldn't get Dinput mode to work at all.
2013-07-11 23:20:29 -07:00
Sam Lantinga
80917f1537 Removed redundant "Controller" names from gamepads, added mapping for Logitech F710 in DirectInput mode 2013-06-07 09:40:07 -07:00
Jørgen P. Tjernø
24fc22545b Mac: Fix invalid PS3 controller mapping.
PS3 controller had swapped D-Pad down & left buttons, as well as X & Y buttons.
Thanks to Alex Szpakowski for the bug report and fix.

Fixes http://bugzilla.libsdl.org/show_bug.cgi?id=1891
2013-06-05 12:48:44 -07:00
Edward Rudd
acb14cfc03 Add trigger value adjustment code to the SDL_GameControllerGetAxis code as well.
- fixes Trigger values when polling instead of using event driven
2013-05-30 22:14:24 -04:00
Edward Rudd
3d874237bc add in Controller configs for Logitech F510 for OS X / Linux
--HG--
extra : rebase_source : 68a7469d9e85d5f090d0299abed42f8ed577499a
2013-05-30 10:42:52 -04:00
Sam Lantinga
0cb6385637 File style cleanup for the SDL 2.0 release 2013-05-18 14:17:52 -07:00
Sam Lantinga
bc7136f5ba Martin Gerhardy added support for the Jess Technology USB Game Controller 2013-05-16 00:48:20 -07:00
Philipp Wiesemann
e83262a725 Corrected spelling in C source files. 2013-05-01 11:59:54 +02:00
Philipp Wiesemann
a4432d3cdf Corrected confusing indentation in C source file. 2013-04-29 23:50:27 +02:00
Jørgen P. Tjernø
e4b6ac8025 Fix overflow in recent gamecontroller trigger change. 2013-04-19 16:02:16 -07:00
Jørgen P. Tjernø
12a26f7c35 Make gamecontroller triggers have values in 0 - 32767.
This changes the old behavior of having values in the -32768 - 32767
range, like regular joystick axis. Now "button as axis" triggers (like
on Logitech controllers) and regular axis triggers (like on Xbox
controllers) have the same resting value, 0.
2013-04-19 10:51:21 -07:00
Jørgen P. Tjernø
cbd1884115 Add 3 Logitech gamecontroller mappings for Mac OS X. 2013-04-03 16:48:20 -07:00
Jørgen P. Tjernø
4926901d46 Add new controller mappings for Windows. 2013-04-02 18:09:30 -07:00
Ryan C. Gordon
4f438b70a2 Make SDL_SetError and friends unconditionally return -1.
This lets us change things like this...

    if (Failed) {
        SDL_SetError("We failed");
        return -1;
    }

...into this...

    if (Failed) {
        return SDL_SetError("We failed");
    }


 Fixes Bugzilla #1778.
2013-03-31 12:48:50 -04:00
Sam Lantinga
aff63d09c2 Added support for the GameStop Gamepad 2013-03-25 12:04:16 -07:00
Jørgen P. Tjernø
ae480eecfd Missing comma in one gamepad mapping. 2013-03-12 18:28:40 -07:00
Jørgen P. Tjernø
fc436807a8 Add GameController mappings for popular controllers.
This adds mappings for:
  - Another type of wired X360 controller
  - A wireless X360 controller
  - Logitech F710 (XInput and DInput modes)
  - Logitech F310 (XInput mode)
  - Logitech Cordless RumblePad 2
2013-03-12 18:28:36 -07:00
Sam Lantinga
7f2340dc6a Don't re-read the hints when opening the game controller. Instead use SDL_GameControllerAddMapping() to add hints after initialization. 2013-03-08 10:09:51 -08:00
Sam Lantinga
0707530b35 Load the game controller mapping hint when opening a game controller. 2013-03-07 15:37:08 -08:00
Sam Lantinga
1dec4dd800 Fixed read after free bug in the game controller. 2013-03-07 15:17:06 -08:00
Edward Rudd
5fd98b3297 add new gamecontroller APIs
- add mappings after init (or even before w/o using the hint)
- get string for axis
- get string for button
- get mapping string for controller or for GUID
- new event to notify when a controller is remapped. (e.g. mapping was changed via the AddMapping method)
2013-03-05 17:59:36 -05:00
Sam Lantinga
2204530a1b Fixed gcc pedantic warnings in public headers 2013-02-26 20:41:28 -08:00
Ryan C. Gordon
ad1d82cf83 Added SDL_GameControllerUpdate(). 2013-02-25 01:51:21 -05:00
Ryan C. Gordon
a5862a96a3 Changed the game controller enum types to match SDL naming conventions. 2013-02-25 00:56:21 -05:00
Ryan C. Gordon
3d19f803d8 Added PS3 game controller config for Linux. 2013-02-25 00:45:25 -05:00
Ryan C. Gordon
6c4a53f561 Fixed a minor typo. 2013-02-24 22:56:35 -05:00
Ryan C. Gordon
2452978990 Added an X360 game controller config for Linux. 2013-02-24 22:56:24 -05:00
Sam Lantinga
95dcfa4c28 Happy New Year! 2013-02-15 08:47:44 -08:00
Jørgen P. Tjernø
e34e953eba Check bounds in SDL_IsGameController. Switch two functions to SDL_bool.
Switches SDL_GameControllerGetAttached and SDL_IsGameController to
       return SDL_bool, instead of int.
2013-02-12 17:07:21 -08:00
Sam Lantinga
b836001559 Hopefully fixed the last of the C variable declaration problems which caused compile failures with Visual Studio. 2013-02-11 18:28:05 -08:00
Sam Lantinga
57163e457f Fixed C variable declarations 2013-02-11 18:13:52 -08:00
Sam Lantinga
e2aa9f0afb Fixed compiler warning (and undefined behavior) in game controller event filter. 2013-02-11 17:25:58 -08:00
Sam Lantinga
b73214bd02 tree 97aca305664b
parent 6a9ca692cd65
author Edward Rudd <urkle@outoforder.cc> 1358030048 18000
committer Edward Rudd <urkle@outoforder.cc> 1358030048 18000
revision 6822
branch default

rework and fix handling of hat to button mappings

- doesn't assume it's always mapped to dpad
- properly handles multiple hats (up to 4)
- properly handles multiple presses (e.g. up and right)
- properly handles multiple gamepads
2013-02-11 11:21:54 -08:00
Sam Lantinga
290c391df5 tree 0c86a223596d
parent 44e12dd8ee8e
author Edward Rudd <urkle@outoforder.cc> 1358030047 18000
committer Edward Rudd <urkle@outoforder.cc> 1358030047 18000
revision 6821
branch default

Fix a bad mapping from "axis" to "button"
2013-02-11 11:21:19 -08:00
Sam Lantinga
65399f4c26 tree 8cbca1e6b293
parent 7ddddb71cec9
author Edward Rudd <urkle@outoforder.cc> 1358030045 18000
committer Edward Rudd <urkle@outoforder.cc> 1358030045 18000
revision 6820
branch default

Consolidate iterating the SupportedControllers array

also fix memory leak when controller mapping not found
2013-02-11 11:20:49 -08:00
Sam Lantinga
4cec546dca Fixed crash when the game controller mapping hint is set - the hint was duplicated and not null terminated. 2013-01-25 14:25:19 -08:00
Sam Lantinga
89ef9e3168 Changes from Alfred:
- rename JoystickGUID -> SDL_JoystickGUID
- change SDL_JoystickGetGUIDString to take the string as an arg, rather than doing a malloc
2012-12-11 11:54:32 -08:00
Sam Lantinga
b165aa8c74 Fixed compiler warnings 2012-11-27 01:07:44 -08:00
Sam Lantinga
cf0dfcbaa4 Fixed unused variable warning 2012-11-26 23:53:18 -08:00
Sam Lantinga
86e0e26475 The XInput code is only available in the DirectInput joystick driver. 2012-11-26 23:50:12 -08:00
Sam Lantinga
34b88dfaae Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds 2012-11-26 16:37:54 -08:00