chiaki4deck icon indicating copy to clipboard operation
chiaki4deck copied to clipboard

[BUG] Haptic Feedback and Adaptive Triggers don't work correctly on Dualsense Edge

Open SrAntu88 opened this issue 1 year ago • 54 comments

While using my Dualsense Edge to play any game, but more recently this issue is prominent on the new Astro Bot. Haptic feedback is very important in this game for some mechanics, but when playing normally, the controller just vibrates randomly. The Adaptive triggers also don't work correctly, for example, when in the main menu you are controlling the ship you can use the triggers to accelerate and should have both resistance and some feedback emulating the engines, but instead only some very small feedback is felt only when fully pressing the triggers. Everything works as intended when using a regular Dualsense controller.

Debug Log chiaki_session_2024-09-09_03-42-49-605605.log

To Reproduce Steps to reproduce the behavior:

  1. Start stream while using a Dualsense Edge controller
  2. Try moving or using any mechanic that makes use of Haptics or Adaptive triggers
  3. Both don't work like they do while playing directly on the console or using a regular Dualsense

Desktop (please complete the following information):

  • OS: Windows 11 24H2
  • Device: PC (Ryzen 7900X | RTX 4090)
  • chiaki-ng Version 1.8.1

SrAntu88 avatar Sep 09 '24 01:09 SrAntu88

@SrAntu88 I don't have a DualSense edge myself. If you are willing to run some test builds to gather the necessary information for me, I would be happy to assist with adding better support for the edge in chiaki-ng. Basically, you would just need to run some test builds I give you and give me back the logs.

streetpea avatar Sep 09 '24 05:09 streetpea

Maybe this has something to do with the adjustable trigger stops on the Edge? Can you try playing around with the trigger stop sliders and see if that changes anything?

SpecialK has two extra fields in the HID Report in the upper 4 bits of the 40th and 41th byte that give the trigger stop values for the left and right triggers respectively:

/*41.0*/ uint8_t TriggerRightStopLocation : 4; // trigger stop can be a range from 0 to 9 (F/9.0 for Apple interface)
/*41.4*/ uint8_t TriggerRightStatus : 4;
/*42.0*/ uint8_t TriggerLeftStopLocation : 4;
/*42.4*/ uint8_t TriggerLeftStatus : 4;  // 0 feedbackNoLoad
                                         // 1 feedbackLoadApplied
                                         // 0 weaponReady
                                         // 1 weaponFiring
                                         // 2 weaponFired
                                         // 0 vibrationNotVibrating
                                         // 1 vibrationIsVibrating

Could it be that the haptic effects are scaled based on these values? Maybe we need to transmit them to the console, or do the scaling ourselves 🤔

Internally, SDL has these fields listed as part of a Uint8 rgucUnknown1[8] array that is not exposed via the controller events, unfortunately :-/ This means either patching SDL or accessing the DualSense Edge directly via hidapi to get access to the raw packets.

jbaiter avatar Sep 09 '24 15:09 jbaiter

For the haptics it looks like the speaker is potentially named the wrong thing would need you to run a version that prints the available speakers via sdl to determine what the name actually is for the dualsense edge audio device

@jbaiter do you have a dualsense edge?

streetpea avatar Sep 09 '24 17:09 streetpea

@jbaiter it seems to be part of the dualsense effects state … couldn’t you just set it there https://github.com/libsdl-org/SDL/blob/47283250442a15de423d3bf4368f914105c6364f/src/joystick/hidapi/SDL_hidapi_ps5.c#L133 before you send the effect here in Chiaki-ng https://github.com/streetpea/chiaki-ng/blob/c5e07f810c68c084544355efad5f2e3bff080a8b/gui/src/controllermanager.cpp#L570 or are you saying you don’t get that data from remote play?

streetpea avatar Sep 09 '24 17:09 streetpea

My thinking was that since this is something that is set by the user, we would need to have a way to read out the setting from the controller to either send it to the console or do our own modifications to the trigger effects.

And no, I don't have a dual sense edge to experiment with:-/

jbaiter avatar Sep 09 '24 17:09 jbaiter

@jbaiter if it’s already set on the controller then why do we need to re-write it … or do the values change based on something else?

streetpea avatar Sep 09 '24 19:09 streetpea

I think you misunderstood :-) There are two hardware sliders on the back of the DualSense Edge that you can use to change the "stop point" for each of the triggers. These values are part of the input report you can get from the DualSense via USB or Bluetooth.

My (purely speculative) suspicision is that since the trigger stop plays a role in quite a few effects, that these values are transmitted to the console and are used there to change the trigger effects/haptics that are sent to the controller. This might be why the effects are less intense on the Edge in OP's case.

So if this was the case, and we wanted to get the same effects as on the console, we would need to have a way to read out those stop values from the controller's input report.

jbaiter avatar Sep 09 '24 19:09 jbaiter

@jbaiter alright I understand now.

streetpea avatar Sep 09 '24 19:09 streetpea

@SrAntu88 is the dualsense edge attached via usb? If not, please attach via usb. If it is attached via usb please go into your sound settings and find the dualsense speaker and make sure it is configured on and to play 4 channel (quad) audio. As for your adaptive triggers make sure there is no stop point set as that will turn off the adaptive triggers. @streamingdv was able to test and confirm that adaptive triggers and haptics work fine on Windows 11 with rog ally x so if the above is done it should work.

streetpea avatar Sep 09 '24 20:09 streetpea

@streetpea Yes, the controller is wired via usb. I just enabled the speaker and the haptics seem to work fine now (maybe still a bit too weak compared with the normal dualsense, but couldn't really tell without trying them side by side). But the adaptive triggers even after playing with the trigger stops still don't work correctly. They are far too weak and need to be completely pressed down to even begin to do anything. They also fire randomly when being pressed down even when there should be no resistance.

SrAntu88 avatar Sep 09 '24 23:09 SrAntu88

Also @streetpea I would be glad to run some test builds, no problem.

SrAntu88 avatar Sep 09 '24 23:09 SrAntu88

@SrAntu88 can you test the controller using the official app on Windows?

streetpea avatar Sep 10 '24 00:09 streetpea

@streetpea What app do you mean, the Playstation Accessories?

SrAntu88 avatar Sep 10 '24 01:09 SrAntu88

@SrAntu88 this one https://remoteplay.dl.playstation.net/remoteplay/lang/en/

streetpea avatar Sep 10 '24 01:09 streetpea

@streetpea Sorry for the delayed response. I tried the official Remote Play app and all features work as intended Haptics and Adaptive Triggers

SrAntu88 avatar Sep 10 '24 18:09 SrAntu88

@SrAntu88 which adaptive trigger effects and haptic feedback Events don't work correctly on your end? I tried Chiaki-ng on my Rog Ally X and all effects work as expected.

streamingdv avatar Sep 10 '24 19:09 streamingdv

@streamingdv After playing around and comparing the official Remote Play and Chiaki, I find that the Adaptive triggers work almost perfecly but there's something a little bit off about them when playing on Chiaki. I can't pinpoint what the issue is, it may be the resistances are treated differently by each program (for example when pulling a bow). On Remote Play I find them more "natural" or "gradual" than on Chiaki-ng, can't really explain it but there's a subtle difference (or maybe it's placebo and I'm dumb XD).

And for the Haptic feedback, after comparing both apps, Chiaki played the effects more or less the same but at 5% the strength they do on Remote Play. They feel much weaker and some effects can't be appreciated at all because the strength of the feedback is so low.

I wish I could record something to show you but the differences wouldn't be appreciated on camera

SrAntu88 avatar Sep 10 '24 19:09 SrAntu88

I pulled the latest proto files from the current version of the official remote play app and there is no separate controller type for DualSense edge, only the type for DualSense so I would be surprised if there was edge specific logic.

streetpea avatar Sep 10 '24 20:09 streetpea

@SrAntu88 Can you post a new log to make sure haptics is working correctly?

streetpea avatar Sep 10 '24 20:09 streetpea

@streetpea Sure thing: chiaki_session_2024-09-10_22-24-33-811811.log

Also weird bug, when pressing the "Open" button that would take you to the Log Directory it freezes and crashes Chiaki and I have to Alt+F4

Also I recorded with my phone 2 vids to give you an example of the difference between the intensity of the haptics between Remote Play and Chiaki (turn the audio up, also don't mind the video quality I had to compress de video a ton to make it fit the 10 MB limit xd)

Chiaki-ng: https://github.com/user-attachments/assets/2ad4d711-986e-4a13-9d7f-9939f1c2a315

Remote Play app: https://github.com/user-attachments/assets/0265fafb-4d02-49ef-a678-9a7bccbbdbab

SrAntu88 avatar Sep 10 '24 20:09 SrAntu88

Also, If you see any XBOX 360 controller or smthing like that in the log file, I forgot I had DS4Windows opened but it's all the same issues without it, if that makes any difference.

SrAntu88 avatar Sep 10 '24 20:09 SrAntu88

For the haptics audio it’s just playing the audio file that it receives from the PlayStation and we’ve only told the PlayStation that the controller is a dualsense so no alterations would occur there. In other words, we would get the same audio file as with the dualsense. I guess they could be manually increasing the strength of the audio for the edge but that seems unlikely tbh. Have you tried increasing the volume on the dualsense edge speaker @SrAntu88 ?

streetpea avatar Sep 10 '24 20:09 streetpea

@streetpea it's at the max windows allows

SrAntu88 avatar Sep 10 '24 20:09 SrAntu88

@streamingdv do you see the same lower haptics on your DualSense edge?

streetpea avatar Sep 10 '24 21:09 streetpea

@SrAntu88 can you download audacity for Windows (https://www.audacityteam.org/download/windows/) and record playback on your DualSense Edge speaker output by opening audacity, then ctrl + p then edit your Host and recording settings (you can leave the speaker settings at the default) to look like the following: SetRecordingDeviceDualSense Then play a particular segment and record the audio sent to your DualSense edge with audacity using ps remote play and also with chiaki-ng and compare. (Note: You should be playing the same segment for comparison)

streetpea avatar Sep 10 '24 22:09 streetpea

@streetpea On the left the Remote Play app, on the right chiaki-ng image

SrAntu88 avatar Sep 10 '24 22:09 SrAntu88

@SrAntu88 can you get a ratio between the 2 like maybe 5x or something? Also can you compare the regular audio of the 2 apps?

streetpea avatar Sep 10 '24 22:09 streetpea

@streetpea Had to find what tool in Audacity to use to find the difference in volume, I guess it's this xd image

Also the regular audio from both apps I would say it's the exact same, no noticeable change if there is one

SrAntu88 avatar Sep 10 '24 22:09 SrAntu88

@SrAntu88 can you compare the 2 apps with a regular dualsense?

streetpea avatar Sep 10 '24 22:09 streetpea

Also can you get some more comparisons, it looked like a bigger difference than 1.8x which is what those 2 decibel values correspond to

streetpea avatar Sep 10 '24 22:09 streetpea