Ryochan7 / DS4Windows

Like those other ds4tools, but sexier
https://ryochan7.github.io/ds4windows-site/
GNU General Public License v3.0
6.93k stars 803 forks source link

Since 2.1.4 : Vibration doesn't stop #1389

Closed ramaduc closed 3 years ago

ramaduc commented 4 years ago

Hello,

I'm experiencing a problem since the last update of this wonderful program.

When i'm playing a game and make an action that involves rumble for my dualshock 4, then the vibration cannot stop (even if I set 1 second for auto stop rumble in the profile).

Can someone help ?

Thanks by advance

mika-n commented 4 years ago

seems to be working here just fine (games stop the vibration when the game sends the "zero rumble" cmd). Tested also the "paranoid safety setting" with 1secs timeout in DS4Windows. Works as expected.

If you set the timeout and press "Test Heavy/Light" buttons in DS4Windows profile editor then does it stop the vibration automatically without pressing Stop btn?

Have you tested with more than one game? Which game has this issue? Especially if the vibration doesn't stop when timeout is set to 1sec then I suspect this is a game issue (=the game sends rumble X commands all the time instead of sending rumble zero or stops sending those commands).

Or if if you install the previous version then is the isssue "fixed" with the same game? You can download and unzip the DS4Windows.zip package to another folder and run the executable from there (no need to uninstall the newer version).

ramaduc commented 4 years ago

Hello Mika,

Thank you for response. I am getting this issue on 2 games that I was playing before the update. Streets of rage 4 and Heave Ho. There is 3 players playing using bluetooth. I cannot test the timeout on vibration because I went back to the previous version (2.1.3). If you need, I can download the last version to test. It doesn't seem to come from games.

I confirm that in the 2.1.3 version, everything has got back to normal. So I think i'm gonna stick with this version until another version is released.

Thanks for your help.

mika-n commented 4 years ago

It would be great if you could download again the latest version and test how the timeout works through DS4Windows profile editor (if the timeout kicks in it should not matter whether the rumble was enabled by DS4Windows app itself or a game). You can download and unzip the latest version to another folder, so you can keep the V213 in place.

The latest V214 version does have a chance relating DS4 output gamepad type and lightbar colors. DS4 gamepad API uses the same routine for both ligthbar and rumble messages. This change could have some nasty side effects. https://github.com/Ryochan7/DS4Windows/commit/cf9183ac57241d4084114f81c74c5ea1d477bd87

Are you using profiles in dualshock4 or xbox360 mode?

ramaduc commented 4 years ago

I will download it today for testing. I always used a profile (I used a single profile for 3 players and yesterday I created a profile per player just to see if it could resolve anything).

So now, I still use a profile per dualshock (with ID/Profile linked) but only the color of the lighbar is different from a profile to another. They are all in DS4 mode with permanent status in output tab.

I will keep in touch with the result of my test.

ramaduc commented 4 years ago

I just made the test and I confirm :

  1. The timeout of 1 seconde is working (in both versions). The DS4 stops to rumble after 1 seconde.

  2. Version 213 is working properly with the same games ( although I don't feel any vibration in streets of rage 4). Heave Ho works pretty good.

  3. Version 214 isn't working regarding vibrations. In streets of rage 4, DS4 is rumbling hard and cannot stop. I have created a profile that is the same than in the older version.

  4. Output slot tab = DS4 + permanent (in 2 versions).

So the 2 versions are portable and it is very convenient to pass from one to another. So for the moment, I will stick with version 213.

Tell me if you have any clue.

Thanks again.

mika-n commented 4 years ago

@Ryochan7 The following change seems to break the rumble logic (the rumble gets stuck and the rumble watchdog timer is reset even when the game did not send a new rumble msg). https://github.com/Ryochan7/DS4Windows/commit/cf9183ac57241d4084114f81c74c5ea1d477bd87

The line 559 has " if (!useRumble && !useLight)" logic and it checks if the rumble was activated earlier. If it is then the code re-calls SetDevRumble (sets useRumble=true). Maybe this logic should check if the LeftHeavySlowRumble or RightLightFastRumble value is different than the previous value and only then it should re-call SetDevRumble? This way the watchdog timer is not reset even when the game didn't re-send an explicit rumble cmd.

@ramaduc Yes. DS4Windows shares the same config and profile files between different app versions, so it is easy to have several app versions at the same time in the same PC:

Ryochan7 commented 4 years ago

Re-enabled lightbar color change for DS4 Hopefully won't regret this

Regret - Escaflowne The Movie OST https://www.youtube.com/watch?v=Q99BzavKem8

I am getting this issue on 2 games that I was playing before the update. Streets of rage 4 and Heave Ho.

Well, at least that gives some test targets that I might be able to try. I didn't know Streets of Rage 4 had direct DS4 controller support. That might give me a reason to buy the game while it is still on sale.

ramaduc commented 4 years ago

Dear Ryochan7,

You can go ahaid and buy it. You can change the button icons directly in the game menu. I think pretty much all new games have DS4 supported since Microsoft accept to "tolerate" sony's controller in Windows 10.

I tested streets 4 without DS4Windows and I don't feel any vibration so this is the same as 2.1.3 version.

I will wait for the next update and tell you if this issue is solved. For now, I stay with the 2.1.3 version.

Thanks again for your work.

Ryochan7 commented 4 years ago

Installed Streets of Rage 4 and it would not detect the DS4 at first. Got confused and tried outside of DS4Windows. It worked fine then. Tried again with DS4Windows and the game failed to detect the virtual DS4. More confused. Tried with DS4Windows stopped. Game couldn't detect the real DS4.

Ended up finding out Streets of Rage 4 will refuse to detect DS4 controllers if it detects DS4Windows.exe running. Once I renamed DS4Windows.exe to something else, Streets of Rage 4 detected the virtual DS4 and I am experiencing the infinite rumble problem right now. I can uncomment some code and check what is happening in the backend in just a bit.

Sid Vicious Why Me? https://www.youtube.com/watch?v=BN9fHMY76io

ramaduc commented 4 years ago

I forgot to mention that I already changed the name of DS4Windows because Steam didn't recognize my controllers. This is something that I have to do after every update (don't know if this can be fixed).

I'm glad that you can reproduce the issue, so now you know what i'm talking about.

Thanks for your effort.

Ryochan7 commented 4 years ago

The force feedback calls work a lot differently in Streets of Rage 4 than with The Witcher 3. For one thing, Streets of Rage 4 always pushes out the current lightbar color in events. That kills the original assumption that the rumble and lightbar color changes are two separate events. Also, it looks like Streets of Rage 4 pushes out force feedback events every frame which would likely stop the watchdog timer from working.

The main problem is that the DS4Windows DS4 force feedback routine cannot tell when the rumble goes back to 0 due to the blue lightbar color (0, 0, 80?) getting pushed out constantly.

Ryochan7 commented 4 years ago

I guess I will be using issue #1373 to talk about approaches around the DS4Windows.exe block. This issue should be focused around the infinite rumble problem and changing the DS4 force feedback routine. The same routine has to work with Streets of Rage 4 and The Witcher 3.

ramaduc commented 4 years ago

Ok no problem. Tell me if I can help to make some test as well.

Viscerous commented 4 years ago

Just checking but I was trying Detroit in DS4 mode with lightbar passthrough disabled (I know it's pointless until ViGEm gets touchpad and gyro support) but here the rumble also gets stuck pretty often. Is that the same issue?

Ryochan7 commented 4 years ago

Very likely. I would not be able to determine that for sure because I do not have any David Cage "game".

Ryusennin commented 4 years ago

For what it's worth, the Quantic Dream game demos are available on Steam. (The games run fine via XInput.)

https://store.steampowered.com/app/1222140/Detroit_Become_Human/

Ryochan7 commented 4 years ago

I can only make a routine that works for either one. I cannot find a way to make a routine to work with both games. The pattern of the feedback reports from both games, as sent by ViGEmBus, are wildly different. Unfortunately, I am giving up again so the virtual DS4 feedback routine will be disabled yet again.

mika-n commented 3 years ago

@ramaduc @Ryochan7 There is another ticket #1487 where certain games understood DS4 controller (ie. shows DS4 button images), but the rumbling didn't work because it was disabled in DS4 output controller mode.

I did few tweaks in the debug version (V2.1.10 + debug changes) to re-enable rumbling. The lightbar and rumbling is now handled there a bit differently and hopefully it helps to fight the issue of conflicting/weird lightbar-rumble commands sent by some games (StreetOfRage4, Witcher3). Based on the discussion above it seemed like even the rumble watchdog timer (in DS4Windows profile settings) didn't help with infinite stuck rumbling with those two games. The linked #1487 explains few changes in rumble-lightbar mode and maybe it might help to fight the issue with SOR4 and W3 games? Unfortuntately I don't have those games, so cannot test it. But, at least few TombRaider games are now happy with rumbling in DS4 output mode.

Ryochan7 commented 3 years ago

Can't find a more relevant thread so I will use this one. I am not completely sure but I believe I have nailed down the core issue. Unfortunately, if my assumption is true, it is a legitimate problem with the ViGEmBus driver that cannot be fixed without another driver update.

I tried out my test cases of The Witcher 3 and Streets of Rage 4 again and the behavior was the same. The current workarounds are fine for The Witcher 3 but not entirely accurate. Those workarounds don't work at all with Streets of Rage 4. After looking at the debug output, I thought about why some lines seem to have no data to begin with. Then, I thought about byte 0x01 in the normal HID output report which designates features flags. My assumption is that games might actually change the flags used depending on the situation. That byte would be the actual way to tell whether an event would be considered a rumble change event, a lightbar change event, or both.

Unfortunately, ViGEmBus actively skips the features byte of the HID output report for the virtual DS4 and starts copying at byte 0x04 which starts the rumble bytes. Tests in DS4Windows confirm that the DS4 will ignore changes in rumble or lightbar data in the output report if the appropriate feature flag is not set during the data change. It looks like that feature flags byte needs to be provided by the ViGEmBus driver in order to have completely accurate passthru DS4 lightbar and rumble support.

DS4_OUTPUT_BUFFER_OFFSET https://github.com/ViGEm/ViGEmBus/blob/4ddf7639e306feffc2c6de03c2bfb6f88fbdaea2/sys/Ds4Pdo.hpp#L133

Ryochan7 commented 3 years ago

I'VE GOT IT! Finally got ViGEmBus compiled and TraceView Plus working. And yes, my assumption was correct. The features byte changes while playing both games; it looks like The Witcher 3 changes that byte more. Streets of Rage 4 sets the Flash feature flag as well for some events.

george_ive_got_it

Update: It looks like Streets of Rage 4 uses 0x07 for that byte almost all the time. The Witcher 3 will frequently change between using 0x01 (rumble only), 0x02 (lightbar only), and 0x03 (rumble + lightbar).

Update 2: Tested more bytes in the buffer. Streets of Rage 4 sets the Flash feature flag but checking the relevant bytes in the buffer showed that the game never set flash data.

Ryochan7 commented 3 years ago

Posted a request to ViGEmBus

https://github.com/ViGEm/ViGEmBus/issues/80

Ryochan7 commented 3 years ago

Need to make a different issue for the root problem. Re-opening this issue until I do so.