Closed PedroC1999 closed 3 years ago
DS4Windows is an XInput emulator.
There is next to no info about the DS5 API, except that it will "work" on PC. Does it have its own XInput driver or does it still rely on obsolete DInput? Nobody knows.
The TL;DR version is no. Now for the more detailed explanation.
The future plan is to deprecate DS4Windows and use a different mapper base for a possible DualSense mapper application. As there is close to no info out there about the DualSense, there is no point worrying about hardware specific details. Based on one DualSense unboxing video I have seen, the DualSense will act as a generic DirectInput controller when plugged into a PC much like the DS4. It will probably take some time after the PS5 is released to the public in order for people to reverse engineer the various protocols so that the extra features of the DualSense can be utilized; support for utilizing the DualSense Gyro will probably be the most important.
Currently, I am working on a different mapper mapping against the Switch Pro controller. No mapper that supports the Switch Pro controller can really do what I want so it is being used as the main test case; Steam Input is probably the closest. I am attempting to make the mapper base more device agnostic hoping that it will be easier to support various devices in the future; many portions of DS4Windows depend on aspects specific to the DS4 hardware. Some progress has been made but nothing has been made with general users in mind.
https://gitlab.com/ryochan7/switchpromappertest/-/tree/action_ideas
My main mapping goal right now is to be able to play Oblivion with the Switch Pro controller. The test mapper is just about there. One essential feature that is still missing is some sort of Outer Ring binding system for analog sticks.
The following mapping is what I am essentially trying to duplicate. Even Steam Input falls short of supporting everything that I used to be able to perform.
elder_scrolls_oblivion.gamecontroller.xml https://drive.google.com/file/d/1RMuvdO9G0J9h2W8Q5mDjmk9hTZsscqKr/view?usp=sharing
I guess I am going to somewhat reverse my stance on this. As a stop gap measure, I would hope to offer some initial support for the DualSense controller in DS4Windows before finalizing a different mapper. Related work is happening as discussed in issue #1098. There is now a test branch for mapping the Switch Pro controller in DS4Windows. Some more work and testing have to be done before I would consider incorporating those changes into the jay branch.
Hopefully a DualSense device reader class can be made that will read from the device and populate the DS4State object. Then the Mapping class would somewhat know what to do with it. Luckily there is still some time before proper DualSense support would be possible.
Just passing by and dumping information...
https://gist.github.com/894da226d73afb3bdd195df41b3a26aa
Yes it still uses USB HID and therefore dinput by default unless $**y write a driver for it. Also saying dinput is obsolete is pretty dumb since xinput is pretty much M$ proprietary standard (just saying).
You realise what DInput stands for, don't you? It isn't any more of a free standard than XInput
You realise what DInput stands for, don't you? It isn't any more of a free standard than XInput
If I'm not mistaken dinput is how Windows handles USB HID class devices, while xinput is normally specifically for Xbox controllers (which uses proprietary protocol independent of USB HID standards) It's possible, however, to hook games use xinput and convert dinput to xinput or let someone writes a driver specifically for a device that handles standard HID stuff and dumps xinput stuff on the other end. So yes Dinput is not free because it's still a M$ standard but it works on top of the (more) free USB HID standard.
There's a reason why Linux takes PS4/PS5 controllers even without hid-sony because evdev works on different underlying protocols including the xbox controller protocol and generic HID (no more "HID must use dinput unless people write a xinput driver for it" nonsense)
XInput is for the most part just a more advanced protocol than directinput, which hasn't been touched since Dx9-ish. The main reason everything supports it isn't because of any real protocol differences so much, more that it's just been around for so long, and most controllers supported it since windows support is basically a given
If XInput was a super complicated protocol, you wouldn't see the literal pile of plastic that is the third party controller market. There are three major apis for controllers. DInput, XInput, and Nintendo-cloudkukuland-differentforthesakeofbeingdifferent
By "obsolete" I meant "deprecated/legacy". It's not a personal preference, it's just been officially abandoned for 15 years.
@Ryochan7 bottled water#7875
has done some great work grabbing the packet IDs for the DualSense controller on discord.
Not sure if he/she is going to open a PR but the code is here https://github.com/CoderCoco/DS5Windows/
So most of the inputs are mapped out now. For output report, however, I only ever got rumble motor emulation working (not HD Rumble haptic feedback via USB audio) and nothing else. Might need some changes to my fuzzing technique or just wait for PS5.
EDIT: I mapped some of the output stuff out. Check out my gist I posted above.
For whatever it's worth, Windows detects and successfully connects to the DS5. All buttons work correctly in the game controllers area. DS4Windows does not recognize it, but I expected as much.
I've been using x360ce for now which is working but much rather use DS4windows. I hate that x360ce has xbox controller connected under Game Controllers at all times when the app is running which blocks my screensaver from kicking in.
For whatever it's worth, Windows detects and successfully connects to the DS5. All buttons work correctly in the game controllers area. DS4Windows does not recognize it, but I expected as much.
When you hold down the PS button to turn it off and the blue light turns off, does it still show up under Game Controllers? I have to keep turning my Windows Bluetooth setting off/on until I get a full disconnect from the Dual Sense. Just wondering if it's my bluetooth adapter or the Dual Sense.
When you hold down the PS button to turn it off and the blue light turns off, does it still show up under Game Controllers? I have to keep turning my Windows Bluetooth setting off/on until I get a full disconnect from the Dual Sense.
Yes, I get the same behavior. The controller is off, but it still shows connected in Windows.
When I am playing Day by daylight with dualsense connected to PC via usb, and set the sound output to dualsense. I can fell the controller vibrate with the background music and manual selection. But haptic feedback (or any vibration) does not work at any another game I tested so far (MHW, Hades, Minecraft), and the dbd game play footage on YouTube either.
I am guessing the haptic feedback work by getting certain frequency from sound...? Can someone please investigate in it? As it can be very useful to make vibration work again on other platform.
When I am playing Day by daylight with dualsense connected to PC via usb, and set the sound output to dualsense. I can fell the controller vibrate with the background music and manual selection. But haptic feedback (or any vibration) does not work at any another game I tested so far (MHW, Hades, Minecraft), and the dbd game play footage on YouTube either.
I am guessing the haptic feedback work by getting certain frequency from sound...? Can someone please investigate in it? As it can be very useful to make vibration work again on other platform.
DS5 declares a 4-channel USB audio interface besides the HID stuff. The rear left/right channel controls the rumble motors/haptic feedback units on the left/right. Simply play a track on those 2 channels to get haptic feedback output. No extra drivers/code necessary.
When I am playing Day by daylight with dualsense connected to PC via usb, and set the sound output to dualsense. I can fell the controller vibrate with the background music and manual selection. But haptic feedback (or any vibration) does not work at any another game I tested so far (MHW, Hades, Minecraft), and the dbd game play footage on YouTube either. I am guessing the haptic feedback work by getting certain frequency from sound...? Can someone please investigate in it? As it can be very useful to make vibration work again on other platform.
DS5 declares a 4-channel USB audio interface besides the HID stuff. The rear left/right channel controls the rumble motors/haptic feedback units on the left/right. Simply play a track on those 2 channels to get haptic feedback output. No extra drivers/code necessary.
Are there application than can make regular sound(?) play on those 2 channels? Or convert the signal that suppose to make controller vibrate to get haptic feedback output. I googled but only find a bunch of USB Audio Interfaces stuff.
When I am playing Day by daylight with dualsense connected to PC via usb, and set the sound output to dualsense. I can fell the controller vibrate with the background music and manual selection. But haptic feedback (or any vibration) does not work at any another game I tested so far (MHW, Hades, Minecraft), and the dbd game play footage on YouTube either. I am guessing the haptic feedback work by getting certain frequency from sound...? Can someone please investigate in it? As it can be very useful to make vibration work again on other platform.
DS5 declares a 4-channel USB audio interface besides the HID stuff. The rear left/right channel controls the rumble motors/haptic feedback units on the left/right. Simply play a track on those 2 channels to get haptic feedback output. No extra drivers/code necessary.
Are there application than can make regular sound(?) play on those 2 channels? Or convert the signal that suppose to make controller vibrate to get haptic feedback output. I googled but only find a bunch of USB Audio Interfaces stuff.
If you're on Windows you can use speaker fill to accomplish that. Seems to work in nearly everything but Chromium based browsers (and Discord). If you don't know how to enable speaker fill I made a quick tutorial a few days ago: https://youtu.be/EzqaclFn_Q4
When I am playing Day by daylight with dualsense connected to PC via usb, and set the sound output to dualsense. I can fell the controller vibrate with the background music and manual selection. But haptic feedback (or any vibration) does not work at any another game I tested so far (MHW, Hades, Minecraft), and the dbd game play footage on YouTube either. I am guessing the haptic feedback work by getting certain frequency from sound...? Can someone please investigate in it? As it can be very useful to make vibration work again on other platform.
DS5 declares a 4-channel USB audio interface besides the HID stuff. The rear left/right channel controls the rumble motors/haptic feedback units on the left/right. Simply play a track on those 2 channels to get haptic feedback output. No extra drivers/code necessary.
Are there application than can make regular sound(?) play on those 2 channels? Or convert the signal that suppose to make controller vibrate to get haptic feedback output. I googled but only find a bunch of USB Audio Interfaces stuff.
If you're on Windows you can use speaker fill to accomplish that. Seems to work in nearly everything but Chromium based browsers (and Discord). If you don't know how to enable speaker fill I made a quick tutorial a few days ago: https://youtu.be/EzqaclFn_Q4
Cool, it is working ... kinda VLC, Portal 2, MHW, Tor browser, IE is not working. Hope someone will write a actual driver to make the whole thing work soon. Thanks anyways!
@Daltz333 It depends on what work he is doing. If it is based on the default Input Report used for DirectInput (0x01 IIRC) then it is not worth worrying about. If the DualSense uses similar Input Reports to the DS4 then maybe there is something to work with before the PS5 console comes out and hackers find out how the DualSense interacts with the console. DualSense support without at least supporting the Gyro is mostly pointless to me.
Also, for people that might have the DualSense already, people might want to look at the Input Report data in HID Report Listener. That might be an easier way to analyze input packets for data changes as buttons and axes are engaged.
Link to main page: https://beta.inputmapper.com/product/hid-report-listener/
@Daltz333 It depends on what work he is doing. If it is based on the default Input Report used for DirectInput (0x01 IIRC) then it is not worth worrying about. If the DualSense uses similar Input Reports to the DS4 then maybe there is something to work with before the PS5 console comes out and hackers find out how the DualSense interacts with the console. DualSense support without at least supporting the Gyro is mostly pointless to me.
That's exactly what I did because supporting just the standard HID report seems pointless to me as well (it already works ootb so don't touch it lol).
I mapped out a bunch of extended stuff as well as part of the output report (for rumble, leds and Adaptive Trigger™®© Patented wankery) and put them in the comments of the hidrd report descriptor dump. As for the IMU pretty sure there's a calibration data however I'm too lazy to verify if it's in the same format as DS4.
Also seems that CoderCoco's fork has IMU as well. Not sure if it's working though.
Link to main page: https://beta.inputmapper.com/product/hid-report-listener/
DS5 Controller.zip This is the result from my PS5 controller, I tried to list every button I can find. This took me about 1 hr, hope it will help, let me know if you need more data.
@Daltz333 It depends on what work he is doing. If it is based on the default Input Report used for DirectInput (0x01 IIRC) then it is not worth worrying about. If the DualSense uses similar Input Reports to the DS4 then maybe there is something to work with before the PS5 console comes out and hackers find out how the DualSense interacts with the console. DualSense support without at least supporting the Gyro is mostly pointless to me.
I would generally agree with this assessment. It's pointless to even focus on development of DualSense support without gyro and possibly even other features. If people want Xinput support currently they can use x360ce to do what DS4Windows does, albeit without force feedback, which I guess is fed through a different driver for the controller itself or the sound system it seems. Not sure personally.
@Daltz333 It depends on what work he is doing. If it is based on the default Input Report used for DirectInput (0x01 IIRC) then it is not worth worrying about. If the DualSense uses similar Input Reports to the DS4 then maybe there is something to work with before the PS5 console comes out and hackers find out how the DualSense interacts with the console. DualSense support without at least supporting the Gyro is mostly pointless to me.
I would generally agree with this assessment. It's pointless to even focus on development of DualSense support without gyro and possibly even other features. If people want Xinput support currently they can use x360ce to do what DS4Windows does, albeit without force feedback, which I guess is fed through a different driver for the controller itself or the sound system it seems. Not sure personally.
As you can probably tell from the listener report that was posted, gyro is able to be easily supported (behaves the same as well). The overall Input Report structure is similar, but not the same as DS4: Some indices are offset or moved around.
As you can probably tell from the listener report that was posted, gyro is able to be easily supported (behaves the same as well). The overall Input Report structure is similar, but not the same as DS4: Some indices are offset or moved around.
Actually a bit too much "shuffling the bits for the sake of shuffling the bits". It's like $**y intentionally obfuscates the protocol or at least breaks compatibility with PS4 so even "accidental suport" won't happen. (Ironically PS3 got accidentally supported lol)
As you can probably tell from the listener report that was posted, gyro is able to be easily supported (behaves the same as well). The overall Input Report structure is similar, but not the same as DS4: Some indices are offset or moved around.
Actually a bit too much "shuffling the bits for the sake of shuffling the bits". It's like $**y intentionally obfuscates the protocol or at least breaks compatibility with PS4 so even "accidental suport" won't happen. (Ironically PS3 got accidentally supported lol)
Knowing Sony's track record, I can see them making some report changes only for the purpose of breaking compatibility.
Just wanted to chime in my support for this idea. Loving the feel of the DS5 and would love to see the same support for it as with the DS4.
https://github.com/jtran2795/DS4Windows/ Here's been my efforts so far with the spare time I have. Definitely a lot more work and housekeeping I'd need to do if I wanted to drive the implementation officially haha.
I uploaded a release as well if anyone wanted to play with it. I only added BT connection support though.
https://github.com/jtran2795/DS4Windows/ Here's been my efforts so far with the spare time I have. Definitely a lot more work and housekeeping I'd need to do if I wanted to drive the implementation officially haha.
I uploaded a release as well if anyone wanted to play with it. I only added BT connection support though.
Very cool. Glad to see some progress being made. Looking forward to further discoveries and the like.
DS4Windows support of Dualsense would be something that would actually make me to buy it to be honest, so fingers crossed! 🤞 @jtran2795 nice work!
DS4Windows support of Dualsense would be something that would actually make me to buy it to be honest, so fingers crossed! 🤞 @jtran2795 nice work!
I already bought one with the same hope! :)
DS4Windows support of Dualsense would be something that would actually make me to buy it to be honest, so fingers crossed! 🤞 @jtran2795 nice work!
Same here. I only play on PC and with Playstation controllers (Xbox controllers are trash, they break too easily, are much more complicated to mod and have no gyro) so I'm also holding out until we have a mapping software as polished and feature-rich as DS4Windows. If my DS4 breaks I always have a second one that was barely used lying around though so I'm still good for a few more years. lol
I'm just hoping the Dual sense has less of a liking to the analog sticks having deadzone issues...
For bluetooth seems that sending GET Feature Report
with report id 5
enables full report similar to DS4
the report id is 0x31 for input, and there is a output report in descriptor with same ID, I assume again it similar to DS4 and the in and out reports are the same. Now just need to figure out the output bytes mapping in BT for rumble, etc
For bluetooth seems that sending
GET Feature Report
with report id5
enables full report similar to DS4 the report id is 0x31 for input, and there is a output report in descriptor with same ID, I assume again it similar to DS4 and the in and out reports are the same. Now just need to figure out the output bytes mapping in BT for rumble, etc
If it's indeed similar to DS4 I would expect something that resembles DS5 OUT 0x02 via USB but with bytes swapped.
Also for the extended DS5 input report, what extra data does it contain compare to USB? I saw that in the descriptor the report was 77 bytes long compare to 63 bytes via USB so there should be extra 14 bytes of data. It might contains some clue to what the last 8 bytes in the USB report actually is.
Here is example bluetooth in report:
31 21 7d 80 81 80 00 00 01 08 00 00 00 15 ec 1f
10 f4 ff fb ff 03 00 ec ff 72 1f 4d 05 b5 05 8c
32 0e 82 3a 93 22 80 00 00 00 a0 09 09 00 00 00
00 00 aa 12 8c 32 09 00 00 9c cc 22 e4 28 05 53
46 00 10 00 00 00 00 00 00 00 18 c5 04 0c
Looks like there is extra byte at the beginning before LeftX And last line only 4 last bytes change, which is probably checksum of some sort
Hm so the added bytes seems to be just paddings? There's the 2-byte bluetooth report header, 63 bytes USB report (didn't check everything but does look the same at first glance), 9 bytes of 0x00s (one of them being 0x10 in your case but I got all 0x00s) and a crc32-esque thing.
Still no clue about what the last 8 bytes are but it shouldn't affect DS4Windows in any way (I'm just annoyed by the fact that DS5 emulation probably won't happen for the foreseeable future).
EDIT: The crc32-esque thing is just standard crc32 with custom initial value 0x23fcc4d3 and without flipping all the bits on output (i.e. xor mask is 0)
reveng output:
width=32 poly=0x04c11db7 init=0x23fcc4d3 refin=true refout=true xorout=0x00000000 check=0x1141f36b residue=0x00000000
$ ./reveng -c -i 23fcc4d3 -p 04c11db7 -w 32 -l "$(xxd -r -p | xxd -p | tr -d '\n')"
31 21 7d 80 81 80 00 00 01 08 00 00 00 15 ec 1f
10 f4 ff fb ff 03 00 ec ff 72 1f 4d 05 b5 05 8c
32 0e 82 3a 93 22 80 00 00 00 a0 09 09 00 00 00
00 00 aa 12 8c 32 09 00 00 9c cc 22 e4 28 05 53
46 00 10 00 00 00 00 00 00 00
18c5040c
EDIT2: Can confirm that this works in Python's crcmod library. Have to reverse all the bits for initCrc
though for some reason:
>>> import crcmod
>>> m=crcmod.mkCrcFun(0x104c11db7, initCrc=0xcb233fc4, xorOut=0x0)
>>> hex(m(b'123456789'))
'0x1141f36b'
EDIT3: Converting zlib.crc32 (aka. the standard CRC32): XOR the initial value and the final value by 0xffffffff
to cancel the built-in XOR.
>>> zlib.crc32(b'123456789', 0xcb233fc4^0xffffffff)
4005432468
>>> hex(_^0xffffffff)
'0x1141f36b'
Thanks to some generous users, I now have a DualSense controller. I will have to check out the current test code and see what I can add to it.
I was able to get USB side of things working with ConsoleTuner pcprog conneciton (GPP protocol) including the rumble
This out report worked for USB
/*
out[0] = 0x2;
out[1] = 0xFF; //control flags
out[2] = 0x1 | 0x2 | 0x4 | 0x10; //control flags
out[3] = 0x0; //rumble
out[4] = 0x0; //rumble
out[9] = 0x0; //mic led
//out[44] = 0x10 | 0x8 | 0x4 | 0x2 | 0x1; //5 player leds under touchpad
out[45] = 0xff; //R
out[46] = 0x00; //G
out[47] = 0x00; //B
*/
I've tried BT out report (0x31) but no luck so far, no reaction from controller
Edit: Also the BT out on ps4 I think was done using control endpoint instead of out. Unfortunately, I couldn't get PS5 on pre-order or today, so no luck testing with bt sniffer with real console
@InhexSTER Just curious: what kind of bt sniffer do you have? I was thinking about getting one but seems that only the "professional" ones are worth getting for sniffing controller communications (i.e. Bluetooth EDR) and they are way over my budget.
Also: have you tried adding the checksums I mentioned above to the packets you sent to the controller?
@dogtopus It has been a while, I don't remember if I got it to really pass the data through from the controller, but I think using a usb dongle and linux it was possible to swap the mac address and fool PS4 connecting to it assuming the pairing was already done. I think the spoofing part is possible with hcitool and bluez stack
No checksums, also there is caveats in how the data is sent depending on the library and how low level the writing to device is.
I was able to get USB side of things working with ConsoleTuner pcprog conneciton (GPP protocol) including the rumble
This out report worked for USB
/* out[0] = 0x2; out[1] = 0xFF; //control flags out[2] = 0x1 | 0x2 | 0x4 | 0x10; //control flags out[3] = 0x0; //rumble out[4] = 0x0; //rumble out[9] = 0x0; //mic led //out[44] = 0x10 | 0x8 | 0x4 | 0x2 | 0x1; //5 player leds under touchpad out[45] = 0xff; //R out[46] = 0x00; //G out[47] = 0x00; //B */
I've tried BT out report (0x31) but no luck so far, no reaction from controller
Edit: Also the BT out on ps4 I think was done using control endpoint instead of out. Unfortunately, I couldn't get PS5 on pre-order or today, so no luck testing with bt sniffer with real console
Are you able to make a release of this?
@rosierj maybe, in few days. It needs work on making it configurable, such as picking ports and listing devices, also currently its cmd tool and port & device ids hard-coded. The other thing, I wrote it for raspberry pi 4 so its compiled for 64 bit ARM,
@rosierj maybe, in few days. It needs work on making it configurable, such as picking ports and listing devices, also currently its cmd tool and port & device ids hard-coded. The other thing, I wrote it for raspberry pi 4 so its compiled for 64 bit ARM,
I follow you. God speed
@dogtopus It has been a while, I don't remember if I got it to really pass the data through from the controller, but I think using a usb dongle and linux it was possible to swap the mac address and fool PS4 connecting to it assuming the pairing was already done. I think the spoofing part is possible with hcitool and bluez stack
I'm actually trying to avoid proxying to make sure that the protocol capture is as clean as possible but looks like it is the only way unless I really want to blow a huge amount of money for "professional equipment".
Thanks anyway.
No checksums, also there is caveats in how the data is sent depending on the library and how low level the writing to device is.
The checksum is part of the HID report and not low level it seems.
The only minor thing I have found so far is how to make USB support work. The feature report ID for reading calibration data from the controller has changed. Now it looks like a BT and a USB connection use the same ID.
The only minor thing I have found so far is how to make USB support work. The feature report ID for reading calibration data from the controller has changed. Now it looks like a BT and a USB connection use the same ID.
Oh so that's why feature report 0x05 enables extended bluetooth report. Didn't notice that immediately. Makes sense.
Been trying to decipher the input reports. Most of it has been confirming what has been discovered by others. Here are some notes I have been writing.
USB: https://gist.github.com/Ryochan7/ef8fabae34c0d8b30e2ab057f3e6e039 BT: https://gist.github.com/Ryochan7/91a9759deb5dff3096fc5afd50ba19e2
Steam just added some basic support for DualSense on their beta branch. They haven't added resistive triggers or haptic feedback support as of yet though.
https://steamcommunity.com/groups/SteamClientBeta/announcements/detail/2912101955046945213
I searched the issues and couldn't find any mention of the DS5 or the PS5,
I am wondering if you plan to add support for the DS5 within this project, or if it'll be separate/not happening at all.
I understand you'd obviously need to own one yourself and I am not expecting anything from you as the developer, just wondering your thoughts on the subject.
Many thanks, Pedro