Commit graph

95 commits

Author SHA1 Message Date
Philipp Wiesemann
2a8a7f92b7 Fixed empty parameter list in signatures of internal functions. 2016-11-16 22:08:51 +01:00
Sam Lantinga
7b1761ed6f Updated Mac OS X game controller support 2016-11-11 04:06:00 -07:00
Sam Lantinga
6fcf21b827 Standardized the format of the SDL joystick GUID and added functions to retrieve the USB VID/PID from a joystick and game controller. 2016-11-10 17:19:34 -08:00
Sam Lantinga
f98a06ec45 Added SDL_PrivateJoystickAdded() and SDL_PrivateJoystickRemoved()
Updated the removal code to iterate over all joystick add messages instead of just the first one.
2016-08-26 12:18:08 -07:00
Sam Lantinga
cb8e57bda0 [ 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. 2016-08-08 12:17:53 -07:00
Alex Szpakowski
e2f5a3023a Removed Mac OS 10.5 support (bug #3137). Also fixed a warning about deprecated Carbon code when using SDL_audio (bug #3127, thanks Dominik!) 2016-05-21 00:20:52 -03:00
Sam Lantinga
7ee8dda270 Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Alex Szpakowski
98bb021a4b 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.
2015-12-28 15:44:09 -04:00
Alex Szpakowski
8892024a7e Mac: Detect the d-pad and pause buttons on Steelseries MFi gamepads (bug #3124.) 2015-11-12 22:44:32 -04:00
Ryan C. Gordon
f14eac8b9d Mac: Fixed off-by-one bug when plugging in a joystick (thanks, Konstantin!).
--HG--
extra : rebase_source : 3bd5a711f40686140b1179717bed4587ce92576a
2015-09-13 11:29:45 -04:00
Ryan C. Gordon
52f8afaf0c Mac: Fix compiler warning when building with a min target >= 10.6. 2015-05-26 12:52:28 -04:00
Sam Lantinga
2fd64c2f12 Fixed bug 2869 - Controllers connected on launch are reported twice.
Since all device detection/removal happens on the main thread now, post events inline with when the status changes occur.
Also fixed rare cases when joystick API functions could return data about removed joysticks when called with a device index.
2015-05-26 08:52:02 -07:00
Sam Lantinga
56b58afdbe Updated the copyright year to 2015 2015-05-26 06:27:46 -07:00
Ryan C. Gordon
3ff618a9c7 Cleanups in the joystick code.
Removed some redundant state and other confusions.

Fixes Bugzilla #2738.

--HG--
extra : rebase_source : 35dd561553379e00eb8d169ce12ecc99393b2f84
2015-03-24 13:52:01 -04:00
Ryan C. Gordon
e03d7a79a9 Mac: patched to compile with haptic subsystem disabled (thanks, Rodrigo!).
Fixes Bugzilla #2717.
2015-03-24 03:24:57 -04:00
Philipp Wiesemann
bde0ce0969 Updated internal documentation comments. 2015-03-11 21:14:21 +01:00
Alfred Reynolds
f1bdf20e1d SDL
- fix crash on OSX when removing a device. If the remove happened due to the CFRunLoopRunInMode call in SDL_SYS_JoystickDetect then we would delete the device right away, before SDL_SYS_JoystickUpdate could clean it up. So move the CFRunLoopRunInMode to after the cleanup logic, preventing this case. This does mean that adds and removes of joysticks now take 1 extra frame to show up.
2015-03-02 11:43:24 -08:00
Ryan C. Gordon
984d72502d Mac OS X: Better way to stop duplicate joystick reports (thanks, Kyungdahm!).
Fixes Bugzilla #2822.
2015-02-19 23:52:10 -05:00
Ryan C. Gordon
3e754ff61f Mac: Don't add the same joystick twice if IOKit reports a duplicate device.
Fixes Bugzilla #2704.
2014-08-31 11:21:10 -04:00
Sam Lantinga
bdb4ce60cd Fixed bug 2631 - Mac: minor code cleanup
Alex Szpakowski

Some minor changes to the Mac-specific backend code:

- Fixed up some code style issues (mostly brace style inconsistencies).

- Fixed a compiler warning in SDL_cocoaevents.m.

- Removed some useless code now that the 10.7 SDK is required to build SDL.

- Removed Gestalt(gestaltSystemVersion, ...) call and switched to NSAppKitVersionNumber for version checking code. Using Gestalt with gestaltSystemVersion will give 0x1090 in Mac OS 10.10+, and the whole Gestalt function was deprecated in Mac OS 10.8.
2014-07-07 12:48:25 -07:00
Ryan C. Gordon
fbdde501ba Removed SDL_SYS_JoystickNeedsPolling().
It was simpler to just have the polling (actually: hotplug detection)
 functions return immediately if it's not an appropriate time to poll.

Note that previously, if any joystick/controller was opened, we would poll
 every time anyhow, skipping this function.
2014-06-14 23:31:23 -04:00
Ryan C. Gordon
50265e160b Mac: Run the CFRunLoop in joystick mode during SDL_SYS_JoystickNeedsPolling().
This fixes hotplugging failing to detect devices.
2014-06-13 14:52:26 -04:00
Alfred Reynolds
b270f6a5c3 - fixed crash if you removed a device twice, the deviceRef is invalid if removed from the removed device callback (added in http://hg.libsdl.org/SDL/rev/153077041e4b ). 2014-06-13 10:50:24 -07:00
Ryan C. Gordon
655e28fd65 Mac OS X: Look for joystick hotplug in its own CFRunLoop.
This allows the joystick hotplug to function without the main event loop
 (specifically: without SDL_INIT_VIDEO), and moves explicit polling for
 joysticks where it belongs at the low-level: in SDL_SYS_JoystickDetect().

This lets apps call SDL_JoystickUpdate() to get hotplug events and keep
 SDL_NumJoysticks() correct, as expected. As SDL_PumpEvents() (and
 SDL_PollEvents, etc) calls SDL_JoystickUpdate(), existing apps will function
 as before.

Thanks to "raskie" on the forums for pointing this out!

--HG--
extra : rebase_source : 09d8e949731014ba3226aecf73050e35a54a5cdd
2014-04-24 23:24:48 -04:00
Ryan C. Gordon
08107940e9 Free the correct variable. 2014-02-23 01:24:46 -05:00
Ryan C. Gordon
7ecd3a6867 Mac joystick: ignore duplicate HID elements.
The DualShock 4 has all elements listed twice: once in the top-level list of
 elements, and once in an "Application Collection" element at the top-level.

Each element has a proper cookie with a unique value, so now we descend into
 each element collections, but before we add an element to the device's list,
 we make sure we don't already have one with that cookie, probably from
 another collection or a buggy device.

--HG--
extra : rebase_source : 0e5058ff3333364e680eb79d3cbcfa168ab2a068
2014-02-22 21:15:34 -05:00
Ryan C. Gordon
4e89bc0a11 Reworked Mac OS X joystick code to use the 10.5+ HID Manager API.
Besides being a little more simple to use than the earlier IOKit HID API, and
 less likely to be deprecated, it also has the added benefit of working with
 the Sony DualShock 4 controller in Bluetooth mode out of the box, whereas
 the previous API has a bug that makes it report bad data for the
 controller.

Cleaned up several other things in this code, having gone over every line of
 it. The remaining deprecated calls are also gone.

--HG--
extra : rebase_source : 47e220fea5d6ab87d51b23736b12d069a9a5313f
2014-02-22 00:55:28 -05:00
Ryan C. Gordon
2757186774 Cleanup some vi footer comments, rename new PRIVATE_* funcs to MacHaptic_*. 2014-02-05 01:02:09 -05:00
Edward Rudd
00970c2034 Implement new backend methods for haptic and hot plugging on OS X 2014-02-04 18:17:16 -05:00
Sam Lantinga
d7940a513e Fixed bug 2374 - Update copyright for 2014...
Is it that time already??
2014-02-02 00:53:27 -08:00
Ryan C. Gordon
82edee6971 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.

--HG--
extra : rebase_source : ddf4a4c0dc2c554b98c82700798f343cd91b16e3
2013-11-24 23:56:17 -05:00
Sam Lantinga
1ef510f8cc Fixed bug 1965 - Mac: dead code for supporting OS 10.4
Alex Szpakowski

The new patch removes all the truly obsolete code I could find. I tested on OS 10.8 and OS 10.5.
2013-11-10 17:56:07 -08:00
Sam Lantinga
6c7a589964 Only allocate a joystick instance ID once we know it's a joystick.
This fixes compatibility with code that assumes 0 based joystick instance IDs.
2013-10-06 20:39:23 -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
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
Sam Lantinga
0cb6385637 File style cleanup for the SDL 2.0 release 2013-05-18 14:17:52 -07:00
Philipp Wiesemann
e83262a725 Corrected spelling in C source files. 2013-05-01 11:59:54 +02:00
VALVE\alfred@alfredlinux.valvesoftware.com
3bf28ba7c8 - make sure to send a joy removed event even if the joystick wasn't opened under OSX 2013-04-22 15:24:35 -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
abfb78058f Added GUIDs for Bluetooth devices, using the same algorithm as the Linux code.
Reformatted the code so it was easier to step through using gdb.
2013-03-25 11:38:30 -07:00
Sam Lantinga
95dcfa4c28 Happy New Year! 2013-02-15 08:47:44 -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
Andreas Schiffler
d4bfe07a4f Update assert API in test lib; add to and harness; add test lib to VS2010 and VS2012 solution; fix VS2012 solution; fix compiler warning 2012-12-01 14:48:30 -08:00
Sam Lantinga
03e08a6a79 Organized joystick hotplug code a bit.
Cleaned up names, return types, etc.
2012-11-27 00:58:12 -08:00
Sam Lantinga
c9f59a287d Completed adding new hotplug stubs for the joystick implementations 2012-11-26 22:27:49 -08:00
Sam Lantinga
968ccf93b1 Fixed iOS joystick support for new API 2012-11-26 21:11:28 -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
Sam Lantinga
f380ecb137 Removed executable bit from source files 2012-09-27 14:35:28 -07:00