Commit Graph

1007 Commits

Author SHA1 Message Date
Shawn Ellis
0ae2a9f8c3 Fixed the Atari gamecontroller mappings and added Atari Xbox 360
This change corrects the mappings for the Atari gamecontroller and
adds support for the Atari Xbox 360 compatible gamecontroller. The Atari
game controller can switch between Atari and Xbox 360 mappings.
2021-08-24 13:06:27 -10:00
David Gow
fbc364908a Use the new SDL_clamp() macro where sensible
There were a few places throughout the SDL code where values were
clamped using SDL_min() and SDL_max(). Now that we have an SDL_clamp()
macro, use this instead.
2021-08-14 09:01:14 -07:00
Sam Lantinga
dcc5eef0e2 Clarify that one of the PIDs of the Xbox Elite Series 2 controller is used in Bluetooth mode 2021-08-14 00:31:46 -07:00
Sam Lantinga
e42e9a12de Fixed build 2021-08-13 20:48:56 -07:00
Sam Lantinga
441fbcaa3d Added HIDAPI support for the Xbox Adaptive Controller 2021-08-13 20:48:54 -07:00
Sam Lantinga
907943a236 Added support for the Xbox One S Controller with 5.x series firmware 2021-08-12 17:51:08 -07:00
Ozkan Sezer
7aec0b90ee SDL_hidapi_xboxone.c: fix bogus 'uninitialized' warning from clang.
The last 'size == 50' check is always true anyway.
2021-08-13 01:56:56 +03:00
Sam Lantinga
cec5a129f5 Fixed libudev hotplug notifications in the HIDAPI driver 2021-08-12 15:49:33 -07:00
Sam Lantinga
6eb4ebb502 Simplified the HIDAPI Xbox One controller initialization 2021-08-12 15:49:33 -07:00
Sam Lantinga
584b89abe6 Added support for the color LED on the Xbox Elite Series 2 controller 2021-08-12 08:17:10 -07:00
Sam Lantinga
64882b2466 Added support for the Xbox One Elite 2 Controller with 5.x series firmware 2021-08-12 08:17:08 -07:00
Andrei Alexeyev
e9179314c4 joystick/linux: fix memleaks; streamline joylist item removal 2021-08-11 14:11:52 -07:00
Sam Lantinga
de6ba40d9e Added support for the Flydigi Vader 2 controller in 2.4G Android mode 2021-08-09 11:38:22 -07:00
Sam Lantinga
3f440daad9 Added support for the Flydigi Vader 2 controller in Bluetooth mode 2021-08-09 10:40:36 -07:00
Cameron Gutman
791d9d3ff6 Fixed DInput mapping for NVIDIA Virtual Gamepad 2021-08-07 14:20:43 -07:00
Ryan C. Gordon
dd683073bb
hidapi: Patched to compile on QNX.
Fixes #4591.
2021-08-06 15:13:40 -04:00
Sam Lantinga
9fdb06450d Added support for the Joy-Con Charging Grip when SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS is enabled 2021-08-04 11:34:06 -07:00
Sam Lantinga
9b4884d58a Warn if you're building a partially functional RAWINPUT driver without device notifications 2021-08-03 09:25:14 -07:00
Sam Lantinga
886eb02eba Fixed detection of Steam Virtual Gamepad with the WGI driver 2021-08-03 09:25:14 -07:00
Sam Lantinga
7c63e1d37a Added WGI mappings for the Amazon Luna and Google Stadia controllers 2021-08-03 09:25:14 -07:00
Sam Lantinga
99c8972b25 Added WGI mappings for PS4 and PS5 controllers 2021-08-03 09:25:14 -07:00
Sam Lantinga
2dfc92ca1e Added default mapping for WGI game controllers 2021-08-03 09:25:13 -07:00
Sam Lantinga
993a56766d Only use the default Xbox mapping on Linux
On Windows, this is already covered by XInput and is the wrong mapping if we try to use it with DirectInput/RAWINPUT/WGI controllers
2021-08-03 00:15:24 -07:00
Sam Lantinga
7edc7d5392 Added a mapping for the Steam Virtual Gamepad when it's detected in DirectInput mode 2021-08-02 22:45:07 -07:00
Ryan C. Gordon
834a84fabb winrt: Don't use LoadLibraryA on WinRT.
This removes the CM_Register_Notification code on WinRT. Note
that this API _is_ available to UWP apps as of Windows 10.0.17763
(version 1809, released October 2018), according to:

https://docs.microsoft.com/en-us/uwp/win32-and-com/win32-apis#apis-from-api-ms-win-devices-config-l1-1-1dll

So it might be worth readding with some sort of preprocessor check
for minimum targeted version, or whatever is appropriate for WinRT
development.
2021-08-03 05:07:39 -04:00
Sam Lantinga
022235012c Fixed crash if WGI didn't give us the name for a controller 2021-08-02 16:40:58 -07:00
Sam Lantinga
2d0075eff8 Updated comments for third party Nintendo Switch controllers 2021-07-30 18:23:43 -07:00
Sam Lantinga
16010f7561 Added support for the PowerA Nintendo Switch Fusion Arcade Stick 2021-07-30 18:23:43 -07:00
Sam Lantinga
b33f470901 Fixed detection of the PDP Afterglow Wireless Switch Controller over Bluetooth 2021-07-30 18:23:42 -07:00
Sam Lantinga
6af6950dbc Added support for the Victrix Gambit Tournament Controller 2021-07-30 18:23:42 -07:00
Sam Lantinga
243a8836af The PowerA Nintendo Switch Fusion Pro Controller has a working USB mode, enabled via the switch on the underside of the controller. 2021-07-30 18:23:41 -07:00
Sam Lantinga
9d457aa446 Don't uninitialize COM because of what appears to be a bug in Microsoft WGI reference counting.
This fixes https://github.com/libsdl-org/SDL/issues/4488
2021-07-29 14:25:13 -07:00
Sam Lantinga
b3a0174b26 Scale the values correctly based on the sensor type (thanks @meyraud705) 2021-07-29 14:25:13 -07:00
Sam Lantinga
a186a503e7 Added SDL_GameControllerGetSensorDataRate() to get the sensor update rate for a controller. 2021-07-29 06:43:39 -07:00
Sam Lantinga
2a53f8315a Fixed controllers showing up under both MFI and HIDAPI drivers
The Game Controller Kit doesn't show the controllers at startup, so the HIDAPI driver sees them first and therefore gets preference when a controller is supported by both drivers.

This fixes bug https://github.com/libsdl-org/SDL/issues/4209
2021-07-26 23:29:20 -07:00
Sam Lantinga
46869db01c Fixed controller rumble on macOS
Needed to add a strong reference to the haptics engine
2021-07-26 23:27:13 -07:00
Sam Lantinga
a850fec733 Added missing mapping for the Xbox Elite Controller on Linux
This fixes https://github.com/ValveSoftware/steam-for-linux/issues/7826
2021-07-26 15:05:02 -07:00
Sam Lantinga
ba8bc143c1 Sort joystick entries in /dev/input
This fixes https://github.com/libsdl-org/SDL/issues/4430
2021-07-26 12:09:33 -07:00
Sam Lantinga
8d527def81 Revert "hidapi_switch: Implement HD rumble effect (#4538)"
This reverts commit 19082b115b, which broke rumble on the Nintendo Switch Pro controller
2021-07-26 10:18:18 -07:00
Narr the Reg
19082b115b
hidapi_switch: Implement HD rumble effect (#4538) 2021-07-26 10:00:53 -07:00
Sam Lantinga
10ec4c8671 Added support for the PowerA Nintendo Switch Spectra Controller 2021-07-24 22:11:22 -07:00
Sam Lantinga
3c9559f765 Don't try to rumble third-party Nintendo Switch Pro controllers
Sending rumble to the PowerA Spectra Nintendo Switch controller hangs input reports for a couple of seconds.
2021-07-24 19:43:56 -07:00
Sam Lantinga
cc19b13bc3 Fixed missing return statement 2021-07-24 19:21:29 -07:00
Sam Lantinga
d4ac6b5ed9 Detect buffer overflow when getting DirectInput device state
This fixes bug https://github.com/libsdl-org/SDL/issues/4528
2021-07-24 15:58:33 -07:00
Ryan C. Gordon
5ae0dd4b52
joystick: Split out Linux opening code for reuse by querying code.
This prevents an assertion whem LINUX_JoystickGetGamepadMapping tried to
open the stick temporarily and messed with global state by doing so. Now
the global state is only set in LINUX_JoystickOpen, but the common code
is shared by both interfaces.

Fixes #4198.
2021-07-24 17:48:26 -04:00
Sam Lantinga
09d1cea733 Use the new controller type for the Luna and Stadia controllers 2021-07-24 11:15:09 -07:00
Sam Lantinga
808c3ae612 Allow mapping Android controllers that just have a D-PAD and face buttons
This fixes bug https://github.com/libsdl-org/SDL/issues/4327
2021-07-24 10:37:42 -07:00
Sam Lantinga
94b7a87645 Added SDL_GameControllerType enumerations for the Amazon Luna and Google Stadia controllers
Fixes bug https://github.com/libsdl-org/SDL/issues/4019
2021-07-24 09:10:18 -07:00
german77
e6e8fe6d4e hidapi_switch: Implement analog rumble 2021-07-24 01:06:05 -07:00
Sam Lantinga
669714cafe Added the ThrustMaster T.16000M as a flightstick 2021-07-23 23:51:35 -07:00
Sam Lantinga
384d86b584 Fixed compile warnings with Visual Studio 2021-07-23 23:48:23 -07:00
Sam Lantinga
adb75d642c Fixed hotplug detection not working on UWP or when SDL isn't pumping Windows events
This fixes bugs:
https://github.com/libsdl-org/SDL/issues/4321
https://github.com/libsdl-org/SDL/issues/4147

Thanks to DJm00n for the suggestion!
2021-07-23 23:45:18 -07:00
Sam Lantinga
422b053b96 Added support for the full line of current PowerA Xbox Series X controllers 2021-07-23 16:32:35 -07:00
Sam Lantinga
dc6f044309 Added mapping for the Xbox Series X controller on tvOS 2021-07-12 17:57:21 -07:00
Sam Lantinga
947ad6e13a Added support for the Xbox Series X controller on iOS and tvOS 2021-07-12 17:57:21 -07:00
Sam Lantinga
24059a19c5 The RAWINPUT driver is no longer tied to HIDAPI in any way 2021-07-09 18:11:42 -07:00
Sam Lantinga
d135c0762f Added SDL_GameControllerSendEffect() and SDL_JoystickSendEffect() to allow applications to send custom effects to the PS4 and PS5 controllers
See testgamecontroller.c for an example of a custom PS5 trigger effect
2021-07-08 13:22:41 -07:00
Sam Lantinga
4a20dd3e54 Removed unnecessary comment, the mic button is in byte 16 on all firmware versions 2021-07-08 07:38:18 -07:00
Sam Lantinga
430bbcb87f Added HIDAPI support for the Amazon Luna Controller connected over USB in DirectInput mode 2021-07-07 09:49:33 -07:00
Sam Lantinga
863f566941 Fixed reading thumbstick axes and mic button on the Amazon Luna Controller firmware version 305164320 2021-07-07 08:55:16 -07:00
Dimitriy Ryazantcev
17ed8d8085 Added HIDAPI backend for Amazon Luna Controller Model T28B69 connected via Bluetooth LE (VID:0171, PID:0419).
To enter Bluetooth pairing mode hold B and Action (button with circle) buttons for 3 seconds.

It works via usual HIDAPI if special filter driver is not installed:
https://www.amazon.com/gp/help/customer/display.html?nodeId=GZCT4CTFHXLHEB9T

With that driver installed it mimics Xbox One controller and works via XInput under Windows.

Under DInput this controller is not usable at all.
2021-07-07 08:31:12 -07:00
Sam Lantinga
00d67620da Added the SteelSeries manufacturer to the Nimbus+ entry on macOS 2021-07-06 11:32:11 -07:00
Sam Lantinga
24e836b0db Added controller mapping for the Nimbus+ controller on macOS when MFi support is not available 2021-07-06 10:00:09 -07:00
Dimitriy Ryazantcev
39302c9214 Add Steam Virtual Gamepad and Xbox 360 Wired Controller defines instead of magic values
See  https://partner.steamgames.com/doc/features/steam_controller/steam_input_gamepad_emulation_bestpractices for details on what is Steam Virtual Gamepad.
2021-06-30 08:48:13 -07:00
Sam Lantinga
0c4ac33a09 Added support for the Razer Wolverine Tournament Edition controller 2021-06-28 14:31:27 -07:00
Joshua Ashton
ca383599b5 Fix Anne Pro II keyboard showing up as a joystick
Having used this for a couple years, I can definitely confirm that it is not a joystick.
2021-06-26 21:23:26 -07:00
Joshua Ashton
c90bd3bf79 Add missing PS5 DualSense GUIDs
Fixes my DualSense controller not being recognised as a SDL GameController which breaks Steam Input filtering causing SDL to fight for input.
2021-06-26 21:21:46 -07:00
Sam Lantinga
205b951b46 SDL_DINPUT_JoystickPresent() needs to do the full device enumeration
It is called from WGI before the normal joystick detection has been run, so it needs to actually enumerate currently connected devices.

We can skip the logic checking for other drivers also supporting this device, because that logic is duplicated from the call site.
2021-06-25 14:20:08 -07:00
Sam Lantinga
ae6d9e343b Correcting the name of the Amazon Luna Controller 2021-06-25 11:09:46 -07:00
Sam Lantinga
5042ab6f24 Added Linux and macOS mappings for the DirectInput mode of the Amazon Luna Controller 2021-06-24 18:09:06 -07:00
Sam Lantinga
5b051459ed Fixed warnings on Windows 2021-06-24 18:09:04 -07:00
Sam Lantinga
99700a5c52 SDL: add Windows mappings for Luna controllers for USB DirectInput mode and BT. Note: the triggers do not seem to work in BT mode. 2021-06-24 18:09:01 -07:00
Sam Lantinga
41fab8532d ControllerList: set the default deadzone for Ps5 controller back to same one as Xbox controllers. Too many users complained about drift. 2021-06-18 18:10:24 -07:00
Sam Lantinga
a8b28939a6 ControllerList: add more Xbox controllers from minidumps 2021-06-18 18:10:23 -07:00
Sam Lantinga
08eff56a5b ControllerList: add Brooks Mars controller to PS4 controller list 2021-06-18 18:10:22 -07:00
Sam Lantinga
afd100f02b Added support for the PowerA Fusion Pro 2 and the PDP Xbox Series X Afterglow and Blue controllers 2021-06-18 17:37:46 -07:00
Sam Lantinga
d8dba5bcf3 Added support for the Logitech G923 racing wheel 2021-06-17 11:22:08 -07:00
Paul Cercueil
db5cd8c694 joystick: virtual: Fix event injection for axes/hats
SDL_JoystickSetVirtualAxisInner() and SDL_JoystickSetVirtualHatInner()
did not properly sanitize the 'axis' and 'hat' parameters.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
2021-06-12 17:55:03 +03:00
Paul Cercueil
f3cf019ecb joystick: Add missing comma in joystick drivers list
Without this comma it is impossible to enable both the Vita and Dummy
drivers at the same time.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
2021-06-12 15:50:02 +03:00
Dimitriy Ryazantcev
f5122377c9 Move SDL_IsXInputDevice check above actual joystick allocation 2021-06-10 16:41:09 -07:00
Dimitriy Ryazantcev
766d81ec86 Rewrite SDL_DINPUT_JoystickPresent method to avoid costly IDirectInput8_CreateDevice calls 2021-06-10 16:41:09 -07:00
Dimitriy Ryazantcev
a6da2fbf73 Rename haptic methods to avoid confusion with joystick:
`SDL_DINPUT_MaybeAddDevice`->`SDL_DINPUT_HapticMaybeAddDevice`
`SDL_DINPUT_MaybeRemoveDevice`->`SDL_DINPUT_HapticMaybeRemoveDevice`
`SDL_XINPUT_MaybeAddDevice`->`SDL_XINPUT_HapticMaybeAddDevice`
`SDL_XINPUT_MaybeRemoveDevice`->`SDL_XINPUT_HapticMaybeRemoveDevice`
2021-06-10 16:41:09 -07:00
Dimitriy Ryazantcev
73dc68a7ae Simplify and cleanup DirectInput joystick backend code:
- Do not call IDirectInputDevice8_QueryInterface(device, &IID_IDirectInputDevice8,...) on DIRECTINPUTDEVICE8 device
- Get joystick VendorID and ProductID via IDirectInputDevice8_GetProperty(.., DIPROP_VIDPID, ..) call instead of messing with DIDEVICEINSTANCE.guidProduct
- Normalize HID device interface path to upper case for stable operation of XInput check
- Remove useless RawInput calls in SDL_IsXInputDevice() - just check for "IG_" string in HID device interface path that we already have

There shouldn't be any observable behavior changes.
2021-06-10 16:41:09 -07:00
Dimitriy Ryazantcev
f2f759dca3 Remove not used DirectInput ignored_devices list 2021-06-10 16:41:09 -07:00
Dimitriy Ryazantcev
adc2d362ba Remove outdated and not used WIN_IsXInputDevice code 2021-06-10 16:41:09 -07:00
Andrew Murray
cd67f42d8f
add Linux mapping for brook fighting board (#4416)
* added controller mapping for Brook fighting board

* fixed formatting on Brook Universal Fighting Board controller mapping entry
2021-06-04 09:20:47 -07:00
Sjoerd Simons
89fd9821de Add controller mapping for Atari vcs controllers
This add controller mappings for the Atari vcs (modern) controller as
well as the classic controller, for both bluetooth and USB connectivity.

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
2021-06-03 11:43:41 -07:00
Sjoerd Simons
de4ba6ebc0 Ignore the device version for Atari vcs controllers
At least on bluetooth the guid user the version reported by the
bluetooth device. Which for Atari vcs controllers is the firmware
version. However the mapping will stay the same regardless of firmware
version, so ignore the version entirely to avoid needing a new mapping
entry for each firmware version.

Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
2021-06-03 11:43:41 -07:00
Ozkan Sezer
f498c281e1 fixed build with SDL_JOYSTICK_RAWINPUT enabled after commit b81969d46f
See: https://github.com/libsdl-org/SDL/pull/4388#issuecomment-852713792
2021-06-02 14:10:50 +03:00
Timo Gurr
b63cb822bf Added T500RS to known wheel list 2021-06-01 09:54:58 -07:00
Dimitriy Ryazantcev
b81969d46f Be more explicit about Xbox 360/One device ids.
When Xbox One/Series Controllers are connected via USB on Windows they all are using `XBOXGIP` driver and produce a special ProductID `0x02FF` (GIP software PID) for any connected controller.

On the other hand `Xbox 360 Wireless Controller Reciever` (PID 0x0719) is using `XUSB` driver and produces special ProductID `0x02A1` (XUSB software PID) for each connected Xbox 360 Wireless Controller.

Also fixed Xbox One Series X Controller comment.
2021-06-01 09:54:13 -07:00
Sam Lantinga
3fcaf5b4b3 Fixed incorrect axis scaling for Nintendo Switch controllers 2021-05-25 10:33:30 -07:00
Sam Lantinga
333c8e75f1 The PS5 driver supports Joystick LED 2021-05-17 11:54:05 -07:00
Kimplul
9e1d7baef1 Added T300RS to known wheel list 2021-05-12 09:25:57 -07:00
Ryan C. Gordon
f4ab1c94f9
gamecontrollerdb: Add entry for the 8BitDo Receiver for Linux.
Fixes #3048.
2021-05-10 13:08:34 -04:00
Ryan C. Gordon
bedc509afc
gamecontrollerdb: added entry for PowerA XBox One Controller for Linux.
Fixes #3910.
2021-05-10 13:04:59 -04:00
Sam Lantinga
9231f1f1cf Added support for the PS5 controller on iOS and tvOS 2021-05-07 12:29:03 -07:00
Ethan Lee
40210f8945 winrt: Always use a thread for joystick support 2021-04-26 21:29:56 -04:00
Steven Noonan
4535d65491 HIDAPI_UpdateDiscovery: only treat "add" and "remove" events as relevant
I have a buggy system which reports a udev "change" event for an empty
USB-C port every 0.14 seconds, which causes annoying frame hitches
because SDL decides that means it needs to do a libusb hid_enumerate,
which is slow (~25ms!) because of the get_usb_string() calls in there.

We only need to re-enumerate if we've seen a device added or removed, so
let's filter out the change event first.

Signed-off-by: Steven Noonan <steven@valvesoftware.com>
Signed-off-by: Sam Lantinga <slouken@libsdl.org>
2021-04-22 16:40:16 -07:00
Sam Lantinga
499d31e9cd Cleanup Linux joystick code 2021-04-13 17:00:24 -07:00