Commit Graph

1868 Commits

Author SHA1 Message Date
Max Maisel
5a21febecb Add new steam deck HIDAPI controller to controller database. 2023-12-12 12:51:37 -08:00
Max Maisel
67d44c1017 Disable lizard mode while steam deck HID device is opened. 2023-12-12 12:51:37 -08:00
Max Maisel
6dd6827343 Translate steam deck HID reports to SDL events. 2023-12-12 12:51:37 -08:00
Max Maisel
94f621e030 Implement steam deck HIDAPI initialization. 2023-12-12 12:51:37 -08:00
Max Maisel
c1a7d0f96e Add steam deck detection and HIDAPI driver scaffold. 2023-12-12 12:51:37 -08:00
Dimitriy Ryazantcev
c790572674 Use existing XUSB driver software PID 0x02a1 instead of PID 0x02fe
0x02fe is actually PID of Xbox Wireless Adapter for Windows 10 (Model 1790) and creates confusion.

Here is USB descriptor dump: https://github.com/DJm00n/ControllersInfo/blob/master/xboxone/DescriptorDump_Adapter%20(Xbox%20Wireless%20Adapter%20for%20Windows).txt
2023-12-11 11:45:05 -08:00
Sam Lantinga
5173b0c2cc Make built-in joystick device lists extendable by using hints
Fixes https://github.com/libsdl-org/SDL/issues/8595
2023-12-10 12:53:03 -08:00
Sam Lantinga
34eb24ebc4 Back out Steam virtual gamepad changes
We are planning a different approach to handle these
2023-12-10 08:35:35 -08:00
Sam Lantinga
7529d25b2b Use the Steam virtual gamepad slot as the gamepad player index 2023-12-09 21:00:32 -08:00
Sam Lantinga
17723381da Sort Steam virtual gamepads by Steam controller slot
This makes sure that games launched by Steam see the first controller first, and the controllers in the game match up with the controllers in the Steam UI.

Fixes https://github.com/libsdl-org/SDL/issues/8672
2023-12-09 20:33:05 -08:00
Sam Lantinga
8e0d728c67 Fixed warning C26451: Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2). 2023-12-05 09:31:13 -08:00
Sam Lantinga
6a736d7766 Fixed warning C6340: Mismatch on sign: 'unsigned char' passed as _Param_(2) when some signed type is required in call to 'SDL_SetError_REAL'. 2023-12-05 09:31:13 -08:00
Sam Lantinga
1fcc75ba81 Fixed warning C6340: Mismatch on sign: 'unsigned char' passed as _Param_(4) when some signed type is required in call to 'SDL_snprintf_REAL'. 2023-12-05 09:31:13 -08:00
Sam Lantinga
7f2e16db8b Fixed warning C6340: Mismatch on sign: 'const unsigned short' passed as _Param_(2) when some signed type is required in call to 'SDL_SetError_REAL'. 2023-12-05 09:31:13 -08:00
Sam Lantinga
163de8e697 Fixed warning C6001: Using uninitialized memory 'rdi'. 2023-12-05 09:31:13 -08:00
Sam Lantinga
e29393e407 Fixed warning C6001: Using uninitialized memory 'devName'. 2023-12-05 09:31:13 -08:00
Sam Lantinga
0f34ca2e71 Fixed analyze warnings in SDL_xinputjoystick.c
warning C6340: Mismatch on sign: 'int' passed as _Param_(4) when some unsigned type is required in call to 'SDL_snprintf_REAL'.
warning C6001: Using uninitialized memory 'devName'.
warning C6340: Mismatch on sign: 'unsigned char' passed as _Param_(4) when some signed type is required in call to 'SDL_snprintf_REAL'.
warning C6221: Implicit cast between semantically different integer types:  comparing HRESULT to an integer.  Consider using SUCCEEDED or FAILED macros instead.
2023-12-05 09:31:13 -08:00
Sam Lantinga
14380ec48a Fixed signed/unsigned comparison warning 2023-12-03 15:07:08 -08:00
Dimitriy Ryazantcev
744a29b88f WGI: Cleanup code a bit (#8647) 2023-11-30 11:53:00 -08:00
Ryan C. Gordon
447b508a77 error: SDL's allocators now call SDL_OutOfMemory on error.
This means the allocator's caller doesn't need to use SDL_OutOfMemory directly
if the allocation fails.

This applies to the usual allocators: SDL_malloc, SDL_calloc, SDL_realloc
(all of these regardless of if the app supplied a custom allocator or we're
using system malloc() or an internal copy of dlmalloc under the hood),
SDL_aligned_alloc, SDL_small_alloc, SDL_strdup, SDL_asprintf, SDL_wcsdup...
probably others. If it returns something you can pass to SDL_free, it should
work.

The caller might still need to use SDL_OutOfMemory if something that wasn't
SDL allocated the memory: operator new in C++ code, Objective-C's alloc
message, win32 GlobalAlloc, etc.

Fixes #8642.
2023-11-30 00:14:27 -05:00
Ryan C. Gordon
dd47da8a5c gamepad: Replace GetNumMappings/GetMappingByIndex with a single function.
Now it returns an array and optional count, to match other SDL3 APIs.
2023-11-29 20:50:44 -05:00
Sam Lantinga
571e9796b9 Fixed the GameCube HIDAPI controller mapping
Fixes https://github.com/libsdl-org/SDL/issues/8617
Closes https://github.com/libsdl-org/SDL/pull/8623
Closes https://github.com/libsdl-org/SDL/pull/7930
2023-11-28 10:07:06 -08:00
Sam Lantinga
dd984dcd9f Removed HIDAPI controller mappings
These are already provided internally by SDL
2023-11-28 09:54:35 -08:00
Sam Lantinga
f0e47f8ee0 Added support for the NACON Revolution 5 Pro controller 2023-11-27 12:10:00 -08:00
Sam Lantinga
45938bbfa5 Corrected comment 2023-11-22 10:35:15 -08:00
zoeyjodon
059e550e98 Fix 3DS Analog Values (#8581) 2023-11-22 10:34:01 -08:00
zoey jodon
dbf14df80f Fix joysticks returning invalid device IDs 2023-11-22 10:33:11 -08:00
Anonymous Maarten
f26a93211f SDL_bsdjoystick: fix -Wundef warning on FreeBSD 2023-11-22 06:23:00 +03:00
Ozkan Sezer
94ad1a4ae4 SDL_bsdjoystick.c: fix -Wundef warning. 2023-11-22 06:21:28 +03:00
Sam Lantinga
e761770c24 No, this wasn't right 2023-11-21 15:26:53 -08:00
Sam Lantinga
b7d7e54895 Fixed uninitialized variable 2023-11-21 15:26:34 -08:00
Sam Lantinga
119e02f314 Always use 'm' for controllers provided by the MFI joystick driver
This makes sure that SDL_JoystickGUIDUsesVersion() returns false and we don't try to match against other similar controllers using old mappings.
2023-11-21 15:19:23 -08:00
Sam Lantinga
75df4cc5c2 Don't tickle PS4 Bluetooth controllers in simple mode
The 8BitDo Zero 2 only sends reports when state changes, so trips the disconnected Bluetooth controller detection. The expected use case is that most people will have official PS4 controllers in enhanced report mode, so disconnected Bluetooth controller detection will still work for those.

Fixes https://github.com/libsdl-org/SDL/issues/8556
2023-11-21 13:25:02 -08:00
Sam Lantinga
666301f9f9 Fixed build with older macOS SDK 2023-11-16 21:01:28 -08:00
Sam Lantinga
238987df3b Always use physicalInputProfile on OS versions that support it
Also cleaned up @available warnings in the GCController support
2023-11-16 16:08:53 -08:00
Sam Lantinga
e424dcca4b More fixing the build with older macOS SDKs 2023-11-16 12:04:45 -08:00
Sam Lantinga
4ebb0c6dac Revert "Fixed build"
This reverts commit 7abacc9f9f.
2023-11-16 12:03:39 -08:00
Sam Lantinga
7abacc9f9f Fixed build 2023-11-16 11:44:59 -08:00
Sam Lantinga
ac1f896f89 Fixed building with older macOS SDK 2023-11-16 10:49:13 -08:00
Sam Lantinga
f61c0f3dc1 SDL_HINT_TV_REMOTE_AS_JOYSTICK should only affect Siri Remotes on Apple TV
Other gamepads like the iBuffalo Classic USB Gamepad will not have a standard profile, but shouldn't be ignored when this hint is enabled.
2023-11-16 09:19:27 -08:00
Sam Lantinga
51fc134cad Added support for the second generation Siri Remote on Apple TV 2023-11-16 09:07:29 -08:00
Sam Lantinga
bfba9de43a Revert "Map Siri Remote touchpad to D-Pad for consistency with physicalInputProfile mapping"
This reverts commit 2999634f29.

The physicalInputProfile mapping maps the touchpad to left thumbstick now, as the 2nd generation Siri Remote has both touchpad and cardinal direction D-Pad functionality
2023-11-16 09:07:29 -08:00
Sam Lantinga
57e5c7f6ee We'll just use the legacy names for face buttons in the mappings
This fixes being able to accidentally rebind the face buttons in testcontroller
2023-11-15 22:09:09 -08:00
Sam Lantinga
fb08c22abf Disable controller state debug messages 2023-11-15 21:46:45 -08:00
Sam Lantinga
2999634f29 Map Siri Remote touchpad to D-Pad for consistency with physicalInputProfile mapping 2023-11-15 21:04:25 -08:00
Sam Lantinga
64939d3586 Switch the menu button on the Apple TV remote to the B button to match UI guidelines 2023-11-15 21:04:25 -08:00
Sam Lantinga
0fe5713964 Improved GCController handling on Apple platforms
Automatically map controllers as gamepads when using the GCController framework and prefer the physicalInputProfile when possible.

Testing with macOS 13.4.1, macOS 14.1.1, iOS 15.7.4, tvOS 17.1:
* iBuffalo Classic USB Gamepad (macOS only)
* Logitech F310 (macOS only)
* Apple TV remote (tvOS only)
* Nimbus MFi controller
* PS4 DualShock controller
* PS5 DualSense controller
* Xbox Series X controller
* Xbox Elite Series 2 controller
* Nintendo Switch Pro controller
* Nintendo Switch Joy-Con controllers
2023-11-15 21:04:25 -08:00
Sam Lantinga
34392db9c3 Fixed IOS_SupportedHIDDevice() returning SDL_FALSE before initialization 2023-11-14 10:57:47 -08:00
Sam Lantinga
708f18d49e Added SDL_HINT_JOYSTICK_IOKIT and SDL_HINT_JOYSTICK_MFI to control whether the IOKit and GCController drivers should be used for joystick support.
This can be used to work around issues where the Apple GCController driver doesn't work for some controllers but there's no way to know which GCController maps to which IOKit device.
2023-11-14 10:28:19 -08:00
Sam Lantinga
f5600fd9f4 Fall back to using the physical profile for Apple controllers if they don't match a standard profile
We may want to flip this to be the default, but it needs more testing.
2023-11-14 06:29:09 -08:00