Ryochan7 / DS4Windows

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

DS4 stops working after reconnection randomly [UPDATED] #1176

Closed cubatilles closed 4 years ago

cubatilles commented 4 years ago

Hi,

[Updated as Mars, 30th, 2020]

I've been using DS4Windows for my DS4 controllers on my PC for years. It's an impressive piece of software. So, @Ryochan7 , first of all, thanks for it.

However, I've been experiencing a strange bug since lot of time ago. for at least 1 year since. I'll try to explain it, as it's a bit weird and random:

Sometimes, when I disconnect the DS4 (using a "press and hold PS button for 2 seconds" hotkey), (but it happens too if being disconnected because of idle timeout after 10 minutes), and then reconnect it when needed (it can be short after the disconnect or hours later), the XInput emulated controller will be detected by Windows but my button presses will have no effect on applications (games/emulators...) even though the controller is detected (for example RetroArch detects the controller on launch). However, if I go to Game Device Configuration setup on control panel, where you can see and test your controllers, and I open the Properties to test my controller's inputs, they are working there, Windows apparently detects inputs, but no other application seems to detect them.

I'm using HIDGuardian (since lotta time ago) but this happens without HIDGuardian and using "Hide DS4" option too.

When this bug occurs, it does not matter how many times I disconnect and reconnect the controller, it will not work again until I restart the computer or close Windows session and restart it.

Has anybody experiencesd this bug before? I could do more testing if needed, though I don't see any relevant information on the log tab.

Specs: Windows 1803 Enterprise OS DS4Windows latest (2.0.14) Connection: Bluetooth BT adapter: Plugable USB-BT4LE

[UPDATE] One thing that could be interesting to know, is that I have JoyToKey installed too. When this problems occurs, JoyToKey is unable to detect any button presses too (like other software), but if I go to JoyToKey configuration, there's an option to choose controller API to read from: XInput, DInput and Both. I usually set it to XInput (there should not be any use for my case to set it to "Both)". But when this problem occurs, if I go to JTK and change XInput to DInput, it begins to detect DS4'Xinput virtualized inputs. Stranger thing is, when I switch back to XInput, it keeps detecting inputs. Of course this only applies to JTK itself. All other applications still cannot detect any presses. I don't know if this info could help to identify the cause of the issue.

Greetings.

Ryusennin commented 4 years ago

Bluetooth or USB ? The former I guess, because idle timeout has no effect in USB.

Erquint commented 4 years ago

Sounds like #1163 to me. Can you export the DS4W log after this happens again to confirm? Also check if the controller's index changes with any 3rd-party XInput testing tool (probably either from 0 to 1 or from 1 to 2, depending on how they count it). Windows' built-in tester is for DInput only (which XInput is built on top of) and Microsoft killed its older X360C accessory software that could report indices. Also, no, the new "app" from the Microsoft Store doesn't recognize emulated X360C and apparently bricks physical ones.

cubatilles commented 4 years ago

Hi @Erquint ,

Not sure about being the same issue. I've doublechecked what you said on that other post about controller being mapped as Xinput Pad #2, but this does not seem to be the case for me. I'm including some DS4Windows logs and config files.

Both log files are form a session where this happened. One of them is with HIDGuardian, the other one is without it.

I'm also attaching my main profile and my Profiles.xml file. Just in case some obsolete config item could be causing this behaviour.

Greetings.

ds4w.zip

mika-n commented 4 years ago

Have you tried with a new empty profile (ie. default settings). The same thing? Is the battery reading shown correctly in Controllers tab page or is it always zero? One of the logfiles complined about low battery.

There is a debug version which generates a bit more messages and you can tweak DS4WindowsDebug.exe.config file to ignore battery reading values (set ReadBattery option in the file to false value). In that case the app reports always 100% battery level to make sure that DS4Windows won't get into "low battery warning state". https://github.com/Ryochan7/DS4Windows/wiki/Troubleshooting#detailed-debug-log-file-from-gamepad-connection-problems

If the problem is that games don't detect the virtual xbox360 device after the gamepad re-connection , but JOY.CPL controlPanel applet does detect gamepad events then it really sounds like a game specific/xinput slot issue.

cubatilles commented 4 years ago

Hi @mika-n ,

-No, I haven't tried with a new profile. I'll test and report any feedback.

-The battery readings always show correctly AFAIK, but I'll try to pay more attention next time this problem happens (haven't been able to reproduce it again since my last post update).

-About being a game specific issue, c'mon, it happens on all emulators and pc games I've tried. I don't think the problem is on all other software, but on DS4Windows. And DS4Windows didn't report a different xinput slot, so does not seem to be that problem either.

-I'll try the debug build you mention and enable the ignore battery reading values you suggest. I don't understand though, what's the point of enabling this option?

Greetings.

cubatilles commented 4 years ago

Hi,

I've been doing some cleanups on my profiles (mainly to remove obsolete configs from the past) to make sure this is not a problem caused by weird profile configs. Sadly, on all this time I could only reproduce the bug once (that's why I haven't updated the post).

When this happened, I discovered something which might be very significant. I could solve the problem by quitting JoyToKey, which is a background application I make use of in conjunction with DS4Windows (I guess you know about it, it's a typical Joypad > KB/Mouse rebinding tool). I guess this might be a bug caused by having both softwares at the same time. Once I closed JoyToKey and disconnected and reconnected the controller on DS4W, my games/emulators began to detect inputs again without rebooting. Previously, disconnecting and reconnecting the controller did not help and I had to restart my Windows session or full reboot my pc.

That's why I decided to abandon JoyToKey and migrate its rebindings to DS4W itself (when I began to make use of JTK years ago, I didn't even have a DS4 yet). I'm still on the process of migrating everything, but I will close this issue because I have enough evidences of it being caused by having both softwares running at the same time.

Thanks for your support guys. Greetings.

mika-n commented 4 years ago

Thanks for reporting the solution. I will add a note about this in Wiki docs in case someone else runs DS4Windows with JoyToKey.

Usually having more than one app to read the physical DS4 gamepad is OK, but in this case the other process prevents "exclusive mode" to do its tricks. This can lead to all sort of weird issues with games.