|
0479df53
|
2023-01-09T09:48:21
|
|
Updated copyright for 2023
|
|
903df79b
|
2022-12-27T12:14:43
|
|
Make sure we match the same way when adding a mapping and looking up a mapping
Fixes https://github.com/libsdl-org/SDL/issues/6898
(cherry picked from commit 3db9112ef4cbb936b11f941f8a98c1704e37e140)
|
|
7a9966af
|
2022-12-14T14:24:58
|
|
Fixed crash in SDL_PrivateGameControllerRefreshMapping()
|
|
d59caffe
|
2022-12-13T14:03:40
|
|
Added support for clang thread-safety analysis
The annotations have been added to SDL_mutex.h and have been made public so applications can enable this for their own code.
Clang assumes that locking and unlocking can't fail, but SDL has the concept of a NULL mutex, so the mutex functions have been changed not to report errors if a mutex hasn't been initialized. We do have mutexes that might be accessed when they are NULL, notably in the event system, so this is an important change.
This commit cleans up a bunch of rare race conditions in the joystick and game controller code so now everything should be completely protected by the joystick lock.
To test this, change the compiler to "clang -Wthread-safety -Werror=thread-safety -DSDL_THREAD_SAFETY_ANALYSIS"
|
|
4ee36a94
|
2022-12-07T14:25:53
|
|
Added support for the DualSense Edge paddles
(cherry picked from commit 9339085593dc20b1f003f26b3c40615cf04504b0)
|
|
d0bbfdbf
|
2022-12-01T16:07:03
|
|
Clang-Tidy fixes (#6725)
(cherry picked from commit 3c501b963dd8f0605a6ce7978882df39ba76f9cd)
|
|
b8d85c69
|
2022-11-30T12:51:59
|
|
Update for SDL3 coding style (#6717)
I updated .clang-format and ran clang-format 14 over the src and test directories to standardize the code base.
In general I let clang-format have it's way, and added markup to prevent formatting of code that would break or be completely unreadable if formatted.
The script I ran for the src directory is added as build-scripts/clang-format-src.sh
This fixes:
#6592
#6593
#6594
(cherry picked from commit 5750bcb174300011b91d1de20edb288fcca70f8c)
|
|
fb0ce375
|
2022-11-27T17:38:43
|
|
Cleanup add brace (#6545)
* Add braces after if conditions
* More add braces after if conditions
* Add braces after while() conditions
* Fix compilation because of macro being modified
* Add braces to for loop
* Add braces after if/goto
* Move comments up
* Remove extra () in the 'return ...;' statements
* More remove extra () in the 'return ...;' statements
* More remove extra () in the 'return ...;' statements after merge
* Fix inconsistent patterns are xxx == NULL vs !xxx
* More "{}" for "if() break;" and "if() continue;"
* More "{}" after if() short statement
* More "{}" after "if () return;" statement
* More fix inconsistent patterns are xxx == NULL vs !xxx
* Revert some modificaion on SDL_RLEaccel.c
* SDL_RLEaccel: no short statement
* Cleanup 'if' where the bracket is in a new line
* Cleanup 'while' where the bracket is in a new line
* Cleanup 'for' where the bracket is in a new line
* Cleanup 'else' where the bracket is in a new line
(cherry picked from commit 6a2200823c66e53bd3cda4a25f0206b834392652 to reduce conflicts merging between SDL2 and SDL3)
|
|
ec58a817
|
2022-10-05T19:26:09
|
|
Fixes made in response to running a static code analyzer under MS Windows.
Most of these are probably harmless, but the changes to SDL_immdevice.c and SDL_pixels.c appear to have fixed genuine bugs.
SDL_audiocvt.c: By separating the calculation of the divisor, I got rid of the suspicion that dividing a double by an integer led to loss of precision.
SDL_immdevice.c: Added a missing test, one that could have otherwise led to dereferencing a null pointer.
SDL_events.c, SDL_gamecontroller.c, SDL_joystick.c, SDL_malloc.c, SDL_video.c: Made it clear the return values weren't used.
SDL_hidapi_shield.c: The size is zero, so nothing bad would have happened, but the SDL_memset() was still being given an address outside of the array's range.
SDL_dinputjoystick.c: Initialize local data, just in case IDirectInputDevice8_GetProperty() isn't guaranteed to write to it.
SDL_render_sw.c: drawstate.viewport could be null (as seen on line 691).
SDL.c: SDL_MostSignificantBitIndex32() could return -1, though I don't know if you want to cope with that (what I did) or SDL_assert() that it can't happen.
SDL_hints.c: Replaced boolean tests on pointer values with comparisons to NULL.
SDL_pixels.c: Looks like the switch is genuinely missing a break!
SDL_rect_impl.h: The MacOS static checker pointed out issues with the X comparisons that were handled by assertions; I added assertions for the Y comparisons.
SDL_yuv.c, SDL_windowskeyboard.c, SDL_windowswindow.c: Checked error-result returns.
|
|
6432f45a
|
2022-11-08T10:27:21
|
|
Don't treat the Nintendo IMU as a separate game controller on Linux
|
|
a2d66b6a
|
2022-11-05T13:12:10
|
|
SDL_GameControllerMapping() should return the string for the actual mapping that was used when opening a gamecontroller, rather than do a GUID match again
Also don't match against the zero guid if that happens to be in the mapping list for some reason
|
|
e837debc
|
2022-10-25T16:13:50
|
|
Bindings should have a trailing comma, so the CRC can be appended
|
|
a6018ae5
|
2022-10-25T10:23:51
|
|
Added support for the NVIDIA SHIELD controller v1.03 to the HIDAPI driver
|
|
b4c25f57
|
2022-10-02T09:51:05
|
|
Remapped the side button and trigger as paddles for the mini-gamepad mode of the Joy-Cons
This is the only case where the mapping differs between right and left Joy-Cons in mini-gamepad mode. The left Joy-Con will have the left paddles and the right Joy-Con will have the right paddles. This facilitates co-op gameplay with individual actions while still using the normal mini-gamepad mode.
The paddles are used for this because conceptually they are more awkward to hit than the normal controls and they are in roughly the correct hand position.
|
|
f58a6506
|
2022-10-02T09:50:27
|
|
Added paddle mapping for combined Joy-Cons
|
|
6c8bf3af
|
2022-10-03T00:19:34
|
|
Add vertical mode for Nintendo Joy-Con (#6303)
* Added support for vertical mode for Joy-Con controllers
* Added the hint SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS for switching to this mode
* Added support for SL/SR buttons in combined/vertical mode and L/ZL/R/ZR buttons in mini-gamepad mode
|
|
2c518747
|
2022-09-27T09:56:02
|
|
Added microsecond timestamp to sensor values for PS4 and PS5 controllers using the HIDAPI driver
|
|
fa2063fb
|
2022-09-22T23:42:25
|
|
Improved detection of third party PS4 and PS5 controllers
|
|
4f1b408a
|
2022-09-12T18:19:02
|
|
Fixed button mapping for PS5 controllers
|
|
787cd580
|
2022-09-08T23:00:04
|
|
silence unused function warning for SDL_endswith() on non-linux.
|
|
42cf6d6c
|
2022-09-07T01:41:11
|
|
Don't treat the Wii extension controls as a separate game controller on Linux
|
|
30f55a5d
|
2022-09-06T23:33:55
|
|
Added initial support for the Wii Motion Plus extension
This adds a gyro sensor to the Wii controller, and is enabled in standalone and nunchuk mode
|
|
a61b823d
|
2022-09-05T14:31:25
|
|
Added support for the Wii Remote with the Classic Controller Pro extension
Also changed event order to: buttons, triggers, axes, for consistency with other drivers
|
|
396411c0
|
2022-09-01T20:27:34
|
|
Added mapping for the Wii Nunchuk extension
|
|
7708bf0f
|
2022-09-01T08:18:58
|
|
Try matching game controller mappings on CRC and version and fall back to no CRC and no version, in that order.
We do exact match when adding mappings, but loose matching everywhere else we look up a mapping for a GUID.
|
|
0e4baf1c
|
2022-08-30T12:39:23
|
|
Don't crash if SDL functions are passed a closed joystick or gamecontroller
|
|
0b8b321f
|
2022-08-28T23:01:30
|
|
Allow the product version to be different when trying to find a controller mapping
This is in the hope that revving the product version doesn't change the mapping, which is the case for some devices. In cases where it does, we just need to provide a mapping for each version of the product.
|
|
3cbfd75d
|
2022-08-27T18:55:55
|
|
Re-added the CRC to the joystick guid
This is now used as a crc field in the mapping rather than directly in mapping guids, for better mapping compatibility between versions of SDL.
Added SDL_GetJoystickGUIDInfo() to get device information encoded in a joystick GUID, so that mapping programs can clear the CRC from the GUID when generating mappings.
sort_controllers.py has been updated to extract the CRC from mappings created by older mapping programs and convert it into the new crc field. It will also take the CRC into account when checking for duplicate mappings.
Also regenerated the GUIDs for the PS2/PSP/Vita controller mappings, fixing https://github.com/libsdl-org/SDL/issues/6151
|
|
e7332cd8
|
2022-08-24T15:28:56
|
|
Fixed zero CRC matching in the controller mapping database
|
|
b6a3d762
|
2022-08-23T07:24:21
|
|
Look up mappings by GUID in two passes: first with CRC, second without
|
|
c1e08739
|
2022-08-22T16:46:55
|
|
Added the CRC of the joystick name to the GUID
This will make it possible to have mappings for different controllers
that have the same VID/PID. This happens frequently with some generic
controller boards that have been reused in many products.
Fixes https://github.com/libsdl-org/SDL/issues/6004
|
|
b2819e43
|
2022-08-22T13:10:57
|
|
Send SDL_CONTROLLERDEVICEREMOVED for all joysticks because we don't know after the fact whether it was a game controller.
Fixes https://github.com/libsdl-org/SDL/issues/2092
|
|
bf925b9e
|
2022-08-11T14:41:48
|
|
Fixed build
|
|
24f97dd7
|
2022-08-11T14:39:49
|
|
Added an SDL error to SDL_GameControllerMapping* functions
|
|
28c01955
|
2022-08-04T10:46:37
|
|
Fixed button mapping for the HORIPAD S
This controller actually comes in at least two flavors: a GameCube controller and an arcade pad, neither of which should have the face buttons remapped.
|
|
57c3b2c9
|
2022-08-03T21:31:12
|
|
Don't rely on the device VID/PID to get the Nintendo controller type
The Nintendo Online Sega Genesis controller reports the SNES VID/PID over Bluetooth. This is a more robust way of handling future controllers as well, so let's go with this instead.
Also use full reports over Bluetooth, and don't report gyro for Nintendo Online classic controllers.
|
|
29cdb2c9
|
2022-08-03T18:01:10
|
|
Added support for the Nintendo Switch Joy-Con Charging Grip
|
|
875b737c
|
2022-07-28T21:39:32
|
|
Added support for the Nintendo Online NES Controllers to the HIDAPI driver
|
|
2fa2f9ff
|
2022-07-28T19:22:27
|
|
Greatly improved Nintendo Joy-Con support using the HIDAPI driver
* Added support for mini-gamepad mode for Joy-Con controllers, matching the mapping for hid-nintendo on Linux and iOS 16
* Added the ability to merge left and right Joy-Con controllers into a single Pro-style controller
* Added the hint SDL_HINT_JOYSTICK_HIDAPI_SWITCH_COMBINE_JOY_CONS to control this merging functionality
* Removed the hint SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS
|
|
0ec5bb4e
|
2022-07-25T10:37:23
|
|
Add missing controller events to `SDL_GameControllerEventState()`
Events to handle controller touchpads and sensors were added to the library but not added in `SDL_GameControllerEventState()`. This change adds the missing events.
|
|
e24b971a
|
2022-07-12T17:53:03
|
|
Added support for the NVIDIA Shield controller guide button
|
|
6e712d24
|
2022-07-09T22:55:36
|
|
joystick: Add HIDAPI driver for NVIDIA SHIELD 2017 controller
Basic input already works using the OS HID driver, but this enables
force feedback and battery state reporting.
|
|
3b191580
|
2022-06-27T17:19:39
|
|
Windows GDK Support (#5830)
* Added GDK
* Simplfied checks in SDL_config_wingdk.h
* Added testgdk sample
* Added GDK readme
* Fixed error in merge of SDL_windows.h
* Additional GDK fixes
* OpenWatcom should not export _SDL_GDKGetTaskQueue
* Formatting fixes
* Moved initialization code into SDL_GDKRunApp
|
|
68544be4
|
2022-06-10T11:31:59
|
|
Added support for the Nintendo Online controllers
|
|
c7f41038
|
2022-06-09T13:47:29
|
|
Special case for k_eControllerType_XInputSwitchController in the raw input path
|
|
e6cb0822
|
2022-06-09T13:20:38
|
|
Fixed the default mapping on Windows for the HORI Fighting Commander
|
|
423141bf
|
2022-06-03T18:49:41
|
|
Added a function to get the controller firmware version
|
|
7fa46ec4
|
2022-05-31T11:11:19
|
|
The Google Pixel fingerprint sensor also shows up on Linux when running on the phone
|
|
47f1cb55
|
2022-05-18T23:48:15
|
|
Fixed picking up the correct mapping for virtual controllers on Android
Fixes https://github.com/libsdl-org/SDL/issues/5662
|
|
94eeb587
|
2022-05-15T20:01:12
|
|
First pass at extending virtual controller functionality
Added the ability to specify a name and the product VID/PID for a virtual controller
Also added a test case to testgamecontroller, if you pass --virtual as a parameter
|
|
7ad15c5b
|
2022-05-15T09:35:52
|
|
Added game controller support for virtual joysticks
Fixes https://github.com/libsdl-org/SDL/issues/5662
|
|
e551384a
|
2022-04-26T14:54:14
|
|
Added functions to get the platform dependent name for a joystick or game controller
|
|
120c76c8
|
2022-01-03T09:40:00
|
|
Updated copyright for 2022
|
|
61107494
|
2021-12-17T07:40:02
|
|
SDL_gamecontroller.c: (unsigned char) cast to SDL_isdigit() parameters.
|
|
a2e85652
|
2021-11-26T11:04:15
|
|
The Google Pixel fingerprint sensor isn't actually a joystick
Fixes https://github.com/libsdl-org/SDL/issues/4971
|
|
6828955d
|
2021-11-19T09:58:11
|
|
Trim any extra platform strings from mappings when they're returned to the application
|
|
fe09a493
|
2021-11-11T15:53:11
|
|
joystick: Add APIs to query rumble support
|
|
301389ce
|
2021-11-07T13:52:59
|
|
Fixed iOS build
|
|
0323d983
|
2021-11-07T12:52:06
|
|
Add the platform to the game controller mapping so it can be read back in without changes
Fixes https://github.com/libsdl-org/SDL/issues/4848
|
|
86bc65a7
|
2021-11-07T11:35:12
|
|
Fixed non-Apple builds
|
|
9fdb0645
|
2021-08-04T11:33:28
|
|
Added support for the Joy-Con Charging Grip when SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS is enabled
|
|
2dfc92ca
|
2021-08-03T01:33:35
|
|
Added default mapping for WGI game controllers
|
|
993a5676
|
2021-08-03T00:14:15
|
|
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
|
|
a186a503
|
2021-07-29T06:43:39
|
|
Added SDL_GameControllerGetSensorDataRate() to get the sensor update rate for a controller.
|
|
09d1cea7
|
2021-07-24T11:15:09
|
|
Use the new controller type for the Luna and Stadia controllers
|
|
808c3ae6
|
2021-07-24T10:36:56
|
|
Allow mapping Android controllers that just have a D-PAD and face buttons
This fixes bug https://github.com/libsdl-org/SDL/issues/4327
|
|
d135c076
|
2021-07-08T13:22:41
|
|
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
|
|
430bbcb8
|
2021-07-07T09:49:33
|
|
Added HIDAPI support for the Amazon Luna Controller connected over USB in DirectInput mode
|
|
863f5669
|
2021-07-07T08:55:16
|
|
Fixed reading thumbstick axes and mic button on the Amazon Luna Controller firmware version 305164320
|
|
39302c92
|
2021-06-02T14:28:33
|
|
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.
|
|
afd100f0
|
2021-06-18T17:37:46
|
|
Added support for the PowerA Fusion Pro 2 and the PDP Xbox Series X Afterglow and Blue controllers
|
|
ee52624f
|
2021-02-22T17:23:13
|
|
Switch Joy-Con SL and SR buttons are now mapped to matching paddle positions so that all buttons can be accessed when using SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS
|
|
1a17ab30
|
2021-02-21T11:03:26
|
|
Added mappings for popular controllers on Chromebooks
|
|
85235985
|
2021-02-02T11:53:31
|
|
Fixed detecting the paddles on the Xbox Elite Series 1 controller
|
|
1981d23f
|
2021-01-23T11:06:35
|
|
Fixed bug 5466 - Add haptic support for Stadia Controller
Dimitriy Ryazantcev
Consider adding support for Stadia Controller haptics.
Here is example code how to deal with it:
https://github.com/chromium/chromium/blob/99314be8152e688bafbbf9a615536bdbb289ea87/device/gamepad/hid_haptic_gamepad.cc#L45
|
|
f68b36df
|
2021-01-22T11:42:42
|
|
Added support for the EVORETRO GameCube Adapter in PC mode
|
|
178ae70a
|
2021-01-20T12:18:10
|
|
Don't add paddle mappings for the Xbox One Elite Series 1 controller, since they can't be unmapped and read directly on that controller.
|
|
2ea393bd
|
2021-01-15T14:36:21
|
|
Fixed the screenshot button mapping on third party Bluetooth Nintendo Switch Pro controllers
|
|
b3848c51
|
2021-01-14T15:15:57
|
|
Fixed bug 5445 - Incorrect Switch Pro Controller face buttons when SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS disabled
jibb
I'm testing with DualShock 4, DualSense, Switch Pro Controller, and PowerA Switch Controller.
I'm using the standard mapping file from here:
https://raw.github.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt
With SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS turned off (set to "0") I expect the button positions to be the same on all devices, based on Xbox controller button naming (eg SDL_GameControllerGetButton(g, SDL_CONTROLLER_BUTTON_Y) gives me whether the North face button is pressed).
However, the Switch Pro Controller layout is wrong (matching labels rather than positions, so X and Y are swapped and A and B are swapped). And with the PowerA controller the East and West buttons are correct, but the North and South buttons are swapped instead.
Mathias Kaerlev
Also seeing this on 2.0.14. This is most likely a regression, since we weren't seeing this on an earlier SDL version.
I suspect it might be caused by this commit:
https://github.com/spurious/SDL-mirror/commit/a569b211881c6d4c73f3f1019e9f66e754ca546b#diff-da9344d94c66b8c702a45e7649f412039f08bba83bd82de33f5c80ea9c8c39d5
It seems like both the HIDAPI driver and SDL_gamecontroller.c will try to swap the buttons if the hint is set to 0, causing the button remap to cancel out.
|
|
9130f7c3
|
2021-01-02T10:25:38
|
|
Updated copyright for 2021
|
|
4ec776c3
|
2020-12-22T13:29:23
|
|
Don't switch the PS5 controller out of DirectInput mode by default
|
|
cb361896
|
2020-12-09T07:16:22
|
|
Fixed bug 5235 - All internal sources should include SDL_assert.h
Ryan C. Gordon
We should really stick this in SDL_internal.h or something so it's always available.
|
|
4fbefbe2
|
2020-11-27T11:33:53
|
|
Sort the raw input axes by usage, so X comes before Y, etc.
|
|
5b3616c3
|
2020-11-23T18:24:05
|
|
Generalized the raw input controller driver and moved XInput/WGI detection into it for XInput devices
This fixes bad report parsing for various newer Xbox controllers, and this driver is now preferred over XInput, since it handles more than 4 controllers.
|
|
6cb7f9e3
|
2020-11-19T19:09:40
|
|
Respect SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS for Nintendo Switch Pro controllers using the HIDAPI driver
|
|
fcb21aa8
|
2020-11-17T10:30:20
|
|
Added API for sensors on game controllers
Added support for the PS4 controller gyro and accelerometer on iOS and HIDAPI drivers
Also fixed an issue with the accelerometer on iOS having inverted axes
|
|
d140d887
|
2020-11-16T17:36:47
|
|
Added SDL_JoystickGetSerial() and SDL_GameControllerGetSerial()
|
|
9f51fad3
|
2020-11-13T18:01:29
|
|
Added support for the touchpad on PS4 and PS5 controllers
|
|
1e2caac5
|
2020-11-11T18:57:37
|
|
Added SDL_JoystickRumbleTriggers() and SDL_GameControllerRumbleTriggers()
|
|
e12457d8
|
2020-11-10T12:26:30
|
|
Added support for the Xbox Series X controller to the HIDAPI driver
|
|
009b62f1
|
2020-11-07T02:22:15
|
|
Be explicit about mapping the new game controller paddle buttons
|
|
3a3aaac2
|
2020-11-06T11:30:52
|
|
Added 4 auxiliary buttons to the game controller API
Xbox Elite controllers use AUX1-AUX4 to represent the paddle buttons when using the HIDAPI driver
PS4 and PS5 controllers use AUX1 to represent the touchpad button
Nintendo Switch Pro controllers use AUX1 to represent the capture button
|
|
e555d453
|
2020-11-05T11:07:54
|
|
Added SDL_JoystickHasLED
Currently, this is only supported by the PS4 HIDAPI driver.
|
|
99ed0d7a
|
2020-10-16T12:40:12
|
|
Map the guide button by default on Android 11
|
|
9d40a0f3
|
2020-08-29T16:50:26
|
|
Fix joystick device add events containing invalid device indexes
This can happen if the application has not yet processed SDL_JOYDEVICEADD when
the same joystick is removed. It may also happen if two joysticks are added
and the second joystick is removed before the first joystick's SDL_JOYDEVICEADD
has been processed by the application.
|
|
cab1a715
|
2020-07-15T10:15:52
|
|
Fixed bug 5233 - PS3 Gamepad Motion Control not correctly ignored on Linux
Igor Morgado
PS3 Controller motion sensor string is being reported as
`Gasia Co.,Ltd PS(R) Gamepad Motion Sensors`
But `src/joystick/SDL_gamecontroller.c` line1690 only ignores if matches the string `Controller Motion Sensors`.
```
#if defined(__LINUX__)
if (name && SDL_strstr(name, "Controller Motion Sensors")) {
/* Don't treat the PS3 and PS4 motion controls as a separate game controller */
return SDL_TRUE;
}
#endif
```
Therefore, SDL is mapping 2 Game controllers instead one.
Maybe reduce the substring to match `Motion Sensors` instead.
A simple log from my application is shown below:
INFO: Game controller device 0 - PS3 Controller:PS3 Controller found.
INFO: Controller 0: Player 0: 054c:0268:8111 - PS3 Controller - PS3 Controller - Gasia Co.,Ltd PS(R) Gamepad
INFO: Game controller device 1 - PS3 Controller:PS3 Controller found.
INFO: Controller 1: Player 1: 054c:0268:8111 - PS3 Controller - PS3 Controller - Gasia Co.,Ltd PS(R) Gamepad Motion Sensors
|
|
39c958bb
|
2020-05-29T14:48:39
|
|
Initialize the raw_map before getting controller mappings from the driver
|
|
345b4d7e
|
2020-05-29T13:37:21
|
|
Fixed bug 5161 - Autodetect controller mappings based on the Linux Gamepad Specification
Jan Bujak
I wrote a new driver for my gamepad on Linux. I'd like SDL to support it out-of-box, as currently it just treats it as a generic joystick instead of a gamepad. From what I can see the only way to do that is to either 1) pick one of the already supported controllers' PID, VID and button layouts and have my driver send that (effectively lying that it's something else), or 2) submit a preconfigured, hardcoded mapping to SDL.
Both of those, in my opinion, are silly when we already have the Linux Gamepad Specification which standarizes this:
https://www.kernel.org/doc/html/v4.15/input/gamepad.html
Unfortunately SDL doesn't make use of it currently. So I've took it upon myself to add it; patch is in the attachments.
Basically what the patch does is that if SDL finds no built-it controller mappings for a given joystick it then asks the joystick backend to autodetect it, and that uses the relevant evdev bits to figure out which button/axis is which. (See the specs for more details.)
With this patch applied my own driver for my controller works out-of-box with SDL with no extra configuration and is correctly recognized as a gamepad; this is also going to be the case for any other driver which follows the Linux Gamepad Specification.
|
|
83cddd2e
|
2020-04-30T11:57:29
|
|
Add SDL_JoystickSetLED.
Currently, this is only supported by the PS4 HIDAPI driver.
|
|
67760f0e
|
2020-04-20T18:58:18
|
|
joystick: Don't report duplicate recentering events for game controllers.
|