Commit Graph

808 Commits (3527b49459ab730a09cb646361ae7528a26a2cf8)

Author SHA1 Message Date
Sam Lantinga 9fa8d6d0be Define constants not available on older kernels 2020-06-08 17:07:55 -07:00
Sam Lantinga eea0b0e088 Fixed bug 5168 - Memory leak in RAWINPUT_JoystickOpen
meyraud705

Variable 'hwdata' is not freed in RAWINPUT_JoystickOpen if device->driver->OpenJoystick() fails.
2020-06-02 17:08:31 -07:00
Cameron Gutman 134362e745 Enable Xbox One HIDAPI driver on macOS
The Xbox One HIDAPI driver is required on macOS for Xbox One S Bluetooth
support since https://hg.libsdl.org/SDL/rev/10c3a10908e9
2020-04-25 19:15:51 -07:00
Sam Lantinga ac1f174ad5 Fixed bug 5167 - Memory leak in GuessXInputDevice
meyraud705

Variable 'devices' is not freed if function GuessXInputDevice, in SDL_xinputjoystick.c, return early.
2020-06-02 17:02:37 -07:00
Sam Lantinga d000c1cd6d Fixed bug 5155 - HIDAPI_JoystickDisconnected incorrect array shift
Anthony Pesch

I was looking into my own input bug and noticed an issue in the HIDAPI code while looking over it. I don't have a controller that goes down this path to test and try to provoke the issue, but it looks pretty straight forward.

The memmove to shift the joystick id array on disconnect isn't scaling the size by sizeof(SDL_JoystickID), likely corrupting the ids on disconnect.
2020-05-29 21:22:11 -07:00
Sam Lantinga ae9ff11bae The zero happens at a higher level now 2020-05-29 14:54:07 -07:00
Sam Lantinga 39c958bbaa Initialize the raw_map before getting controller mappings from the driver 2020-05-29 14:48:39 -07:00
Sam Lantinga 2db049473b Fixed variable names to be consistent across functions 2020-05-29 14:48:05 -07:00
Sam Lantinga 345b4d7e14 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.
2020-05-29 13:37:21 -07:00
Brendan Shanks 032fa681a8 Add Logitech G29 to steering wheel list 2020-04-24 14:03:30 -07:00
Sam Lantinga 1a1f1704a2 Don't include the iOS joystick driver if joysticks are disabled 2020-05-27 10:35:43 -07:00
Sam Lantinga e9f567c707 Fixed building on iOS with MFI controllers disabled 2020-05-27 10:14:08 -07:00
Ryan C. Gordon 5fe34a4079 hidapi: Fix compiler warning. 2020-05-20 17:01:25 -04:00
Ryan C. Gordon 68777406e5 windows: Fix calls to CoCreateInstance() so last parameter is a LPVOID *. 2020-05-20 16:58:33 -04:00
Sam Lantinga 1e5dd06f83 Added support for the HORI Real Arcade Pro on Mac OSX and Linux 2020-05-06 12:19:58 -07:00
Sam Lantinga cd2bdaef1c ControllerList: add PDP Faceoff Deluxe Audio Switch Controller and HORI Real Arcade Pro V Switch Edition 2020-05-06 11:19:52 -07:00
Sam Lantinga 0e5b48d2d8 ControllerList: add NACON Revolution Unlimited (and it's dongle) and NACON Daija fight stick. 2020-05-06 11:19:47 -07:00
Sam Lantinga 11723411ab Added support for the Razer Kishi 2020-05-04 10:16:10 -07:00
Sam Lantinga b0b12e46ba Fixed running on older versions of iOS 2020-04-27 13:31:10 -07:00
Sam Lantinga 01fd8130fd Fixed compiler warning 2020-04-23 11:13:02 -07:00
Sam Lantinga c6b24b4b7c Added support for the following controllers:
* 8BitDo N30 Pro 2
* 8BitDo SN30 Gamepad
* 8BitDo SN30 Pro+
* 8BitDo Zero 2
* SZMY-POWER PC Gamepad
* ThrustMaster eSwap PRO Controller
* ZEROPLUS P4 Wired Gamepad

In additional, all 8BitDo controllers use SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS to have the correct mapping based on user preferences.
2020-04-23 11:07:07 -07:00
Sam Lantinga 4727f79416 Don't use the WGI driver if another driver is already handling the joystick 2020-04-23 10:13:17 -07:00
Sam Lantinga 6ca7f510ae Fixed crash trying to get battery status on some devices 2020-04-23 09:35:32 -07:00
Sam Lantinga d12ea89c1e Added support for the following controllers:
* PDP Afterglow Switch Controller
* Thrustmaster ESwap Pro PS4 controller
* Giotek VX4
* Generic PS4 controller vid/pid that several knock offs use
2020-04-22 10:50:50 -07:00
Ryan C. Gordon 67760f0ed7 joystick: Don't report duplicate recentering events for game controllers. 2020-04-20 18:58:18 -04:00
Ryan C. Gordon c5f2a1ce4e joystick: On disconnect, recenter all game controller inputs.
The joystick layer can't necessarily give us perfect centering, but we know
that the game controller level has logical absolute idle positions that have
nothing to do with the physical device.

So send game controller events to make it look like the device is completely
untouched before sending the final removal event.
2020-04-20 16:01:36 -04:00
Sam Lantinga aba2792896 Added a Windows Gaming Input joystick driver
This driver supports the Razer Atrox Arcade Stick

Some of the quirks of this driver, inherent in Windows Gaming Input:
* There will never appear to be controllers connected at startup. You must support hot-plugging in order to see these controllers.
* You can't read the state of the guide button
* You can't get controller events in the background
2020-04-18 21:41:37 -07:00
Sam Lantinga b90b59279e Added support for the Razer Atrox Arcade Stick 2020-04-17 21:30:58 -07:00
Sam Lantinga dbcda0b212 Added support for the Razer Wolverine Ultimate 2020-04-17 21:30:56 -07:00
Sam Lantinga 2b32385502 Don't send rumble packets too quickly to Nintendo Switch Pro controllers over Bluetooth 2020-04-17 15:08:48 -07:00
Sam Lantinga c02f54a0ed Fixed the default face button mapping for Nintendo Switch Pro controllers 2020-04-17 15:08:46 -07:00
Ryan C. Gordon a7a4e16b5b haiku: Patched to compile. 2020-04-15 13:31:54 -04:00
Sam Lantinga 50b1c19549 Fixed bug 5091 - Suspicious condition in HIDAPI_DriverXbox360_UpdateXInput
meyraud705

On line 220 of SDL_hidapi_xbox360.c https://hg.libsdl.org/SDL/file/4608f0e6e8e3/src/joystick/hidapi/SDL_hidapi_xbox360.c#l220

if (!XINPUTGETSTATE(user_index, &xinput_state[user_index].state) == ERROR_SUCCESS) {

logical not is only applied to the left hand side of this comparison.

I think you mean:
if (XINPUTGETSTATE(user_index, &xinput_state[user_index].state) != ERROR_SUCCESS) {
2020-04-14 09:55:33 -07:00
Sam Lantinga f34d2c60cc Added zlib license for Steam Controller headers 2020-04-14 07:35:35 -07:00
Sam Lantinga c302c1abb8 Fixed build 2020-04-13 13:24:19 -07:00
Sam Lantinga bf87604ef1 Fixed rare crash when unplugging Xbox controller on Windows 2020-04-13 12:33:29 -07:00
Sam Lantinga 55515a8c25 SDL: ps4 controller trigger bits on other controllers just mean that there's some activity, not saturation - only force it on if the analog value is 0. 2020-04-08 08:42:15 -07:00
Ryan C. Gordon 8c165adde7 joystick: Remove force_centering flag; we handle this on disconnect now. 2020-04-07 23:17:27 -04:00
Sam Lantinga 3cb62d5265 Fixed setting the controller name for the RAWINPUT driver 2020-04-07 11:17:52 -07:00
Sam Lantinga e62c25b693 The 0x02ff product ID shows up for new firmware Xbox One controllers using the RAWINPUT driver 2020-04-07 11:17:22 -07:00
Sam Lantinga 88cecee495 Fixed build warning 2020-04-07 10:14:12 -07:00
Sam Lantinga 50cb8e0f04 Fixed deadlock in new raw input joystick code
The appropriate locking is done elsewhere, this prevents inverted lock acquisition
2020-04-07 10:13:08 -07:00
Sam Lantinga b6afbe6317 Added SDL_log.h to SDL_internal.h so logging is available everywhere 2020-04-07 09:38:57 -07:00
Sam Lantinga 3154d92473 SDL: plumb previously unused digital trigger bits for PS4 controllers. Victrix fight stick only sets these bits and doesn't send the analog values
CR: SamL
2020-03-30 14:26:21 -07:00
Ryan C. Gordon 07f231eeae joystick: Make sure recentering events happen before disconnect events.
Fixes Bugzilla #5063.
2020-03-26 18:47:04 -04:00
Sam Lantinga 885b3f6948 Don't check the HIDAPI driver for the virtual device created by xow 2020-03-23 14:10:25 -07:00
Sam Lantinga cb8c91d956 Fixed bug 5051 - Switch Pro Controller hidapi driver does not report battery levels when connected via Bluetooth
bluenaxela+sdl

I've noticed that the Switch Pro Controller hidapi driver does not report battery levels when connected via Bluetooth, despite having code for setting joystick->epowerlevel.

This is caused by the driver always using k_eSwitchInputReportIDs_SimpleControllerState via Bluetooth. Using that mode means that the state reports you get back from the controller do not include battery state. Not using the full controller state over Bluetooth effectively makes this driver's support for setting joystick->epowerlevel entirely pointless, only ever reporting SDL_JOYSTICK_POWER_WIRED.

Is there a reason this was set to only use SimpleControllerState via Bluetooth?

I've attached a patch I'm using to allow getting battery level for the Switch Pro Controller.

A couple notes about this patch:
1) It changes LoadStickCalibration to accept the input_mode that is selected, because that's really what should determine what is used for stick extents, since stick extents differ between the modes.
2) In my patch I only use FullControllerState when the vid/pid matches the official Switch Pro Controller, as a cautionary measure in case some third-party controllers have problems with FullControllerState mode via Bluetooth (I noticed a HORI Wireless Switch Pad I had seemed to not read controller calibration correctly for stick extents. Maybe it's calibration data was uninitialized on account of having never been used with a Switch? I'm unsure, though if that guess is right maybe SDL2 should be detecting an uninitiated calibration state and using some sensible defaults)
2020-03-22 11:01:14 -07:00
Sam Lantinga f55cbdfd96 Allow Valve devices in driver check, we know they're well behaved controllers 2020-03-20 21:05:07 -07:00
Sam Lantinga 106ffd57d8 Fixed bug 5049 - HORI Wireless Switch Pad does not connect properly via Bluetooth
bluenaxela+sdl

The HORI Wireless Switch Pad does not properly connect via bluetooth. I did some debugging and found that the code that tries to control the Home LED causes this controller to disconnect.
2020-03-20 20:45:30 -07:00
Jimb Esser 417713a75c Probable fix for compile errors on Mac OS and (non-VS) Win32 2020-03-20 19:49:19 -07:00
Sam Lantinga dc36f133b4 Backed out changeset c29d04c3fa49 2020-03-20 19:49:15 -07:00
Sam Lantinga 2db65a7fe7 Fixed compile warnings 2020-03-20 19:47:46 -07:00
David Ludwig 7e5340c5ac Fix for Bug 5034 - Replugging in a controller crashes on macOS in SDL 2.0.12
This is a multi-part fix, and is the 2nd attempt at a fix for Bug 5034.  Here
are the problems being addressed:

1. On macOS 10.14.x and earlier, trying to call IOHIDDeviceUnscheduleFromRunLoop
   without a prior, paired call to IOHIDDeviceScheduleWithRunLoop, appears to
   lead to a crash.  A per-device flag has been added to make sure that these
   calls are paired.
2. DARWIN_JoystickDetect was free'ing its SDL_joystick's hwdata field
   (via FreeDevice) without setting it to NULL, and DARWIN_JoystickRumble wasn't
   checking for a NULL hwdata.  FreeDevice will now set hwdata to NULL and
   DARWIN_JoystickRumble will check for a NULL hwdata.
2020-03-17 17:34:24 -04:00
David Ludwig 36d5845152 Backout prior fix for Bug 5034, which needs more research
This backs-out the change, https://hg.libsdl.org/SDL/rev/14c961903135
2020-03-17 02:31:47 -04:00
Sam Lantinga 9b879a08aa Fixed compiler warning 2020-03-16 19:15:28 -07:00
Jimb Esser c2c5d0b392 Fix compile error 2020-03-16 16:52:49 -07:00
David Ludwig 197b14de4a Fixed Bug 5034 - Replugging in a controller crashes on macOS in SDL 2.0.12
The Darwin/macOS joystick driver was freeing its joystick's hwdata field
without zeroing it out in any live instance of SDL_Joystick.
2020-03-16 19:24:25 -04:00
Jimb Esser 47da53b91d Fix compiler warnings 2020-03-16 14:49:20 -07:00
David Ludwig 8cd08646bb virtual joysticks: move variable decls to top of function (for C90 compat; Bug 5038) 2020-03-16 17:19:18 -04:00
Sam Lantinga 543994b193 Fixed bug 4477 - Support more than 4 XInput-capable devices on Windows
Jimb Esser

Add new RawInput controller API, and improved correlation with XInput/WGI

Reorder joystick init so drivers can ask the others if they handle a device reliably
Do not poll disconnected XInput devices (major perf issue)
Fix various cases where incorrect correlation could happen
Simple mechanism for propagating unhandled Guide button presses even before guaranteed correlation
Correlate by axis motion as well as button presses
Fix failing to zero other trigger
Fix SDL_HINT_JOYSTICK_HIDAPI not working if set before calling SDL_Init()
Add missing device to device names
Disable RawInput if we have a mismatch of XInput-capable but not RawInput-capable devices

Updated to SDL 2.0.13 code with the following notes:
New HID driver: xbox360w - no idea what that is, hopefully urelated
SDL_hidapijoystick.c had been refactored to couple data handling logic with device opening logic and device lists caused some problems, yields slightly uglier integration than previously when the 360 HID device driver was just handling the data.
SDL_hidapijoystick.c now often pulls the device off of the joystick_hwdata structure for some rumble logic, but it appears that code path is never reached, so probably not a problem.
Looks like joystick_hwdata was refactored to not include a mutex in other drivers, maintainers may want to do the same refactor here if that's useful for some reason.
Something changed in how devices get names, so getting generic names.
Had to fix a (new?) bug where removing an XInput controller caused existing controllers (that moved to a new XInput index) to get identified as 0x045e/0x02fd ("it's probably Bluetooth" in code), rendering the existing HIDAPI_IsDevicePresent and new RAWINPUT_IsDevicePresent unreliable.
2020-03-16 12:25:02 -07:00
Sam Lantinga 4dea340ca7 Fixed bug 4477 - Support more than 4 XInput-capable devices on Windows
Jimb Esser

Add new RawInput controller API, and improved correlation with XInput/WGI

Reorder joystick init so drivers can ask the others if they handle a device reliably
Do not poll disconnected XInput devices (major perf issue)
Fix various cases where incorrect correlation could happen
Simple mechanism for propagating unhandled Guide button presses even before guaranteed correlation
Correlate by axis motion as well as button presses
Fix failing to zero other trigger
Fix SDL_HINT_JOYSTICK_HIDAPI not working if set before calling SDL_Init()
Add missing device to device names
Disable RawInput if we have a mismatch of XInput-capable but not RawInput-capable devices

Updated to SDL 2.0.13 code with the following notes:
New HID driver: xbox360w - no idea what that is, hopefully urelated
SDL_hidapijoystick.c had been refactored to couple data handling logic with device opening logic and device lists caused some problems, yields slightly uglier integration than previously when the 360 HID device driver was just handling the data.
SDL_hidapijoystick.c now often pulls the device off of the joystick_hwdata structure for some rumble logic, but it appears that code path is never reached, so probably not a problem.
Looks like joystick_hwdata was refactored to not include a mutex in other drivers, maintainers may want to do the same refactor here if that's useful for some reason.
Something changed in how devices get names, so getting generic names.
Had to fix a (new?) bug where removing an XInput controller caused existing controllers (that moved to a new XInput index) to get identified as 0x045e/0x02fd ("it's probably Bluetooth" in code), rendering the existing HIDAPI_IsDevicePresent and new RAWINPUT_IsDevicePresent unreliable.
2020-03-16 12:23:38 -07:00
David Ludwig b2296506bc virtual joysticks: MSVC support part 1/2, make driver's .c file be uniquely named 2020-03-15 15:05:36 -04:00
David Ludwig cc90875647 virtual joysticks: removed ball support (Bug 5028) 2020-03-15 13:25:49 -04:00
Sam Lantinga 151c8fbf19 Fixed build error
Malte Kie?ling

I get a build error in SDL_sysjoystick.c:74 for the merged patch, but its nothing to sweat about, just -Werror=declaration-after-statement doing its usual stuff.
2020-03-14 17:45:00 -07:00
Sam Lantinga 2be75c6a61 Fixed bug 5028 - Virtual Joysticks (new joystick backend)
David Ludwig

I have created a new driver for SDL's Joystick and Game-Controller subsystem: a Virtual driver.  This driver allows one to create a software-based joystick, which to SDL applications will look and react like a real joystick, but whose state can be set programmatically.  A primary use case for this is to help enable developers to add touch-screen joysticks to their apps.

The driver comes with a set of new, public APIs, with functions to attach and detach joysticks, set virtual-joystick state, and to determine if a joystick is a virtual-one.

Use of virtual joysticks goes as such:

1. Attach one or more virtual joysticks by calling SDL_JoystickAttachVirtual.  If successful, this returns the virtual-device's joystick-index.
2. Open the virtual joysticks (using indicies returned by SDL_JoystickAttachVirtual).
3. Call any of the SDL_JoystickSetVirtual* functions when joystick-state changes.  Please note that virtual-joystick state will only get applied on the next call to SDL_JoystickUpdate, or when pumping or polling for SDL events (via SDL_PumpEvents or SDL_PollEvent).


Here is a listing of the new, public APIs, at present and subject to change:

------------------------------------------------------------

/**
 * Attaches a new virtual joystick.
 * Returns the joystick's device index, or -1 if an error occurred.
 */
extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type, int naxes, int nballs, int nbuttons, int nhats);

/**
 * Detaches a virtual joystick
 * Returns 0 on success, or -1 if an error occurred.
 */
extern DECLSPEC int SDLCALL SDL_JoystickDetachVirtual(int device_index);

/**
 * Indicates whether or not a virtual-joystick is at a given device index.
 */
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickIsVirtual(int device_index);

/**
 * Set values on an opened, virtual-joystick's controls.
 * Returns 0 on success, -1 on error.
 */
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualAxis(SDL_Joystick * joystick, int axis, Sint16 value);
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualBall(SDL_Joystick * joystick, int ball, Sint16 xrel, Sint16 yrel);
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualButton(SDL_Joystick * joystick, int button, Uint8 value);
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick * joystick, int hat, Uint8 value);

------------------------------------------------------------

Miscellaneous notes on the initial patch, which are also subject to change:

1. no test code is present in SDL, yet.  This should, perhaps, change.  Initial development was done with an ImGui-based app, which potentially is too thick for use in SDL-official.  If tests are to be added, what kind of tests?  Automated?  Graphical?

2. virtual game controllers can be created by calling SDL_JoystickAttachVirtual with a joystick-type of SDL_JOYSTICK_TYPE_GAME_CONTROLLER, with naxes (num axes) set to SDL_CONTROLLER_AXIS_MAX, and with nbuttons (num buttons) set to SDL_CONTROLLER_BUTTON_MAX.  When updating their state, values of type SDL_GameControllerAxis or SDL_GameControllerButton can be casted to an int and used for the control-index (in calls to SDL_JoystickSetVirtual* functions).

3. virtual joysticks' guids are mostly all-zeros with the exception of the last two bytes, the first of which is a 'v', to indicate that the guid is a virtual one, and the second of which is a SDL_JoystickType that has been converted into a Uint8.

4. virtual joysticks are ONLY turned into virtual game-controllers if and when their joystick-type is set to SDL_JOYSTICK_TYPE_GAMECONTROLLER.  This is controlled by having SDL's default list of game-controllers have a single entry for a virtual game controller (of guid, "00000000000000000000000000007601", which is subject to the guid-encoding described above).

5. regarding having to call SDL_JoystickUpdate, either directly or indirectly via SDL_PumpEvents or SDL_PollEvents, before new virtual-joystick state becomes active (as specified via SDL_JoystickSetVirtual* function-calls), this was done to match behavior found in SDL's other joystick drivers, almost all of which will only update SDL-state during SDL_JoystickUpdate.

6. the initial patch is based off of SDL 2.0.12

7. the virtual joystick subsystem is disabled by default.  It should be possible to enable it by building with SDL_JOYSTICK_VIRTUAL=1



Questions, comments, suggestions, or bug reports very welcome!
2020-03-13 19:08:45 -07:00
Sam Lantinga 879f137aec Added support for the older Xbox One S Bluetooth controller report format 2020-03-13 19:00:24 -07:00
Sam Lantinga d662a65964 Fixed crash if manufacturer or product string is NULL 2020-03-13 19:00:22 -07:00
Sam Lantinga 255c9c23d4 Fixed bug 4921 - Do not swap B/X buttons on GameCube controller unless it's requested
The binding for the Mayflash GameCube controller adapter now respects the SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS hint
2020-03-13 13:28:33 -07:00
Sam Lantinga 6318765d54 Handle entirely duplicated joystick product names, as well as vendor and product names that start with the name of the vendor, but with different case (e.g. 8bitdo 8BitDo) 2020-03-13 13:05:43 -07:00
Sam Lantinga de2001eeee Fixed binding the D-PAD on the 8BitDo M30 controller 2020-03-13 13:05:40 -07:00
Sam Lantinga cb2f78b12d Updated 8BitDo SF30 Pro mapping with hint support, added Android binding for the 8BitDo M30 Gamepad 2020-03-13 13:05:38 -07:00
Sam Lantinga 80d075a01a Fixed compiler warnings 2020-03-13 09:43:48 -07:00
Sam Lantinga 5722e88481 Fixed build warnings 2020-03-12 19:49:33 -07:00
Sam Lantinga c44473ba73 Unified code to standardize joystick names 2020-03-12 19:47:30 -07:00
Sam Lantinga db3b3a1d84 Added support for SDL hints in the game controller mapping database 2020-03-12 19:47:28 -07:00
Sam Lantinga 9fdc6cf307 Removed Xbox HIDAPI debug code 2020-03-10 18:34:33 -07:00
Sam Lantinga fe97992185 Read the buttons on Nintendo Switch and GameCube controllers as they are labeled, and swap them if the applications wants positional button data instead. 2020-03-10 17:35:14 -07:00
Sam Lantinga 4caa6a0688 Fixed bug 4921 - Do not swap B/X buttons on GameCube controller unless it's requested
Ethan Lee

Basically replicating the solution of the Switch Controller's button label issue. Physical layout should take priority unless it's explicitly requested by the user or application!
2020-03-10 16:41:42 -07:00
Cameron Gutman 4e0fb110c8 Clear the old player index slot when moving to a new one 2020-03-07 19:21:21 -08:00
Cameron Gutman 165ccaa85b Fix incorrect player index when assigning a joystick the same index twice
Prior to this fix, we would hit the existing_instance >= 0 case and move the joystick
again to a different index than the one requested by the caller. It also breaks the assumption
that a SDL_JoystickID is only present in SDL_joystick_players at one location.
2020-03-07 17:20:04 -08:00
Cameron Gutman 467434b92d Added support for indicating player index on DS4 controllers 2020-03-07 13:17:28 -08:00
Sam Lantinga e9bc21fba5 Fixed rumble for third-party Nintento Switch Pro controllers
The 8BitDo SF30 Pro Gamepad will generate a single motor pulse for each rumble message, so we need to do this frequently to have continous rumble on this device.
2020-03-04 17:10:37 -08:00
Sam Lantinga 428cfddb4c Fixed crash when a controller is disconnected while rumble is pending 2020-03-04 14:59:44 -08:00
Sam Lantinga 281d05a6d1 Fixed handling the guide button with both V1 and V2 of the Xbox One Bluetooth wireless protocols 2020-03-04 09:42:10 -08:00
Sam Lantinga 07000bfc33 Fixed bug 5010 - SDL_Init with SDL_INIT_JOYSTICK hangs for 10 seconds when playing audio from another application
Jake Breen

I have tracked it down to a call on
hid_device_info() -> HidD_GetManufacturerString (Line 499 in src\hidapi\windows\hid.c)
2020-03-02 17:31:58 -08:00
Sam Lantinga 3b3ae4d14d Possible fix for bug 5010 - SDL_Init with SDL_INIT_JOYSTICK hangs for 10 seconds when playing audio from another application
Jake Breen

When I run SDL_INIT with SDL_INIT_JOYSTICK it stalls for about 10 seconds (last report was 10,615ms), but only if I'm currently playing audio. (Like in Spotify for example.)

querying something related to device access (last dll loaded)
'BabbysFirst64.exe' (Win32): Loaded 'C:\Windows\SysWOW64\deviceaccess.dll'.

I use a USB DAC because my mobo's audio out is pretty not great. And I've noticed unplugging it seems to solve the issue. I haven't noticed any other issues that are caused by my DAC.

My DAC is the Sound BlasterX G1 https://us.creative.com/p/gaming-headsets/sound-blasterx-g1
Vid = 041E
PID = 3249

My system specs:
- Windows 10 Pro
- Ryzen 2700x
- 16GB Ram
- Nvidia 2070 RTX

Additional USB devices plugged in:
- Valve Index
- Xbox One Elite Controller
2020-03-02 15:06:47 -08:00
Sam Lantinga eb19631a1e This controller firmware is supported on Windows, and is covered by the Bluetooth check on Mac OSX 2020-03-02 10:57:57 -08:00
Sam Lantinga 49564c8b8d Added support for the PDP Victrix Pro FS with Touch Pad for PS4 2020-03-02 10:47:48 -08:00
Sam Lantinga 4572dd2ae6 Fixed bug 4854 - Add a way to extend the values in controller_type.h
Added a hint SDL_HINT_GAMECONTROLLERTYPE to allow overriding the built-in controller type database
2020-03-02 10:37:28 -08:00
Sam Lantinga 27f346a058 Fixed compile warning 2020-03-02 09:46:37 -08:00
Sam Lantinga 339612d5af ControllerList: add support for Victrix Pro FS w/ Touchpad for PS4 2020-03-02 09:35:12 -08:00
Sam Lantinga 52be663380 Use SDL math functions in Steam Controller support 2020-03-02 09:35:09 -08:00
Sam Lantinga 756d2073fe Updated the HIDAPI Xbox One driver with support for Bluetooth Xbox One controllers 2020-03-02 09:26:12 -08:00
Sam Lantinga 6590d078d7 Fixed bug 4996 - Mac: XBoxOne Bluetooth rumble isn't working
rofferom

I have an annoying issue on MacOS about XBoxOne Bluetooth rumble (Vendor: 0x045e, Product: 0x02fd).

When 360controller is installed, rumble is working correctly. However, Bluetooth rumble isn't working at all, with or without 360controller installed (although it is working with Chrome + https://html5gamepad.com).

I looked at the code, and it seems that XBox controllers are managed in MacOS in this file: SDL_hidapi_xbox360.c. The XBoxOne file is disabled for MacOS in SDL_hidjoystick_c.h.

The function HIDAPI_DriverXbox360_Rumble() is called correctly, and hid_write() returns no error.

I have tried a stupid test. I took the rumble packet from 360controller: ec4e88eb2d/XBOBTFF/FFDriver.cpp (L620). With the patch I have attached, I manage to have rumble working on Bluetooth (with some stupid vibration level, but it proves it can if the packet is changed).

But it breaks the USB rumble with 360controller. A comment in the function makes an explicit reference to 360controller, I think that's why I have broken this specific usecase.

I don't know what is the correct way to fix this, but it seems that the current implementation has a missing case for Bluetooth support.


Note that I also tested master this morning, and I have another issue:
    if (!device->ffservice) {
        return SDL_Unsupported();
    }

test fails in DARWIN_JoystickRumble(). This test has been done quickly, I'm not totaly confident about its accuracy.
2020-03-01 14:52:49 -08:00
Romain Roff? 5346216368 mac: Fix gamepad detection 2020-03-01 13:01:53 -08:00
Sam Lantinga 1af31a26d1 Fixed trying to handle the HORI Wireless Switch Pad when connected via USB 2020-02-27 13:53:32 -08:00
Sam Lantinga 20d67446e0 Xbox One controller rumble doesn't need synchronization if you use a packet counter of 0 2020-02-27 09:33:32 -08:00
Sam Lantinga 8d14636326 Fixed support for third party Xbox 360 wireless controller dongle 2020-02-19 08:26:00 -08:00
Sam Lantinga ad225047b6 Added Android SDK conditionals to game controller mappings
The Nintendo Switch Pro controller has a different mapping on Android 10 and newer
2020-02-17 14:15:47 -08:00
Sam Lantinga 715f8d42a2 Fixed bug 4986 - Memory leak in HIDAPI_JoystickConnected
meyraud705

Memory allocated for device->joysticks on line 589 of SDL_hidapijoystick.c is never freed.

Also, use memmove because memory is overlapping.
2020-02-14 16:15:46 -08:00
Sam Lantinga e5e5416975 Removed VID/PID 0x1532/0x0037, which was listed in the Linux kernel as a Razer Sabertooth, because at least one variant of the Razer DeathAdder mouse shows up with this VID/PID.
Specifically the Razer DeathAdder 2013 has this VID/PID
2020-02-07 20:19:32 -08:00
Sam Lantinga 833f76ab7b Fixed bug 4968 - NULL passed to memcpy in WriteProprietary in SDL_hidapi_switch.c
meyraud705

In SDL_hidapi_switch.c

line 443: Function BTrySetupUSB call WriteProprietary with pBuf=NULL and ucLen=0
line 376: WriteProprietary check its input (!pBuf && ucLen > 0) || ucLen > sizeof(packet.rgucProprietaryData): ucLen is 0 so it passes
line 382: WriteProprietary call memcpy with pBuf=NULL
2020-02-07 11:49:56 -08:00
Sam Lantinga 8ba77b35a5 Use the asynchronous HIDAPI rumble code for Nintendo Switch Pro controllers 2020-02-07 11:44:57 -08:00
Sam Lantinga 81256207bd Update for bug 4923 - Calling SDL_GameControllerRumble() often takes 8 ms
meyraud705

Dualshock4 on bluetooth need 78 bytes for the rumble data while SDL_HIDAPI_RumbleRequest can only hold 64 bytes.

'volatile' is not meant for thread synchronization.

The list of rumble request could grow infinitely if user call SDL_JoystickRumble too much. The documentation says "Each call to this function cancels any previous rumble effect", so overwriting pending request seem like a good idea.
2020-02-07 11:02:34 -08:00
David Ludwig d88f3f5226 macOS: fix crash if and when joystick-init-on-add fails 2020-02-05 13:16:17 -05:00
Sam Lantinga a199cb89ad Updated the Android Xbox One Wireless Controller mapping for the latest Xbox controller firmware update 2020-02-05 09:29:46 -08:00
Sam Lantinga dc1d3c2974 Catch both PS3 and PS4 motion controls and don't treat them as a game controller 2020-02-04 18:36:23 -08:00
Sam Lantinga 1d1a35ef64 Fixed Visual Studio build 2020-02-04 16:05:39 -08:00
Sam Lantinga 1bd120266f Added SDL_hidapi_rumble.c to the macOS, iOS and tvOS builds 2020-02-04 15:42:49 -08:00
David Ludwig 65fd633694 FIX for SDL-4927: CFRetain+CFRelease a game controller's IOKit object
This fixes a crash whereby SDL could crash on macOS/Darwin, if and when a
USB game controller gets unplugged.  SDL was not retaining a reference
to the controller's OS/IOKit-provided 'device object', and was capable
of trying to use it, after a device was hot-unplugged.
2020-01-30 18:03:34 -05:00
Sam Lantinga 02108cf7e5 Added missing files from previous commit 2020-02-04 15:27:25 -08:00
Sam Lantinga 1684606fdf Fixed long delay on main thread caused by blocking rumble writes in HIDAPI drivers
There is now a thread that handles all HIDAPI rumble requests and a lock that guarantees that we're not reading and writing the device at the same time.
2020-02-04 15:26:56 -08:00
Sam Lantinga 6efebf1768 Moved rumble expiration to the main joystick handling level, and prevent sending the driver layer duplicate rumble requests. 2020-02-04 12:48:53 -08:00
Sjoerd Simons 976eee77cc Correct joystick hat indexes on linux
The index and indices were swapped; Which is fine as long as there are
no gaps in the ABS_HAT* event availability but otherwise things do get confused.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
2020-02-04 07:23:44 -08:00
Sam Lantinga 212609b3f2 Map the right pad on the Steam Controller to the right stick in the game controller API 2020-01-31 14:09:23 -08:00
Sam Lantinga 39a498c940 Build the hidapi framework and weak link it on Mac OS X 2020-01-31 13:09:20 -08:00
Sam Lantinga 91121ee4bb Weak link the hidapi framework on iOS and tvOS 2020-01-31 10:45:04 -08:00
Sam Lantinga 0641711e9f Added missing file from previous commit 2020-01-29 20:09:59 -08:00
Sam Lantinga 355f0b54ec Added support for the Steam Controller on mobile devices 2020-01-29 20:09:11 -08:00
Sam Lantinga c9c89783cb Miscellaneous pending fixes 2020-01-29 20:09:08 -08:00
Sam Lantinga 43b377b077 Fixed wired PS4 controller support on Android 2020-01-28 17:11:17 -08:00
Ryan C. Gordon 059de38c2c darwin: Don't pass NULL device refs to IOHIDDeviceGetValue().
Possibly fixes Bugzilla #4961.
2020-01-27 15:44:48 -05:00
Sam Lantinga 7ea3f5b464 Fixed bug 4898 - No rumble because of integer overflow in SDL_JoystickRumble
meyraud705

Switch hidapi and xinput also need to check for overflow, attached a patch for them.
2020-01-26 12:48:35 -08:00
Sam Lantinga adb53d0b1f Fixed disabling the Xbox 360 wireless HIDAPI driver 2020-01-26 10:32:39 -08:00
Sam Lantinga c9f672fde4 Fixed compiler warnings 2020-01-23 22:24:24 -08:00
Sam Lantinga 2ae41b9c61 Fixed mapping for both versions of the Xbox One Elite Series 2 controller firmware connecting over Bluetooth 2020-01-23 12:53:43 -08:00
Sam Lantinga 48240ac88e Added mapping for the Xbox One controller connected via the wireless dongle using xow 2020-01-23 12:53:41 -08:00
Sam Lantinga 6dc172d093 Turn off rumble on drivers which don't respect the replay.length value 2020-01-23 12:53:39 -08:00
Sam Lantinga 443bce741b Added support for the paddles on the Xbox One Elite Series 1 controller 2020-01-22 11:28:35 -08:00
Sam Lantinga 25c88ea903 The Xbox One 0x01 initialization packet is an ack packet 2020-01-20 13:53:40 -08:00
Sam Lantinga 9c3d1602ab Refactored code so SDL_GetJoystickGameControllerType() is called less during controller detection 2020-01-19 11:43:36 -08:00
Sam Lantinga ff06801106 Added missing file from previous commit 2020-01-18 11:21:42 -08:00
Sam Lantinga 43aa1fa9e7 Added support for detecting previously unknown Xbox 360 and Xbox One controllers using the HIDAPI driver with libusb and Android 2020-01-18 11:21:14 -08:00
Sam Lantinga 27035425e0 There are multiple bindings for XBox One controller model 1708, depending on firmware revision 2020-01-17 11:09:57 -08:00
Sam Lantinga bde1a371d1 Added support for the NACON GC-400ES 2020-01-17 11:07:19 -08:00
Sam Lantinga 4e682461cc Reattach the kernel driver after closing USB controllers 2020-01-17 10:43:14 -08:00
Sam Lantinga a8780c6a28 Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
Sam Lantinga c6817a2c19 Added support for the paddles on the Xbox One Elite Series 2 controller 2020-01-16 15:32:41 -08:00
Sam Lantinga 4e1cc124d2 Improved Xbox One controller initialization 2020-01-16 15:32:39 -08:00
Sam Lantinga 669729a8a0 Improved Xbox One controller initialization sequence
This sequence works across Microsoft, PowerA, PDP, and HORI controllers.
The newer Microsoft XBox firmware requires synchronizing the rumble sequence number, when SDL sees it after the initial connect
The Razer Wildcat controller requires waiting for init responses before continuing the initialization sequence.
The PDP Battlefield 1 controller takes over a second to be ready for initialization, and if initialization is attempted before then, it will fail.
2020-01-15 22:18:31 -08:00
Sam Lantinga 3448600526 Added support for the HORI Fighting Commander 2020-01-15 22:18:29 -08:00
Sam Lantinga 6705e27c9f Added D-PAD bindings for the Linux Steam Controller 2020-01-13 22:05:58 -08:00
Sam Lantinga cb800d1c27 Fixed compiler warning 2020-01-13 22:05:56 -08:00
Sam Lantinga 7775f7cedf Fixed deadlock in HIDAPI joystick system 2020-01-13 22:05:54 -08:00
Sam Lantinga 3a796d6a58 Free the joystick player index when the joystick is removed 2020-01-13 15:35:54 -08:00
Sam Lantinga d2cda502cc Send the full Xbox One controller sequence for Microsoft controllers
This switches Bluetooth controllers back into USB report mode for the latest Xbox One S and Xbox One Elite Series 2 firmware
2020-01-12 17:22:24 -08:00
Sam Lantinga c14a59d999 Worked around an issue where the kernel would lose the force feedback effect 2020-01-11 13:38:50 -08:00
Sam Lantinga d33b122f4f The Xbox One S Bluetooth controller with older firmware uses b16 as the guide button. The same controller with newer firmware uses b12 as the guide button. Map both buttons so both firmware revisions will work with the same mapping. 2020-01-11 04:34:28 -08:00
Sam Lantinga 5d28c31548 Only initialize Xbox One controllers once they're ready for initialization (or if they are silent until init)
This fixes the Hyperkin Duke Xbox One controller showing the Xbox startup animation every time an SDL application launches
2020-01-09 14:53:34 -08:00
Sam Lantinga 47abe4e3b3 Fixed crash when unplugging a HIDAPI controller 2020-01-09 14:53:30 -08:00
Sam Lantinga f34795d05f Added support for the updated Hyperkin Duke Xbox One controller 2020-01-08 18:55:53 -08:00
Sam Lantinga a56aaea139 Fixed handling the 8BitDo M30 in Nintendo Switch mode 2020-01-07 16:47:56 -08:00
Sam Lantinga f4375e86f9 Added support for the 8BitDo M30 GamePad 2020-01-07 18:43:40 -08:00
Sam Lantinga eb3d39bc8b Added support for the 8Bitdo FC30 Pro 2020-01-06 12:18:51 -08:00
Sam Lantinga d9c4be0648 Added support for the Hyperkin Duke controller 2020-01-01 08:13:40 -08:00
Sam Lantinga 4c9628a002 Fixed GameCube controller axis and trigger ranges and X and B button being swapped 2019-12-30 17:56:56 -08:00
Sam Lantinga 8b0660b25a Fixed bug 4918 - SDL failed to build due to error LNK2019: unresolved external symbol memset referenced in function SDL_SetJoystickIDForPlayerIndex with MSVC x64 on Windows
LinGao

We build SDL with Visual studio 2017 compiler on Windows Server 2016, but it failed to build due to error LNK2019: unresolved external symbol memset referenced in function SDL_SetJoystickIDForPlayerIndex with MSVC x64 on Windows on latest default branch. And we found that it can be first reproduced on 0fff06175109 changeset. Could you please help have a look about this issue? Thanks in advance!

Steps to Reproduce:
1.hg clone https://hg.libsdl.org/SDL D:\SDL\src
2.Open a VS 2017 x64 command prompt as admin and browse to D:\SDL
3.msbuild /p:Configuration=Release /p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17134.0 VisualC\SDL.sln /t:Rebuild

Actual result:
 Creating library D:\SDL\src\VisualC\x64\Release\SDL2.lib and object D:\SDL\src\VisualC\x64\Release\SDL2.exp
SDL_joystick.obj : error LNK2019: unresolved external symbol memset referenced in function SDL_SetJoystickIDForPlayerIndex [D:\SDL\src\VisualC\SDL\SDL.vcxproj]
D:\SDL\src\VisualC\x64\Release\SDL2.dll : fatal error LNK1120: 1 unresolved externals [D:\SDL\src\VisualC\SDL\SDL.vcxproj]
Done Building Project "D:\SDL\src\VisualC\SDL\SDL.vcxproj" (Rebuild target(s)) -- FAILED.
2019-12-30 13:18:57 -08:00
Sam Lantinga a9482a1d60 Added support for the Nintendo GameCube adapter, tested on Steam Link hardware 2019-12-30 09:44:32 -08:00
Zack Middleton f0cee3edec Fix shutting down HIDAPI device with multiple joysticks
Using Wii U GameCube USB adapter with multiple controllers attached and
restarting SDL input in a game results in extra joysticks with NULL name.

HIDAPI_CleanupDeviceDriver() shut down joysticks by iterating through
device->num_joysticks but each HIDAPI_JoystickDisconnected() decreases
device->num_joysticks and shifts joysticks array down. Resulting in only
half of controllers being shutdown. It worked with only 1 controller
attached though.

Disconnect HIDAPI device joystick 0 until there are none left.
2019-12-22 13:15:11 -08:00
Sam Lantinga d000a592ab Fixed windows build 2019-12-21 22:33:21 -08:00
Sam Lantinga f3a547d00a Added support for the Hori Dragon Quest Slime Controller 2019-12-20 21:40:28 -08:00
Sam Lantinga 46e1377d49 Automatically assign player indexes to game controllers, and allow changing the player index for game controllers and joysticks.
Added the functions SDL_JoystickFromPlayerIndex(), SDL_JoystickSetPlayerIndex(), SDL_GameControllerFromPlayerIndex(), and SDL_GameControllerSetPlayerIndex()
2019-12-20 20:12:03 -08:00
Sam Lantinga 6b76787209 Make sure the Xbox 360 driver doesn't try to talk to the wireless controllers 2019-12-19 21:45:44 -08:00
Sam Lantinga 1db56619de Fixed rare infinite rumble in HIDAPI controller driver 2019-12-19 18:03:28 -08:00
Sam Lantinga 25bd5070f5 Fixed GameCube rumble 2019-12-19 18:00:08 -08:00
Sam Lantinga 202c966a44 Added support for the Nintendo GameCube Controller, using the Mayflash GameCube adapter. 2019-12-19 16:14:22 -08:00
Sam Lantinga 2481ab9340 Fixed compiler warning 2019-12-19 15:58:16 -08:00
Sam Lantinga 20daf54fd8 Added new HIDAPI driver files to the Xcode projects 2019-12-19 15:18:50 -08:00
Sam Lantinga fead0b24e1 Added missing files from previous commits 2019-12-19 15:02:12 -08:00
Sam Lantinga e22e77dadc Added an untested driver for the Nintendo GameCube adapter, based on code contributed by Ethan Lee 2019-12-19 15:01:35 -08:00
Sam Lantinga 15d30298cf Added support for wireless Xbox 360 controllers using the HIDAPI driver 2019-12-19 15:01:32 -08:00
Sam Lantinga e7f7e3f40f Refactored HIDAPI controller code to support dongles and hubs that dynamically attach controllers 2019-12-19 15:01:30 -08:00
Sam Lantinga 52b6ab2196 Added support for the SteelSeries Stratus Duo 2019-12-16 17:11:23 -08:00
Sam Lantinga a7ae9175c3 Fixed bug 4898 - No rumble because of integer overflow in SDL_JoystickRumble
meyraud705

On a Dualshock 4 controller using hidapi driver, calling SDL_JoystickRumble with a duration too long (SDL_HAPTIC_INFINITY for example) causes the rumble to stop immediately.

This happens because of integer overflow on line 301 of SDL_hidapi_ps4.c
(https://hg.libsdl.org/SDL/file/a3077169ad23/src/joystick/hidapi/SDL_hidapi_ps4.c#l301), which sets expiration time in the past.
2019-12-16 10:20:03 -08:00
Sam Lantinga 4d4e5584ea Fixed binding D-pad on NES30 controller 2019-12-12 19:07:26 -08:00
Sam Lantinga 9f8009f2e1 Added mappings for the Razer Serval on Windows and Mac OSX 2019-12-13 16:12:41 -08:00
Sam Lantinga cf9af481e0 Added support for the 8Bitdo NES30 GamePad in wired mode 2019-12-13 16:12:39 -08:00
Sam Lantinga c2b6d6f9ed Enable the LED on PowerA Xbox One controllers 2019-12-13 16:12:37 -08:00
Sam Lantinga 511df4a53f Added support for the BDA XB1 Spectra Pro 2019-12-13 16:12:35 -08:00
Sam Lantinga 55f8eabfae Identified the BDA XB1 Classic Controller 2019-12-13 16:12:33 -08:00
Sam Lantinga 0352814a8a Added general remapping of controller manufacturer 2019-12-13 16:07:25 -08:00
Sam Lantinga b51d7f35aa Added support for the HORI PAD A 2019-12-13 16:07:22 -08:00
Sam Lantinga 23c39a2e44 Strip trailing whitespace on controller manufacturer identification 2019-12-12 19:14:37 -08:00
Sam Lantinga 1ac7eabaca Fixed comment typo 2019-12-12 14:25:02 -08:00
Sam Lantinga a613fc7cc2 Added names for official Microsoft controllers, since they don't have descriptive product names 2019-12-11 19:24:40 -08:00
Sam Lantinga 0f52916027 Added custom names for some controllers 2019-12-11 17:47:01 -08:00
Sam Lantinga e029fdbb38 Shorten "Performance Designed Products" to "PDP" 2019-12-11 17:46:59 -08:00
Sam Lantinga 325a2efb3d Added support for the full line of PDP Xbox 360 and Xbox One controllers 2019-12-11 17:46:57 -08:00
Sam Lantinga 8b50dcb21b Use the controller product string instead of hard-coding controller names 2019-12-11 17:46:54 -08:00
Sam Lantinga 89401b21e9 Added support for the Razer Raion Fightpad for PS4 2019-12-10 13:09:52 -08:00
Sam Lantinga a21f6b7a91 Add the manufacturer to the joystick name on Mac OS X, for consistency with other drivers 2019-12-10 11:46:22 -08:00
Sam Lantinga 2a161e7add Remove any duplicate manufacturer in the joystick name 2019-12-10 11:30:56 -08:00
Sam Lantinga 3469481ef6 Don't include the manufacturer if it's already included in the product string 2019-12-10 10:00:49 -08:00
Sam Lantinga bb37a1ebf5 Fixed the name of the Razer RAION Fightpad 2019-12-10 09:38:10 -08:00
Sam Lantinga 82d2c357c3 Fixed rumble after Xbox controller initialization
When we initialize the controller it has an internal rumble sequence number, and if our rumble sequence number doesn't match that, rumble won't happen. To fix that we cycle through the range of sequence numbers, and at some point we'll match up with the controller's sequence number and it'll roll forward until it matches our next rumble sequence number.
2019-12-09 16:52:11 -08:00
Sam Lantinga 3d34750ced The PowerA Mini controller blocks while writing feature reports, so don't try to use the HIDAPI driver for it on Linux 2019-12-09 13:54:05 -08:00
Sam Lantinga 3626506369 Added some missing Xbox controller names 2019-12-09 13:54:03 -08:00
Sam Lantinga 135a90539b Fixed the Apple TV remote menu button on tvOS 13.2 (thanks Romain Tisserand) 2019-12-06 13:48:13 -08:00
Sam Lantinga 7a51ad6a50 Fixed the game controller menu button on tvOS 13.2 (thanks Romain Tisserand) 2019-12-06 13:48:10 -08:00
Sam Lantinga 8342fa7c7e Fixed controller mapping issues caused by PS3 gyro jitter 2019-12-05 13:48:08 -08:00
Sam Lantinga 6d00166813 Get full axis range for PS3 controller triggers on Linux 2019-12-05 13:18:53 -08:00
Cameron Gutman 55eb76218d Use stat() to minimize input device opens when not using udev
Calling open() on input devices can generate device I/O which blocks
the main thread and causes dropped frames. Using stat() we can avoid
opening anything unless /dev/input has changed since we last polled.

We could have used something fancy like inotify, but it didn't seem
worth the added complexity for this uncommon non-udev case.
2019-11-20 20:27:45 -08:00
Sam Lantinga b98808f639 Updated DPAD binding for 8Bitdo Zero controller 2019-11-28 14:23:24 -08:00
Sam Lantinga 2fd3f756d2 Fixed trying to use the HIDAPI driver for the original Xbox One S Bluetooth controller 2019-11-28 11:44:17 -08:00
Sam Lantinga 8aaf945b2f Fixed mapping controllers that have axes that start at -32768 and then snap to 0 at the first input report 2019-11-28 11:44:15 -08:00
Sam Lantinga a3a8fcef77 Added support for the 8Bitdo SN30 Pro, wired connection 2019-11-28 10:04:05 -08:00
Sam Lantinga 4a77613881 Added the full Xbox One Elite Series 2 controller initialization sequence, to start input reports after switching out of Bluetooth mode. 2019-11-27 18:26:57 -08:00
Sam Lantinga b8d65da459 Check for duplicates in the supported controller list 2019-11-27 15:27:21 -08:00
Sam Lantinga 0b863f8a5c Sorted controller entries by type and VID/PID to more easily find entries in the list 2019-11-27 15:27:19 -08:00
Sam Lantinga 84f8e53c85 Fixed detection of the Mad Catz FightPad Pro 2019-11-27 15:27:16 -08:00
Sam Lantinga 98cc9cf208 Added support for the Google Stadia Controller 2019-11-27 12:38:53 -08:00
Sam Lantinga 43cb7b3c51 Added support for the Hori Fighting Commander 2019-11-27 12:38:51 -08:00
Sam Lantinga a76e547477 Added support for the PowerA XB1 Fusion Fight Pad 2019-11-27 12:38:48 -08:00
Sam Lantinga a5e6b87ce6 Added support for a variant of the PowerA FUSION Pro Controller 2019-11-26 08:35:41 -08:00
Sam Lantinga f3d95396d6 Added some missing controller names 2019-11-25 15:02:54 -08:00
Sam Lantinga 8243a3e801 Added support for the Hyperkin X91 2019-11-25 15:02:50 -08:00
Sam Lantinga 2713a1aae0 Moved the SteelSeries controllers into the "known controller" section 2019-11-25 13:27:26 -08:00
Sam Lantinga 26d53fbb83 Updated identification for the SteelSeries Stratus Duo 2019-11-25 11:12:09 -08:00
Sam Lantinga 359ae75bb2 Fixed DragonRise Generic USB PCB showing up as a PS3 controller 2019-11-23 12:11:16 -08:00
Sam Lantinga 8e153922e4 This packet didn't end up being needed to initialize input for the Xbox One Elite Series 2 controller 2019-11-22 17:46:30 -08:00
Sam Lantinga 6dce9733d9 Use SDL_zeroa() appropriately 2019-11-22 16:23:37 -08:00
Sam Lantinga 733f25252a Fixed build 2019-11-22 14:09:24 -08:00
Sam Lantinga 13006ba9e1 Added support for the PDP Versus Fighting Pad 2019-11-22 13:44:40 -08:00
Sam Lantinga b5aff9d7c3 Added SDL_GameControllerTypeForIndex() and SDL_GameControllerGetType() to return the type of controller attached. 2019-11-22 13:12:12 -08:00
Sam Lantinga c0650aca21 Added support for the PDP Battlefield One controller 2019-11-21 14:04:48 -08:00
Sam Lantinga a132b183cd Fixed the guide button on the NVIDIA Controller v01.04 2019-11-21 13:09:00 -08:00
Sam Lantinga cc4f890521 Added support for the NVIDIA Controller v01.04 on Linux and Mac OS X 2019-11-21 12:11:47 -08:00
Sam Lantinga 2a7b635b9b Added support for the NVIDIA Controller v01.04 on Android 2019-11-21 11:52:50 -08:00
Sam Lantinga 51487a71b9 Added support for the MOGA XP5-A Plus 2019-11-21 10:14:57 -08:00
Sam Lantinga 650964461e Improved XInput VID/PID detection and added SDL_wcsstr() and SDL_wcsncmp() 2019-11-20 16:42:50 -08:00
Sam Lantinga ce8411c587 Fixed Xbox One Elite Series 2 showing up as 2 devices in Bluetooth mode on Windows 2019-11-20 08:43:24 -08:00
Sam Lantinga 972a70d844 Added support for the Xbox One Elite Series 2 controller on Mac OSX 2019-11-19 15:15:00 -08:00
Sam Lantinga 68d8fc5c7b Added support for the Xbox One Elite Series 2 controller in wired mode 2019-11-18 15:46:13 -08:00
Sam Lantinga 2bfcf5cd96 Added Linux controller mapping for the Xbox One Elite Series 2 controller in Bluetooth mode 2019-11-18 14:08:05 -08:00
Sam Lantinga 1e24a1514d Added names for some missing Xbox controllers 2019-11-18 11:51:39 -08:00
Sam Lantinga 144956442d Added identifiers for the Xbox One Elite Series 2 controller 2019-11-18 11:44:51 -08:00
Sam Lantinga a9ac9e3865 Don't try to use this driver with the Xbox One S in Bluetooth mode on Linux 2019-11-16 19:58:29 -08:00
Sam Lantinga 9ca5373024 Added support for the Xbox One S controller in Bluetooth mode on Linux 2019-11-16 19:55:53 -08:00
Sam Lantinga cf33f1f0ef Added a utility function to simplify the hint handling logic 2019-11-13 21:53:01 -08:00
Sam Lantinga 9a76bebfbc SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS defaults to true, to match Steam's default behavior 2019-11-13 14:24:48 -08:00
Sylvain Becker 60d3965ece Readability: remove redundant return, continue, enum declaration 2019-10-30 15:36:17 +01:00
Sylvain Becker 0f871c033c Fixed bug 4843 - Passing NULL to memset in SDL_PrivateLoadButtonMapping
(Thanks!)
2019-10-23 09:53:23 +02:00
Sylvain Becker b7ab3b3984 Fixed bug 4838 - Use after free in SDL_JoystickUpdate (Thanks!) 2019-10-23 08:50:57 +02:00
Sam Lantinga 5025109f29 Fixed accidental whitespace 2019-10-22 15:43:58 -07:00
Sam Lantinga 9da4bfc141 Added support for the Power A Nintendo Switch Enhanced Wireless Controller 2019-10-22 10:57:07 -07:00
Sam Lantinga f96da11f93 Reordered Power A Switch controllers so they're grouped together 2019-10-22 10:28:51 -07:00
Sam Lantinga 9e7894efac Added support for the PowerA - Super Mario Controller 2019-10-22 10:27:30 -07:00
Sam Lantinga cdc7181e6d Don't try to use the Xbox HID protocol with the NVIDIA Shield controllers 2019-10-19 01:54:02 -07:00
Sam Lantinga 4f304fd88c Added support for the BDA PS4 Fightpad 2019-10-17 18:07:52 -07:00
Sam Lantinga b3470f04b1 Added the hint SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS to control whether Nintendo Switch controllers use their button labels or button positions for game controller button reporting. 2019-10-17 17:32:47 -07:00