Ryochan7 / DS4Windows

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

DS4 stops working after disconnecting #1244

Closed foxsevent closed 4 years ago

foxsevent commented 4 years ago

I haven't used DS4win in a while but now it has this weird issue when if disconnected via cable or BT it stops working completely even if I reconnect it. I mean it works DS4win sees it, in control panel it works but it doesn't in any game or program the only thing that works are keyboard binds. Only way to fix this is to logout in windows or reboot windows, rebooting DS4win doesn't work.

So maybe an XINPUT problem?

bslenul commented 4 years ago

Hey, haven't tested long enough to be sure at 200% but it could be a conflict between DS4Windows and KB4549951 Windows update.

Your issue happened to me 3-4 days ago, I thought I did something wrong so I just ignored it but it happened today again, DS4 worked fine on boot then I unplugged it for some reason and when I replugged it it no longer worked on my games/programs. Same thing with BT.

DS4Windows sees the controller, RetroArch sees it too (it appears properly as a Xinput controller but can't be used/configured, if I close DS4Windows it appears as a DS4 controller and works fine).

I downgraded DS4Windows to a few prior versions but no changes, so I checked if I had any recent Windows updates and saw KB4549951, I uninstalled it and it seems to work just fine now.

edit: Erm nope, nevermind, happened again with that update uninstalled :|

bslenul commented 4 years ago

Messed a bit with that issue this afternoon, everytime it's happening, if I close the Microsoft Store service and unplug/plug back the DS4 it works again. So it looks like it's a conflict with MS Store or at least something related to MS Store.

Here's a video: https://youtu.be/whE8zI280w8

mika-n commented 4 years ago

The issue is probably the "infamous xinput slot# reserved" issue or failing "Hide DS4 Controller" (=exclusive mode) after re-connection because MSStoreApp has hijacked the physical gamepad device handle.

If the issue is because of failing exclusive mode then the following web page lists various tricks you could try. If nothing else helps then HidGuardian tool instead of the built-in HideDS4Controller option usually solves the issue. https://github.com/Ryochan7/DS4Windows/wiki/Exclusive-Mode-(Hide-DS4-Controller-config-option)-tips-and-issues

If the issue is because of reserved xinput slot# issue then unfortunately it is a bit trickier because the issue comes from WinOS and ViGem gamepad driver. One potential solution to this issue would be to implement some sort of connection pooling technique in DS4Windows app where the virtual gamepad is not released even after the physical gamepad is disconnected. This way games and WinOS would thing the xinput gamepad is still connected, so those won't re-cycle xinput slot numbers. Maybe someday Ds4Windows has this feature.

bslenul commented 4 years ago

The bug can happen with exclusive mode working or not:

foxsevent commented 4 years ago

All I can add is this, "Hide DS4" option or exclusive don't make a difference in my testing. After re plugging the controller it only works in game pad settings in Windows control panel. In every other game/program it detects controller and even switches button icons when I press a button but other than that nothing works, no buttons)triggers or analog except if I bind using DS4 win a keyboard key to a button like ESC to square that works. Lastly restarting DS4 win doesn't help, I have to restart the whole pc for the controller to start working.

mika-n commented 4 years ago

1163 if the issue is ghost xinput slot# (ie. after re-connection the x360 virtual device is assigned a new index and for some reason game doesn't want to use it) then see the linked issue.

If the issue is coming from a fact that after re-connection, for example, WinStore app has hijacked the gamepad then switch over to use HidGuardian to hide the original gamepad from all other apps except DS4Windows. HideDS4Controller exlusive mode option sometimes fails to work after hotplug re-connections because other app may have hijacked the original gamepad device handle.

bslenul commented 4 years ago

Hm yeah this is definitely a slot issue then, HidGuardian didn't change anything and I tried RPCS3 too: the controller appears in slot#2 when the bug happens, if I select that port it works fine (back to slot#1 when I close MS Store process).

However I tried the build posted in the last post of that issue and it doesn't seem to fix it, it's still in slot#2 (I installed the Scp drivers), but maybe I misunderstood the goal of that build or I did something wrong...

Thanks for the replies btw! 👍

mika-n commented 4 years ago

The Scp build is a sort of unofficial build for those people who still want to use that ancient ScpVBus driver or they have some issues with the newer ViGem driver (used by the official DS4Windows 2.x versions). The Scp built was meant for those people who wanted to test if the slot issue was with the old driver also.

However, sorry for not warning that having both ScpVBus and ViGem driver installed at the same time may sometimes cause conflicts and weird virtual gamepad bugs. So, I recommend you to uninstall the ScpVBus driver via device manager (uninstall AND tick the "remove driver files" option).

The slot issue might be solved by "connection pool" technique if/when it makes to the official version someday. This way DS4Windows "tricks" WinOS to think that the original xinput gamepad is still connected all the time even when the physical DS4 is disconnected and re-connected.

foxsevent commented 4 years ago

Yo all a little update, I still dunno what cased my particular issue but the last update seemed to fix it, now controller works fine after disconnecting and re connecting.

Cheers.

bslenul commented 4 years ago

Updated to 2.1.1 this morning, the bug is still happening to me. As a workaround I'm testing Windows Settings > Privacy > Background apps > Microsoft Store OFF, so far it seems to be working!