Additions I intend to make to the GameController system

I intend to work on the following additions to SDL’s Joystick/GameController system and thought I’d seek opinions before I start, to make sure these would actually be welcomed and likely to be merged:

  1. Extend the GameController API to support haptic feedback on analogue triggers (essentially an extra couple of rumble motors)
  2. Use Windows.Gaming.Input APIs for Xbox One controllers on Windows 10, as a replacement for XInput, in order to implement the above
  3. Extend the GameController API to support motion controls (gyroscope and accelerometer)
  4. Implement 3) for PS4 controllers (and maybe Switch too)

I’m slightly concerned about 2) as I’m unsure whether WGI supports background input. Any comments welcomed.

2 Likes

Yes, yes, and yes :slight_smile: Especially 3. There are many Game controllers that come with gyroscopes and accelerometers, gyro aiming is superior to thumb sticks. This is why I just downloaded and was taking a look at SDL. Intention was to make a remapping tool so I could use my generic switch pro controller for gyro aiming. If it can be done another way - let me know, would be appreciated.

Getting 3rd part controllers to use this is not that easy. At least SDL can recognise the controllers standard buttons presently.

As far as I could tell PS3 controllers report Gyro as a additional Joystick.

INFO: JoyID: 0 - Name: Gasia Co.,Ltd PS(R) Gamepad Motion Sensors
INFO: JoyID: 1 - Name: Gasia Co.,Ltd PS(R) Gamepad

I have many gamepads, and I can help on testing if needed.

There is a patch for gyro and accelerometer with implementation for Dualshock4 on the bugzilla: https://bugzilla.libsdl.org/show_bug.cgi?id=4815

Happy to see interest in this! My first pass at adding motion data to the gamepad API was in October but it wasn’t accepted (received helpful feedback about the design but I didn’t have time to redo it). I ended up just using a custom hidapi-based solution for my project since I didn’t want to maintain an SDL fork.

meyraud705’s version from March (linked above) is a better approach than mine and implements it for PS4 pads. Fingers crossed it can be merged… I think gyro aiming could be a lot more common in PC games if support is available in a popular library like SDL.