Commit graph

447 commits

Author SHA1 Message Date
David Ludwig
88461d442a WinRT: merged with SDL 2.0.0 codebase (aka. SDL hg rev d6a8fa507a45)
--HG--
rename : README.iOS => README-ios.txt
2013-08-12 22:29:55 -04:00
Sam Lantinga
df092588e8 Fixed whitespace 2013-08-10 10:57:54 -07:00
Sam Lantinga
e6e79353e8 Fixed bug 2024 - Update OSX Joystick code to fully support Saitek p2500 gamepad
Patrick Maloney

Saitek p2500 (Cyborg Rumble Force Pad) has a D-pad, two analog sticks, and numerous buttons.  SDL 2.x on OSX detected everything except the right-side analog stick.  The right-side stick is considered a 'simulation device' with the axes mapped to throttle and rudder.

The patch adds support for throttle and rudder on the HID simulation page.
2013-08-10 10:55:12 -07:00
Philipp Wiesemann
e3b9fb7542 Corrected internal documentation in source. 2013-07-22 22:54:00 +02:00
Gabriel Jacobo
f82f0ebb6f Uses SDL_UDEV for Linux joystick hotplugging 2013-10-01 08:47:06 -03:00
Sam Lantinga
8d1d55e8fc Fixed bug 2090 - Some joystick inputs are delayed on FreeBSD
kikuchan

Some joysticks with high sampling rate need to be read() more fast,
otherwise it delay user inputs due to internal queue.
Especially, an app that issues SDL_PollEvent() not so frequent
2013-09-06 20:54:14 -07:00
Jørgen P. Tjernø
70519db239 Fix to buffer overrun in SDL_JoystickGetGUIDString(). 2013-09-05 15:49:57 -07:00
Sam Lantinga
08dfaaa2e6 Christoph Mallon: Remove pointless if (x) before SDL_free(x) 2013-08-29 08:29:21 -07:00
Ryan C. Gordon
44918e378d Change order we enumerate Windows joysticks.
Make it so XInput devices are listed before DirectInput devices, and that the XInput
 devices are sorted by userid in ascending numeric order (so device 0 comes first).
2013-08-28 22:09:17 -04:00
Ryan C. Gordon
e670fc63f1 Don't corrupt XInput device state during SDL_SYS_JoystickClose(). 2013-08-28 22:07:54 -04:00
Ryan C. Gordon
526597ad95 Make XInput joystick names match the numbers on the device.
(And how the Haptic code already names them.)
2013-08-28 17:17:21 -04: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
Ryan C. Gordon
17c90f1186 Better XInput detection code for DirectInput device enumeration.
This code is way faster than the Wbem code, and less ugly.

--HG--
extra : rebase_source : cce46397251068b426e2ec267c15292aa0744386
2013-08-28 16:35:32 -04:00
Sam Lantinga
34b9565f87 Fixed compiling on old versions of the DirectX SDK 2013-08-21 12:12:04 -07: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
Sam Lantinga
8ddc481d35 Fix SDL xinput code to work at all when xinput has devices at high indexes but no device connected at lower index, for instance 0->disconnected, 1->wireles, 2->wired. Previously the SDL code assumed the indexes were always used up in order which is not true at all and lead to a bunch of failure cases where controllers would go unrecognized.
This entire function is kind of a mess and more complicated than needed, but I don't want to refactor it too heavily tonight.  May look at improving how the indexes are assigned more significanly later.  The way it handles not finding a valid "gamepad" type device is also super broken, it leaves in place the xinput bindings but opens the controller with dinput and ends up with completely wrong mappings, not solving that now, but fixing the bug where we'd very frequently not find a controller due to gaps in assigned player numbers should mostly avoid it.
2013-08-21 10:31:44 -07:00
Gabriel Jacobo
3557ef7451 Patched to compile on Darwin 2013-08-21 10:27:39 -03:00
Gabriel Jacobo
271e0d67c4 OCD fixes: Adds a space before */ 2013-08-21 09:43:09 -03:00
Gabriel Jacobo
5e78879e76 More non C89 compliant comments 2013-08-20 20:34:40 -03:00
Gabriel Jacobo
25c9f2cd30 Fixes a few non C89 compliant comments 2013-08-20 19:49:24 -03:00
Sam Lantinga
6956070880 Added a hint to control the Windows timer resolution: SDL_HINT_TIMER_RESOLUTION
Added an API to watch hint changes: SDL_AddHintCallback(), SDL_DelHintCallback()
You can now dynamically set the joystick background event hint.
2013-07-13 03:13:41 -07: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
Ryan C. Gordon
2740a12ae3 Backout hg changset 898992405fa7; lots of things still use SDL_types.h. :/
Will remove this again at some point in the future, though.
2013-07-09 11:57:32 -04:00
Ryan C. Gordon
7afed3e5ae Removed deprecated SDL_types.h header.
Fixes Bugzilla #1945.
2013-07-08 23:37:00 -04:00
Sam Lantinga
156a8638f0 Make it possible to use SDL events separately from the video subsystem. 2013-07-06 12:28:57 -07:00
Sam Lantinga
563185f19c Only check for keyboard focus if the video subsystem was initialized.
Check the hint at initialization time, as an optimization.  This isn't something we expect the application to change at runtime, and if it is we should add an API for it.
2013-06-28 23:29:13 -07:00
Sam Lantinga
9fe349d213 Whoops, this controller had already been added. 2013-06-27 17:49:22 -07:00
Sam Lantinga
a7879829ef Added game controller support for an older XBox Controller 2013-06-27 16:32:45 -07:00
Sam Lantinga
a8055a9808 Fixed bug: SDL2 Xinput joystick axis jumps from positive to negative
Franz Schrober

Attached is my patch. It ensures that the values are correctly limitted between -32767 and 32767 (otherwise the negator - and the conversion to sint16 would corrupt the result)

I am using Motioninjoy (Dualshock 3 Sixaxxis controller on Windows 7)  together with a recent SDL2 (post rc1) and noticed with the testjoystick binary that the axis 3 (left analog up/down) jumps when going in down direction from 32257 to -32768. This seems obviously wrong and I have never seen this before. In my games the people are now going backwards before they start to sprint forward when the player actually wants to run as fast as possible backwards. This also happens on the axis 2 (right analog stick up/down)

This problem doesn't happen in DX mode
2013-06-27 11:21:37 -07:00
Sam Lantinga
5aa3492ef8 Fixed SDL building with the minimal configuration 2013-06-13 22:10:10 -07:00
Sam Lantinga
4c59063d54 Check for well known XInput device GUIDs before enumerating the device list. 2013-06-07 18:26:55 -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
Sam Lantinga
612ec5d29d Slightly more efficient to check the event type first 2013-06-07 09:39:10 -07:00
Sam Lantinga
7de1fa00ff It's better not to have the full range of the axis (by 1 on the negative side) than turn 0 value into -1 2013-06-07 08:48:25 -07:00
Sam Lantinga
6879bf00c4 Fixed crash trying to get the GUID of an invalid joystick index 2013-06-06 18:20:06 -07:00
Sam Lantinga
0e48e3563b The triggers should be expanded out to the full range to match DirectInput behavior.
The game controller code will scale them back to 0 - 32767 when it converts the triggers axes.
2013-06-06 17:59:01 -07:00
Jørgen P. Tjernø
e1e1fa3d61 Joystick: Only send joy events when focused.
This changes makes it so that you only receive joystick (and implicitly
gamecontroller) input events when your application has keyboard focus.
If you'd like to still receive events when your application is in the
background, set the SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS hint to "1".

This fixes http://bugzilla.libsdl.org/show_bug.cgi?id=1892
2013-06-05 15:11:38 -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
Sam Lantinga
86b3564df2 Hopefully fixed mingw32 build 2013-06-02 08:48:52 -07:00
Sam Lantinga
cd88135edc Gyrations to get the code to compile with the latest version of mingw-w64 as well as Visual Studio.
I think in this case mingw-w64 is incorrect in defining the GUID instead of declaring it like Visual Studio and the older mingw32 compilers.
2013-06-02 01:35:38 -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
fbef22a01a Fixed Visual Studio build 2013-05-26 14:37:41 -07:00
Sam Lantinga
8408ce85ee Fixed compile errors building with mingw64 2013-05-26 11:34:04 -07:00
David Ludwig
95ad1c10fb WinRT: added hotplug support for joysticks/game-controllers 2013-05-21 20:08:53 -04:00
David Ludwig
b919f57c12 WinRT: added preliminary joystick / game controller support (minus hotplugging) 2013-05-19 23:30:34 -04:00
Sam Lantinga
0cb6385637 File style cleanup for the SDL 2.0 release 2013-05-18 14:17:52 -07:00