ndeadly / MissionControl

Use controllers from other consoles natively on your Nintendo Switch via Bluetooth. No dongles or other external hardware neccessary.
GNU General Public License v2.0
2.48k stars 137 forks source link

Request - PS5 DualSense Controller #137

Closed HylianEternal closed 2 years ago

HylianEternal commented 3 years ago

As the title says, I am requesting support for the PS5 DualSense Controller. I have one in my possession so if you need me to do any testing let me know, I'm glad to help in anyway I can.

ndeadly commented 3 years ago

Are you able to pair the controller with the Switch? First thing is to determine whether it uses classic Bluetooth or Bluetooth LE. The latter isn't supported yet.

HylianEternal commented 3 years ago

I was able to pair the controller quite easily, however no inputs are being recognized.

ndeadly commented 3 years ago

Oh cool, I was worried it might use LE like the new Xbox controller. Should be a simple matter of figuring out the button layout then.

Can you run btdb.nro and show me the output so I can see the hardware ID and controller name?

I'll also need you to run this and note down how the output changes for each button press along with pushing the analog sticks to extreme positions in X and Y. hid_report_tool.zip

Make sure you don't have any other controllers connected via Bluetooth as they will interfere. Also note that the data shown by the app lags a second or two behind. It's possible that this controller wants to send a bunch of rapidly changing data like motion by default. If you're finding it difficult to spot the button presses because of this let me know and I'll strip the feature from my up and coming companion app into a standalone tool for you which doesn't have the lag problem.

HylianEternal commented 3 years ago

2020111313110600-0A347E222F9DAE29C9514AB6C262481F Here's the output of the btdb.nro. The final entry is the info for the DualSense. There was a lot of rapidly changing data in the hid_report_tool, so I think I'll take you up on the standalone tool offer.

ndeadly commented 3 years ago

Thanks, that's a good start. I'm just preparing dinner at the moment. I'll put together the new tool after I'm done eating.

ndeadly commented 3 years ago

Sorry for the delay. See if this is any better. I think you'll need to be on firmware 9.0.0+ due to some assumptions I made about the data structures that I haven't got around to fixing for older versions.

You'll still get all the rapid changing data, but at least it should be easier to discern which is changing because of something you pressed. I suggest you lay the controller on a flat surface to minimise the amount of change due to motion data.

hid_report_viewer.zip

HylianEternal commented 3 years ago

Alright, I've finished my initial logging and attached a text document with my results. Let me know if you need anything else. DualSense HID Report Log.txt

Masamune3210 commented 3 years ago

Not sure if the controller acts the same as the ds4, but if so the controller has to be put into PS5 mode before any of the fancy features like the touchpad or gyro will work correctly iirc

HylianEternal commented 3 years ago

Not sure what you mean by that. I only have a PS5 and so I don't even think I have that as an option. It should be in PS5 mode by default.

Masamune3210 commented 3 years ago

Don't mean to confuse the conversation so ignore me if irrelevant but the DS4 when connected to anything that isn't a PS4 starts up in a PC mode that basically makes the controller act like a standard DInput controller and disallows any use of the fancy features that are extra like touchpad, gyro, or lightbar

Masamune3210 commented 3 years ago

With the DS4 you have to use programs like DS4Windows that put the controller into PS4 mode so you can use the extra features, I'm unaware if the same thing is done here with DS4 support as I haven't messed with it recently enough to remember

ndeadly commented 3 years ago

@HylianMedia thanks, this looks like it could even be the same as the DS4 layout. There's likely another reporting mode that can be activated to get the additional data. This one will probably differ a little from the DS4 due to the different feature set. Once the basic report is working we can see whether any of the other ones from DS4 work.

@Masamune3210 it's not really strictly a PS4 mode, the controller just starts sending a basic report with just the button data until you request otherwise. I already activate this extended report in MissionControl for the DS4. I assume it will be similar for this one.

HylianEternal commented 3 years ago

@ndeadly Great! Glad I could be of help!

@Masamune3210 I see what you mean now. For this use case that's a non-issue, since I didn't experience that at all when it was connected to the Switch.

Masamune3210 commented 3 years ago

I know, it's just the easiest way to explain what I mean to people. Extended report mode doesn't exactly have the same conference of information for most people. I'll bow out now

ndeadly commented 3 years ago

@HylianMedia yeah, I'm pretty certain this basic report is identical to the DS4. Everything you've recorded checks out. Try this one and see if all your buttons are working. MissionControl-0.3.0-dualsense.zip

ndeadly commented 3 years ago

The above build adds the Dualsense as a separate controller. Here's one where I've just whitelisted its hardware ID as a DS4. If the reporting modes are identical this will activate the extended reporting mode of the controller. You can check this with the tool I posted earlier. MissionControl-0.3.0-playstation.zip

ndeadly commented 3 years ago

@HylianMedia if you have the technical knowhow to grab the HID descriptor from the controller this would also tell us something about the reporting modes. Would also be a step towards figuring out how rumble and things work. If not don't worry, I'm sure there will be others looking into it.

HylianEternal commented 3 years ago

@ndeadly The first build that adds it as a separate controller seems to be working just fine, with the obvious exception of gyro controls and rumble. I'll test the second build once I'm done with dinner.

ndeadly commented 3 years ago

@HylianMedia yeah, I don't even have gyro controls/rumble working properly with ds4 yet so no surprises there. But cool, sounds like support could almost be merged already. Does the Dualsense have any way to indicate which player the controller belongs to?

HylianEternal commented 3 years ago

@ndeadly Tested the second build, the reports stayed the same, so I think it's safe to say the extended reporting mode works identically to the one found in the DS4 (or maybe I misunderstood and was supposed to see additional values, which I did not). Also to answer your question about the HID descriptor, I'm afraid I don't know how to go about getting that. I did however find this WIP documentation on the descriptor, hopefully that can be of some help. Documentation

Also, as far as I can tell the Dualsense has no player indicator, it could maybe be something with the lightbar, but connecting an additional controller made no change as far as I can tell.

Masamune3210 commented 3 years ago

Yep, its currently being documented so it can be added to a bunch of things, DS4Windows and this included as its out in the open

ndeadly commented 3 years ago

@HylianMedia yeah you misunderstood, if the report remained unchanged this means the commands from the DS4 didn't work. I kind of expected this might be the case. Stick with the first build then as it's looking like I'll end up having to add a bunch of dualsense specific code.

That documentation you found looks promising though. I took a brief look for similar info yesterday but didn't really find anything. I'll take a better look at it later when I'm more awake and see if it's complete enough to implement anything else.

kakra commented 3 years ago

if you have the technical knowhow to grab the HID descriptor from the controller this would also tell us something about the reporting modes. Would also be a step towards figuring out how rumble and things work. If not don't worry, I'm sure there will be others looking into it.

The DS5 has a new set of rumble motors which work more like loudspeaker drivers than classical rotational drivers: https://www.youtube.com/watch?v=amE7Kd8GGVc (in German), referring a tear-down from here: https://youtu.be/qfZ6yLeC1OI?t=552

So these actuators are working more like those in the Steam Controller but I'm guessing the DS5 uses more weight while the Steam Controller actuators were more meant to give the pads a haptic texture.

ndeadly commented 3 years ago

@kakra yeah I'm quite interested in this, as the Joycons and Switch Pro controller use something similar. This could mean the dualsense is able to faithfully reproduce the "HD rumble" patterns the Switch puts out.

HylianEternal commented 3 years ago

@ndeadly Did a brief double check with the second build. As it turns out, there is a change after all. On all outputs, the final value is now 18 instead of 00 like in my testing before any builds were made. Not sure if that's of any particular help, but I still thought it was worth noting.

ndeadly commented 3 years ago

@HylianMedia it's probably just coincidence. As far as I know, the commands that get sent under the assumption it's a DS4 will be failing. I don't know what that last value is for, it seems that's the one place that report differs from the DS4 version. Could be some set of flags or something (might even just be an off-by-one error in my display code showing junk).

Invictaz commented 3 years ago

Interesting progress :+1:

cualquiercosa327 commented 3 years ago

Hello, thanks for your wonderful work. here you can find a lot of information about the Dualsense:

https://www.reddit.com/r/gamedev/comments/jumvi5/dualsense_haptics_leds_and_more_hid_output_report/

https://github.com/Ohjurot/DualSense-Windows

https://github.com/Mxater/DualSenseSupport/

https://github.com/Mxater/DS4Windows

https://github.com/Ryochan7/DS4Windows

Also Nielk1 from "gyro gaming" discord has done a lot of advance.

Probably on this discord they could help you to add the rumble for the devices.

ndeadly commented 3 years ago

@cualquiercosa327 yeah I've been following most of those already. Admittedly I haven't checked anything in a few days, but last I knew there were still some important parts missing from the Bluetooth side of things. Thanks anyway for dumping them all in one place for others to follow.

otto-dev commented 2 years ago

Is the PS5 DualSense Controller supported nowadays? Readme says so if I'm not reading it wrongly.

I wanted to double check, and found this issue.

ndeadly commented 2 years ago

@otto-dev yes it is. I should probably close this issue now. I originally left it open because the controller hadn't been documented well enough for me to set the player led, battery etc. Someone has since PR'd these changes though, so support is now in line with the DS4.

otto-dev commented 2 years ago

Great, thanks for clarifying.

Amazing work, by the way! Regular user of this project, makes the Switch so much more enjoyable to use.

padraigfl commented 3 months ago

Hi, sorry to be posting in such a long closed issue, I just didn't want to clog the issues list with a query.

Do you know if DualSense support means the PS5 Access Controller works with Mission Control? It'd be pretty amazing if MissionControl was able to help disabled gamers by supporting it so if it does it'd be good to explicitly list it on the readme. I can try and get my hands on one if required.

ndeadly commented 3 months ago

Hi, sorry to be posting in such a long closed issue, I just didn't want to clog the issues list with a query.

Do you know if DualSense support means the PS5 Access Controller works with Mission Control? It'd be pretty amazing if MissionControl was able to help disabled gamers by supporting it so if it does it'd be good to explicitly list it on the readme. I can try and get my hands on one if required.

Probably not currently. I didn't know this controller was a thing. At the least it probably has a different product ID to the Dualsense, that will need to be whitelisted. It's possible (probable, even) that the actual input format is the same once the device is connected though.

If you get your hands on one give connecting it a go and see what happens. You can open a new controller request and provide info obtained from your connection attempts.