Commit Graph

446 Commits

Author SHA1 Message Date
Sam Lantinga
7dec2806ea Added an entry for the new Steam controller XInput emulation mode 2014-08-11 17:24:54 -07:00
Sam Lantinga
b1995f17e5 Hopefully fixed Cygwin build 2014-07-07 13:21:54 -07:00
Sam Lantinga
e199a7e7ec Removed useless assert 2014-07-07 13:19:53 -07:00
Sam Lantinga
d19bc1c3b8 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
Sam Lantinga
5c4bb7a3cf SDL_SYS_IsXInputGamepad_DeviceIndex() is only available if SDL_JOYSTICK_XINPUT is true. 2014-07-07 11:44:14 -07:00
Sam Lantinga
0da7ddd120 Fixed mingw64 build and warnings 2014-07-07 10:26:28 -07:00
Sam Lantinga
6dd1e2f2f6 Split the XInput and DirectInput code so Windows RT can use the existing XInput support. 2014-07-03 15:39:55 -07:00
David Ludwig
5c2ef2236c WinRT: Fixed game controller axis mappings
SDL/WinRT currently uses a separate XInput backend from SDL/Win32, as WinRT
has no support for DirectInput.  This change makes SDL/WinRT's XInput
code snag some recently-changed bits from the Win32-specific,
DirectInput + XInput backend, in order to get the SDL_GameController API
working again on WinRT, insofar that axes map to the correct parts.

TODO:
 - test all buttons, making sure WinRT maps buttons the same way that Win32 does
 - consider making the Win32 and WinRT codebases share more stuff, minus
   the sort of duplication happening via this change.  Maybe simulate, or
   stub-out, DirectInput calls when on WinRT?
2014-06-25 22:38:40 -04:00
David Ludwig
c26e6f214b WinRT build fix 2014-06-25 22:03:05 -04:00
Sam Lantinga
5a816a6c2c Fixed bug 2603 - iOS: update joystick accelerometer code to use CoreMotion instead of the deprecated UIAccelerometer
Alex Szpakowski

SDL's code for exposing the accelerometer as a joystick on iOS currently uses UIAccelerometer, which was superseded by the CoreMotion framework and deprecated since iOS 5.

The UIAccelerometer code still works (for now), but it also throws deprecation warnings whenever SDL is built for iOS, since SDL's deployment target is no longer below iOS 5.

I've created a patch which replaces the old UIAccelerometer code with a replacement based on the CoreMotion framework. It has identical functionality (to SDL users), however iOS apps are now required to link to the CoreMotion framework when using SDL.
2014-06-25 00:20:21 -07:00
Sam Lantinga
b09fd2c550 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.
2014-06-24 13:31:25 -07:00
Sam Lantinga
50d5314d80 You shouldn't get axis and hat events when your application doesn't have focus (unless you use the SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS hint) 2014-06-21 21:30:49 -07:00
Sam Lantinga
8cc5b67413 Add controller mapping for Bluetooth DualShock 4 controllers on Linux
Frank Praznik

Add a gamepad mapping entry for Bluetooth DualShock 4 controllers on Linux.
The button mapping is the same as the USB controller, but the GUID is
different.
2014-06-15 13:05:30 -07:00
Ryan C. Gordon
8f8eddd27f 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
5fb350ef13 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
d99ebaf853 - 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
Sam Lantinga
667b15f3c8 Added annotations to help code analysis tools
CR: Bruce Dawson
2014-06-04 10:56:56 -07:00
Sam Lantinga
89b0a3e80f Added a binding for the NVIDIA Shield controller 2014-05-13 12:10:37 -07:00
Sam Lantinga
9a700c5bf4 Updated coding style to match the rest of SDL 2014-05-13 11:32:36 -07:00
Ryan C. Gordon
ceb7a17085 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!
2014-04-24 23:24:48 -04:00
Sam Lantinga
d349d6a1f2 Fixed the joystick side of XInput haptic detection on Windows 8 2014-03-31 10:38:26 -07:00
Ryan C. Gordon
5f04095886 Fixed PS4 game controller config on Windows. 2014-03-18 12:53:01 -04:00
Ryan C. Gordon
8f66b9ecc9 Whitespace fix. 2014-03-18 12:52:51 -04:00
Ryan C. Gordon
91cea37295 Fixed SDL_HapticOpenFromJoystick() with DirectInput devices. 2014-03-17 19:11:18 -04:00
Sam Lantinga
6800e72d96 Fixed the copyright date on files contributed by David Ludwig 2014-03-13 00:40:08 -07:00
Sam Lantinga
846b841569 Fixed compiling Windows RT code on Visual Studio 2013 2014-03-12 07:26:07 -07:00
Sam Lantinga
0ae88759fb Integrated David Ludwig's support for Windows RT 2014-03-09 11:36:47 -07:00
Sam Lantinga
32547d0c59 Fixed line endings on WinRT source code 2014-03-09 11:06:11 -07:00
Ryan C. Gordon
e9ec71b8cd Added a FIXME. 2014-03-01 22:27:21 -05:00
Ryan C. Gordon
ce5a1c500a Fixed a typo in a comment. 2014-03-01 22:27:13 -05:00
Ryan C. Gordon
322faffb4e Added some FIXMEs. 2014-03-01 20:59:43 -05:00
Sam Lantinga
a3680acb4a Changed SDL_HINT_ACCEL_AS_JOY to SDL_HINT_ACCELEROMETER_AS_JOYSTICK to be more clear. 2014-03-01 12:21:15 -08:00
Sam Lantinga
a22f31f4e8 Null termnate the pUserMappings variable to prevent memory corruption. 2014-02-28 16:24:41 -08:00
David Ludwig
96060da8b4 WinRT: prevented a potential race condition in the XInput backend
The race condition could've been triggered on device removal.
2013-12-25 14:42:38 -05:00
David Ludwig
cc7718dccb WinRT: moved ill-performing XInput device-detection calls to a separate thread 2013-12-24 21:28:31 -05:00
Gabriel Jacobo
684673dff4 Fixes #2417, memory leak in SDL_gamecontroller.c (thanks Leonardo!) 2014-02-24 10:00:10 -03:00
Ryan C. Gordon
8669ccbb94 Free the correct variable. 2014-02-23 01:24:46 -05:00
Ryan C. Gordon
4b27b065e0 Fixed Mac DualShock 4 gamecontroller db entry again. 2014-02-22 21:21:33 -05:00
Ryan C. Gordon
688eb4c40e 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.
2014-02-22 21:15:34 -05:00
Ryan C. Gordon
3a6f999419 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.
2014-02-22 00:55:28 -05:00
Sam Lantinga
7c529ab78b Fixed Mac PS4 controller entry, added Linux OUYA controller entry 2014-02-14 11:38:59 -08:00
Ryan C. Gordon
12a80abc41 Fixed DualShock 4 controller config on Mac OS X. 2014-02-10 12:47:26 -05:00
Sam Lantinga
4cc159d3f4 Fixed the OUYA controller mapping on Windows 2014-02-09 03:09:04 -08:00
Sam Lantinga
45399df5d0 Added Windows entry for the bluetooth OUYA controller 2014-02-09 02:42:59 -08:00
Ryan C. Gordon
e7c7bbcd8d Added DualShock 4 game controller config for Windows, Mac, and Linux. 2014-02-06 21:28:11 -05:00
Ryan C. Gordon
97e15d4d3b Wired up haptic hotplugging for Windows DirectInput/XInput code. 2014-02-06 07:37:20 -05:00
Ryan C. Gordon
2ee4b430a5 Cleanup some vi footer comments, rename new PRIVATE_* funcs to MacHaptic_*. 2014-02-05 01:02:09 -05:00
Edward Rudd
8c1b08595f Implement new backend methods for haptic and hot plugging on OS X 2014-02-04 18:17:16 -05:00
Sam Lantinga
dba255c1e5 Fixed bug 2374 - Update copyright for 2014...
Is it that time already??
2014-02-02 00:53:27 -08:00
dbrady
99745583e9 fixed hat code validation. 2014-01-28 15:28:20 -08:00