VL.GameController

This is a work in progress to support plug+play of SDL GameControllers.

Github:

Or download src + exported Help Patch here:

SDL device list:
https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt

License: MIT

v.0.4
  • added LeftStick, RightStick, Trigger nodes
  • added operation to download latest SDL mapping file
  • fixed .Internal nodes being red in newer vvvv versions
    -cleanup, comments
v.0.3
  • may still have issues with reversed axes for some devices

So, does it work for your dusty, old controllers?

Adding new devices or changing the mapping now works by editing the file mappings/sdl_mappings_windows_overwrite.txt
For the GUID you need to include the vendor and product ID of the new device.

Adding new devices should rarely be necessary, so first check if the device is in the list and test how it is working here:
https://gamepad-tester.com/

v.0.2

Right now, when plugging in a new device, the device model is guessed by the name that Stride outputs.
The names do not always give enough information to confidently determine the correct device.

For example, the PS5 DualSense appears just as ‘Wireless Controller’,
while the PS4 DualShock is helpfully recognized as ‘PS4 Controller’.

The mappings folder contains the button and axis mappings for currently supported devices:
PS4 DualShock, PS5 Dual Sense, Xbox360, Nintendo JoyCon, and a 100 year old Logitech Dual Action.

Adding new device mappings could be more convenient, for now it works by adding a .txt file and rearranging the entries. Use the Help file to see the direct input values.

Things that could be improved or added:

  • per controller deadzone
  • set vibration
  • PS touchpad position XY
  • read gyro
  • 2 Joy-Cons can not be recognised as one controller
  • Joy-Con ThumbStick only recognised as digital (driver related)
  • Xbox home button missing
  • battery status
  • set PS lights

Hope someone will find this useful or wants to help out.
Have fun!

VL.GameController.v0.4.zip (319.5 KB)

10 Likes

EDIT:

  • SDL mapping solved with v0.3
  • still no vibration support

Still confused by Stride’s separation between GamePad and GameController, and why VL does only detect the latter.

I guess GameController seems to be the more generic Joystick input from SDL,
whereas GamePad is supposed to cover all Xbox-like controllers.

As a test, I am now getting the product and vendor numbers using HidLibrary, but Stride seems to already handle this for SDL GamePads:

I guess it would help with device detection and mapping to get the GamePad working in vvvv instead of GameController.

Vibration
In Stride.Input/SDL/GamePadSDL.cs it reads " // No vibration support in SDL gamepads"
SDL seems to support vibration since last year:

SDL

1 Like

@reaktant thanks for uploading, looks handy.

What licence are you releasing it under?

What licence are you releasing it under?

I added an MIT license above, thanks for the suggestion.

Also created a public repo here:

1 Like

thx a lot!

I gave it a go, but I’m afraid it didn’t work after exporting. I’m not sure how to fix it, but it seems like there might be a little problem.

before exporting help patch:

after exporting help patch:

@yar

thanks for testing and reporting!

I made a quick fix:
GameControllerProcess is now inside the help patch.
That part could be redone some day, but i hope it at least works for now.

You can pull the repo and try to make a build again or download a build of the help patch here:

Not sure, but it looked like Stride handles Xbox Controllers differently since the last time i opened this.
So i tried to fix that in the mappings/sdl_mappings_windows_overwrite.txt

If you give it another try, let me know if that helped!

1 Like

Hola reaktant
I have a problem with my “Nintendo Switch Pro Controller” but there was not a Problem with the “Playstation Controller” - could it be that it has to do with the letter “h” because I found in the process “SDL from Device List” Replace “a” and Replace “b” but no Replace “h” and it’s also “float” not “int” -


It’s just a guess, mybe you point it out better or there is also a problem on my side - lot of things going on in “VL.GameController”
thanks for the cool handy contrib

1 Like

hi It’s a me again
I did a hack and it’s really a hack because I see doubled Buttons but it works here with “Nintendo Switch Controller Pro” and “SteamDeck”
Screenshot 2024-10-23 173435

good to know, seems this dpad format has not been taken into account yet.

gpt says:

For a typical hat switch D-pad, there are 9 possible states. These states represent the center position (no input), the four cardinal directions, and the four diagonal directions.

Here is a complete list of all possible states for a hat switch (assuming h0 is the D-pad):

  1. Center: h0.0 — No input
  2. Up: h0.1 — D-pad pressed up
  3. Right: h0.2 — D-pad pressed right
  4. Down: h0.4 — D-pad pressed down
  5. Left: h0.8 — D-pad pressed left

Diagonal Directions:

  1. Up-Right: h0.3 — D-pad pressed both up and right
  2. Down-Right: h0.6 — D-pad pressed both down and right
  3. Down-Left: h0.12 — D-pad pressed both down and left
  4. Up-Left: h0.9 — D-pad pressed both up and left