I have the newly released Nacon Revolution 5 Pro which is a PS4/PS5 controller, and I’m wondering if there’s anything I can do as a non-coder to help add support for the controller to SDL? I’ve looked at the website and readme but it’s all a bit beyond me.
Bump, I’m still curious about how to do this. Does it involve submitting a PR to the Github? I looked at some previously submitted PRs but I don’t really understand how to do that with my controller.
PS4/PS5 controller? How does it connect? Bluetooth or some kind of USB dongle? I’m sorry I don’t know anything about PS4/PS5 gamepads.
Here’s few commits with new controller stuff:
4a0bd06d58a2e793c70b25ce3700282c2945b3c7 New USB gamepad.
89433c23398aa594283899c523288246872a8e43 Mapping for a bluetooth-connected gamepad.
74b3959e04162bd97d5662f4df50b2e827641170 New USB gamepad.
You should create an issue, maybe support can be added by contributors with the same gamepad (if there are any).
Maybe you can record something like sent keycodes and HID/bluetooth info and attach it to issue.
So most things tend to work out of the box as joysticks, because they talk to the computer using standard protocols that SDL already supports.
If it doesn’t, that might need some programming done to our hidapi code, which could be quite complex, or maybe it needs a driver for the OS, or whatnot.
To look like a game controller to SDL (something that has a specific layout of buttons and axes) and not a basic joystick (something that is just an arbitrary pile of buttons and axes), all we need is a configuration string. This is just something that tells us “when you see a device with this serial number, button #1 means ‘triangle’ and button #7 is the PlayStation home button, etc.”
In practice, they look like this, but these don’t get written by hand:
03000000050b00000579000000000000,ASUS ROG Kunai 3 Gamepad,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,
There is a program in SDL2 that generates these strings, called
controllermap, that can generate these for you:
Basically you just press each button as it lights up and it spits out the string at the end.
Send that string on to us and we can add it to SDL, so it works by default. This string can also be set in an environment variable so it will work with an existing build of SDL that doesn’t know about the device.
Thank you icculus, that cleared up a lot of things for me! I used the SDL2 Gamepad Mapper to create mappings for the distinct PS4 and PS5 modes on the controller, and I submitted those mappings to the GitHub issues section per yataro’s suggestion. Hopefully that’s the right tool for this because I wasn’t sure how to use the controllermap.c or SDL2.dll file for creating mappings. I’ll share the mappings here too for continuity:
Nacon R5P - PS4 Mode Mapping
03008a4785320000170d000000000000,REVOLUTION 5 PRO (PS4 Mode),a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,-leftx:-a0,+leftx:+a0,-lefty:-a1,+lefty:+a1,-rightx:-a2,+rightx:+a2,righty:a5,lefttrigger:b6,righttrigger:b7,platform:Windows,
Nacon R5P - PS5 Mode Mapping
03008a4785320000190d000000000000,REVOLUTION 5 PRO (PS5 Mode),a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,-leftx:-a0,+leftx:+a0,-lefty:-a1,+lefty:+a1,-rightx:-a2,+rightx:+a2,righty:a5,lefttrigger:b6,righttrigger:b7,platform:Windows,
One thing that struck me was that the Mapper tool didn’t prompt anything for the gyro sensor (or touchpad). The reason I was motivated to add this to SDL in the first place was because I want to use this controller for gyro controls, but it’s not recognized by my preferred program JoyShockMapper nor does it seem to work with Steam Input. I know the gyro can work on PC because reWASD recognizes it in PS4 Mode. I had assumed that if JoyShockMapper uses SDL, and this controller is added to SDL, then JoyShockMapper would be able to work with the controller’s gyro, but maybe I’m misunderstanding?
The gyro and touchpad require additional support in the driver to work correctly. However, given that it’s an officially licensed PlayStation product, I would expect the third party PlayStation controller detection in SDL_hidapi_ps4/5.c to pick it up.
What do you see if you step through HIDAPI_DriverPS4_IsSupportedDevice() and HIDAPI_DriverPS5_IsSupportedDevice()?
Sorry, I’d love to tell you but I don’t know how to do this. Would you mind linking me something to read so that a layman could figure it out, or walking me through the steps?
I used SDL2 Gamepad Mapper to set the mappings I created as environmental variables per icculus’ suggestion and now JoyShockMapper does show the controller as connected, but the gyro does not work which I suppose makes sense given what I’ve read in this thread.