Ryochan7 / DS4Windows

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

Double Input workaround (for those with hidguardian not working) #720

Closed Yohoki closed 4 years ago

Yohoki commented 5 years ago

I hadn't seen it posted anywhere, so I'll post it here in case no one else knows.

Some games have native support for DS4 controllers. This is fine and all, except when we are also using DS4Windows. This causes issues in the game where it is detecting both a DS4 and an XBox controller and causes our inputs to be doubled. Some people can fix this with the "Hide DS4 Controller" option, but it doesn't seem to work for everyone. It an also be stopped with the "Turn off DS4Windows Temporarily" option, but this disables all custom inputs for the game.

My solution? Unbound buttons.

Make a new profile with all buttons set to Unbound. This will allow you to use the DS4 controller without passing controls through the XBox virtual controller. After that, you can set custom controls for buttons that have little effect on the game, such as using "Share" as "Alt+Tab" or Touchpad as special controls. If a certain game doesn't use all of the controller buttons, you have more custom keys to work with. This gives you the benefit of using DS4 by itself and still being able to use some (limited) keyboard and macro options.

mika-n commented 5 years ago

If you use pure "keyboard + mouse" output mapping (ie. not re-mapping DS4/XBox gamepad keys to another gamepad key) then "Use DInput Only" profile option can be used without hiding the original DS4 controller by "Hide DS4 Controller (=exclusive mode)" option or through HidGuardian driver.

See this Wiki page for more info about "Use DInput only" option: https://github.com/Ryochan7/DS4Windows/wiki/Settings#use-dinput-only

However, hiding the original controller and using UseDInputOnly option should NOT be used at the same time because then you would end up without any controllers (see https://github.com/Ryochan7/DS4Windows/wiki/Troubleshooting#games-dont-see-any-controller-not-the-virtual-gamepad-controller-or-physical-controller)

But, your solution is quite interesting if macros don't work with "Use DInput Only" profile option. I haven't tested it.

Please test whether macros work with "Use DInput only" option with your profiles. If those don't work then your suggestion of using "unbound all buttons and axies, but leave just few irrelevant keys mapped" solution is an alternative way to use the original DS4 gamepad keys directly but still using pure keyboard+mouse+macro rules of DS4Windows app.

I'm also posting here few links to DS4Win Wiki pages for those who might be fighting with double inputs or failing "hide original controller" issue: https://github.com/Ryochan7/DS4Windows/wiki/Troubleshooting https://github.com/Ryochan7/DS4Windows/wiki/Exclusive-Mode-(Hide-DS4-Controller-config-option)-tips-and-issues

Yohoki commented 5 years ago

Just tested it. Macros do work with "Use DInput Only". That's a much simpler solution that I didn't know about. Thanks! The tooltip does say "(Wired Only)" so maybe this doesn't work for everyone? I only have wired connection, so I cannot tell what it does on bluetooth.

It looks like it doesn't support being able to remap controller buttons to other unused buttons, but that would probably cause issues on a few games any, since input is coming from 2 different controllers. I know at least a few games that the biggest issue is only the button icons change from xbox to ps and back.

I've yet to find any way to play Sekiro with a DS4 controller, so I've been trying lots of things. XD

mika-n commented 5 years ago

Sekiro should work with DS4Windows as long the original controller is hidden via "Hide DS4 Controller" option or via HidGuardian device driver.

HideDS4Controller (=exclusive mode) option may be a bit problematic unless the PC is booted in a way that DS4Windows app is the very first application to grab a connection to a DS4 gamepad right after it is connected to a PC. This works but some other background apps may cause problems.

If the HideDS4Controller "hide" technique doesn't work then HidGuardian device driver should work for sure because it goes under the hood (WindowsOS kernel mode driver).

Anyway, Sekiro is one of those games which require that the original controller is hidden to avoid double inputs and spinning camera problems.

Yohoki commented 5 years ago

Ya. The spinning camera is the main issue. I can't ever get HideDS4 to work and didn't have any luck with HIDGuardian. I'll try reading the instructions again, maybe I've been setting it up wrong. I was just happy blaming Win10 for being bad, rather than user error. XD

Ryochan7 commented 5 years ago

The tooltip does say "(Wired Only)" so maybe this doesn't work for everyone? I only have wired connection, so I cannot tell what it does on bluetooth.

Macros and keyboard and mouse bindings will still work when using Bluetooth. The one thing that will not work is attempting to use the original DirectInput controller in games. Games will see the original DirectInput controller but it will be seen as a dead controller. The mode switch that DS4Windows does to use the extra features of the DS4 (touchpad, gyro, lightbar) causes that behavior to happen; the same behavior also occurs when using the Steam mapper. USB and the Sony Wireless Adapter do not exhibit that type of behavior.

The spinning camera is the main issue.

That seems to be a somewhat common issue with From Software games as I have the same problem with Dark Souls 1. The problem is that the game has partial DirectInput controller support but it does not interpret the trigger axes correctly. If you pull both triggers around half-pull, the camera should stop spinning. The DS4 has to be hidden and a virtual Xbox 360 controller must be used to play the game as intended.

Exclusive mode is a tricky process depending on the software installed on your PC. Using HidGuardian is a safer way to get exclusive access to the DS4. When attempting to using the old "Hide DS4 Controller" option, you can track down which process has access to the DS4 and causing exclusive mode to fail. It is a bit of work but it has helped me in the past. Even an app like the Windows Store can cause exclusive mode to fail.

http://www.imatest.com/2017/01/how-to-determine-what-processes-are-using-a-device/

Yohoki commented 5 years ago

I did use the Process Explorer before when it was first mentioned here, but I was getting only "explorer.exe" as the culprit, which I can't just kill in task manager... I installed a new GPU this week, though and it seems Nvidia Share is hogging the device now, so I was hoping that would help. Unfortunately, killing it didn't fix the exclusive mode problem and process explorer shows 0 results when refreshing and searching again.

I'm attempting the HIDGuardian app again with the test installer. I'll check back in a few minutes, since I have to restart.

Edit: It may be a while... I've somehow messed up the ViGEm driver and can't get it to reinstall....

Yohoki commented 5 years ago

... well now exclusive mode just works....After 30 minutes of ViGEm not installing and HIDGuardian not cooperating and updating DS4Windows again. I don't have a clue what I've done now, but I've broken it so bad that it fixed itself... So I guess I have exclusive mode working. Now if only I had a way to get the PS4 buttons to show up XD

Edit: reading through some of the other issues, I see one in particular with a Twitter message throwing some shade at your work. Just wanna be clear that I'm 100% pleased with all the effort you've put into this program! It's buggy at times, but A lot of us know that's the nature of the beast and not a fault of bad coding! So thanks for all your help!

mika-n commented 5 years ago

... well now exclusive mode just works....After 30 minutes of ViGEm not installing and HIDGuardian not cooperating and updating DS4Windows again. I don't have a clue what I've done now,

There has been cases where DS4Windows has failed to install ViGem driver (or installation may have succeeded but the installer complains that it failed even when it did not). The latest development version has fixes related to installation of ViGem driver.

The troubleshooting document mentions about a workaround to this ViGem installation problem. You can install ViGem driver directly before running DS4Windows installer. Here is a link to others who may stumble upon this discussion: https://github.com/Ryochan7/DS4Windows/wiki/Troubleshooting#nothing-works-and-ds4windows-app-and-vigem-driver-connection-silently-doesnt-do-anything

So I guess I have exclusive mode working. Now if only I had a way to get the PS4 buttons to show up

The latest DS4Windows supports both x360 and Dualshock4 output modes. If the game supports DS4 controller (and this way knows how to show DS4 gamepad button layout images) then you could try to use a dualshock4 output option in DS4Windows profile.

But, the use of virtual dualshock4 output mode and revision1 ds4 physical controller and HidGuardian driver is a bit problematic. HidGuardian cannot tell the difference between virtual dualshock and v1 ds4 physical controller, so it would hide both. Not good.

However, if you have revision2 DS4 physical controller (comes with DS4 Pro console) then there is a workaround because you can tell HidGuardian to hide the rev2 DS4 physical controller and leave the virtual rev1 DS4 controller visible. Take a look at this thread: https://github.com/Ryochan7/DS4Windows/issues/669#issuecomment-487302990

Of course, if you can use the "Hide DS4 Controller" option of DS4Windnows to hide the original physical controller then it works with rev1 and rev2 DS4 gamepads even with dualshock4 virtual output mode. But sometimes the exclusive mode is a bit problematic and HidGuardian is required to avoid double inputs.

Yohoki commented 5 years ago

Mixed results so far. No games were noticing input when using DS4 controller option, even "A Way Out" which I had played only a few days ago. I had HIDGuardian manually installed, so I removed it in device manager to see if that was the issue, maybe it was blocking both controllers. After reboot, no controllers are detected by DS4Windows. Man... This sure changed from an "Hey I have an Idea!" kinda thread to a "Hey, I broke something" XD I'm so sorry guys!

mika-n commented 5 years ago

What do you see when you run Joy.cpl command? Or open the "Control Panel" link in DS4Win options screen (it takes to the Joy.cpl controlPanel applet).

Make sure you don't have UseDInputOnly option enabled in a DS4Win profile if you hide the original controller (via exclusive mode or HidGuardian tool).

Do you use x360 output mode in DS4Win profile or dualshock4 output mode? If you have dualshock4 output mode then do you have rev1 DS4 controller or rev2 DS4-Pro controller?

What do you have in HKEY_Local_Machine\System\CurrentControlset\Services\HidGuardian\Parameters\AffectedDevices lists in registry editor (run regedit.exe tool)?

What do you see in DS4Win Logs tab page?

Yohoki commented 5 years ago

What do you see when you run Joy.cpl?

Joy.cpl shows nothing in the list. Device Manager shows a HID game controller like normal.

Make sure you dont have Use DInput Only enabled

Roger. Still nothing.

Do you use x360 output?

I have several profiles set up with different settings. I can't select any of them for the controller, though because the controller isn't showing in DS4Windows's list either.

Do you have rev1 DS4 or rev2?

Both. Neither work, I'm afraid.

What do you have in ...\AffectedDevices lists in regedit?

HID\VID_054C&PID_05C4
HID\VID_054C&PID_09CC&MI_03
HID\VID_054C&PID_0BA0&MI_03
HID\{00001124-0000-1000-8000-00805f9b34fb}_VID&0002054c_PID&05c4
HID\{00001124-0000-1000-8000-00805f9b34fb}_VID&0002054c_PID&09cc

What do you see in DS4Win Logs?

6/5/2019 7:13:29 AM: DS4Windows version 1.7.9
6/5/2019 7:13:45 AM: Starting...
6/5/2019 7:13:45 AM: Connection to ViGEmBus 1.16.112.0 established
6/5/2019 7:13:45 AM: Searching for controllers...
6/5/2019 7:13:45 AM: Using Shared Mode
6/5/2019 7:26:45 AM: Closing connection to ViGEmBus
mika-n commented 5 years ago

What do you see when you run Joy.cpl? Joy.cpl shows nothing in the list. Device Manager shows a HID game controller like normal.

Hmmm.... If this joy.cpl doesn't list anything then maybe HidGuardian is hiding all devices? Both physical and virtual controller in case the default profile uses dualshock4 output type.

If you clear AffectedDevices sysreg enry of HidGuardian settings (or append &HidDisabled tag to every line if you want to preserve existing values) and re-connect DS4 controller then does it popup visible after this? It it does then HidGuardian is hiding the physical controller (as it should) but for some reason the virtual controller is not created by DS4Win app.

What do you have in "%APPDATA%\ds4windows\profiles.xml file and in Profiles\xxx.xml profile files? You can zip those file and attach an attachment in here.

Do you use x360 output? I have several profiles set up with different settings. I can't select any of them for the controller, though because the controller isn't showing in DS4Windows's list either.

This could happen if for some reason DS4Windows app fails to update HidGuardian\Parameters\Whitelist sysreg entry. Or actually it is HidGuardHelper.exe tool in the DS4Win installation folder which modifies the sysreg on the fly.

When you launch DS4Windows app then do you see the process ID number of DS4Win app in the HidGuardian\Parameters\Whitelist sysreg list? If not then HidGuardian hides the physical controller from DS4Win app also. The next step would be to find out why HidGuardHelper.exe fails to set process-id into the Whitelist sysreg entry. Permission issue?

Yohoki commented 5 years ago

Dude, I'm so sorry. Thanks for being awesome and really helpful.

If you clear AffectedDevices sysreg entry?

I already tried it when I saw it was there. It's still not changed anything. Although, after deleting it and rebooting, DS4Windows wants me to install ViGEm driver again, which continues to fail.

Can you zip your Profiles?

Yep. I tossed Profiles.xml in with the profiles for you. Profiles.zip

Is DS4Win's process ID# in the Whitelist sysreg list?

No. There's a single listing there that doesn't match any running processes. It's probably because I've uninstalled HIDGuardian, so it's left an old one there. image

Permission Issue?

I'm running DS4Win as admin, so it should have the permissions it needs.

Yohoki commented 5 years ago

Tried installing C++ 2017 redist and still no luck with ViGEm installer either.

mika-n commented 5 years ago

Try downloading the latest VigEm driver directly from Nefariu's web site and install it before running DS4Windows: https://github.com/ViGEm/ViGEmBus/releases At the moment the latest file is ViGEmBus_Setup_1.16.115.exe

This should take care of DS4Win complaining about VigemBus driver.

Didn't see anything wrong in profile files. But if there are any doubts that a profile or existing settings may cause something weird then delete everything (or backup to another folder) everything under "%APPDATA%\DS4Windows\ folder structure. The next time you launch the DS4Win app it will re-create all xml config and profile files with default values.

You mentioned that at some point you uninstalled HidGuardian. Maybe there are still some left overs from an old installation? You can use the DS4Win "test installer" to install and uninstall HidGuardian device driver. Try uninstalling HidGuardian through this tool and then re-install HidGuardian. https://github.com/Ryochan7/DS4Windows/wiki/DS4Windows-and-HIDGuardian-Install-and-Setup-Guide#hidguardian-test-installer

If you have Windows7 then it needs couple Microsoft hotfixes before VigEmBus driver works. https://github.com/Ryochan7/DS4Windows/wiki/Troubleshooting#nothing-works-and-ds4windows-app-and-vigem-driver-connection-silently-doesnt-do-anything

Yohoki commented 5 years ago

Also trying a fresh install of DS4Win. My folder has gotten quite cluttered after so many updates adding new things. I don't think it ever does cleanup to remove old files that are depreciated. Not an issue and it didn't fix Controllers anyway,

Download VigEm driver Directly.

Already on it. DS4Win was trying to download it, so I quickly grabbed the filename before it deleted it from the folder. I wasn't having any luck with that yesterday, but it seems to have worked now. I tried the "Repair" option, and nothing happened but uninstalling and reinstall worked. That's fixed the controllers. They show up now.

Loading up A Way Out also shows ds4 inputs are being accepted again, even with the new DS4 controller option set in settings.

I'm guessing it was HIDGuard that was blocking my DS4s and the Virtual driver from working in-game. Now that it's been erased and ViGEm reinstalled, they just work again. It's possible my controller that I thought was a rev2 is rev1. Is there a way to check? It has the light on the touchpad, so I've always assumed it was rev2.

Yohoki commented 5 years ago

I did try the test installer for HIDGuard yesterday. It only showed "Uninstall" option, but didn't actually uninstall it.

Today, it's actually working and trying to install.

mika-n commented 5 years ago

You can tell the revision of DS4 gamepad by looking at the model tag at the back of the controller: MODEL CUH-ZCT1xxx (xxx=some extra letters). -> Revision 1 MODEL CUH-ZCT2xxx -> Revision 2

Another way is to take a look at the hardware IDs in WinOS "device manager" after you have connected the controller. See the picture below.

DS4Win_DS4Rev1VSRev2Controller

mika-n commented 5 years ago

And I already mentioned about the potential conflict between HidGuardian and rev1 physical controller and the new "dualshock4" output type of DS4Windows app (ie. virtual ds4 controller acting as rev1 controller). https://github.com/Ryochan7/DS4Windows/issues/669#issuecomment-487302990

So, if you use HidGuardian to hide the original controller then you have to use rev2 ds4 gamepad with DS4Win+dualshoch4 virtual output+HidGuardian combination as explained in the #669 post mentioned above. If you use x360 virtual output option of DS4Win profiles then you don't have to worry about it.

Yohoki commented 5 years ago

Just checked the hardware IDs. It was a rev2 that I was using.

mika-n commented 5 years ago

Okey. Then you are good to go with HidGuardian and dualshock4 virtual output type as long you modify the AffectedDevices sysreg entry as explained in the post linked above (ie. remove rev1 device identifiers, so rev1 ds4 virtual controller is not hidden by HidGuardian).

HidGuardian may break (ie. it is no longer hiding the physical controller) after major Windows updates, so keep in safe place the DS4Win testInstaller tool because it is an easy way to uninstall and re-install HidGuardian.

Yohoki commented 5 years ago

Thanks bro. You were a lot of help. I've actually got is set up working with the "Hide DS4" option without HIDGuardian installed, so I'll keep that going until an update breaks it. Partially because I've already got it all set up again with the DS4 prompts on games that work, but also because I only have 1 rev2 controller, and I play games with my kids on here, so we need to use the other 2 rev1 controllers as well.

I'll keep monitoring to see if HIDGuardian gets updated to ignore virtual controllers. I believe I saw a post somewhere where Ryochan7 had gotten it to work with minimal tweaking.

Ryusennin commented 5 years ago

Best way to check: if you can see the lightbar through the touchpad upper side, it's a revision 2.

Yohoki commented 5 years ago

Best way to check: if you can see the lightbar through the touchpad upper side, it's a revision 2.

Ya, I had mentioned that it had the light. But it's missing the sticker, so Hardware IDs worked fine for making sure it was rev2.

joseashb commented 5 years ago

How can I use HidGuardian with DS4Windows while having both rev1 & rev2 controllers? Windows 10 Pro x64 1903

mika-n commented 5 years ago

Use rev1 controller in xbox360 output mode (Controller option in a profile settings). For years the xbox360 output mode used to be the only option in DS4Windows and it continues to work just fine with both rev1 and rev2 controllers. Only recently DS4Windows started to support an alternative dualshock4 output controller type. Unfortunately HidGuardian cannot tell the difference between physical and virtual ds4 rev1 controller (or it could but the current signed public HidG version doesn't do it).

If you want to use the new dualshock4 Controller output mode of DS4Windows app with HidGuardian then you must have rev2 controller and tweak AffectedDevices sysreg entry as described above.

Or if the DS4Windows built-in "Hide DS4 Controller" (=exclusive mode) works in your setup then you don't have to use HidGuardian at all and therefore it won't cause problems with rev1 controller.