Ryochan7 / DS4Windows

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

[Solved] Output type "Dualshock 4" with HIDGuardian. #1099

Closed Fredrik95 closed 4 years ago

Fredrik95 commented 4 years ago

When HIDguardian is active the output mode "Dualshock 4" does not work (unless I'm missing something), is it possible to create a virtual DS4 controller just as the virtual Xbox controller is created in those situations? (Maybe that would be blocked by HIDGuardian too, I don't know)

I'd really like it if I could switch profiles from Xbox to DS4 for games that support it without having to change a bunch of settings.

Thank you for your time.

mika-n commented 4 years ago

Do you have DS4 revision1 or revision2 gamepad?

Anyway. The problem with HidGuardian is that the default setup to hide the origial DS4 gamepad hides both physical and virtual DS4 gamepad devices. The good news is that there is a solution. All you need to do is to tweak AffectedDevices sysreg entry of HidGuardian tool to hide only DS4 revision2 gamepad HID hardware identifier. This leaves the virtual DS4 gamepad devices visible because those have DS4 revision1 HID hardware identifier string value.

If you have rev1 DS4 gamepad then you have a problem because there is no way to differentiate between the rev1 physical and rev1 virtual DS4 devices. HidG tool hides both. You may get this working if you connect the rev1 DS4 over BT connection and list only BT rev1 identifier in AffecedDevices sysreg entry. The virtual DS4 device has "USB" type of identifier, so if you don't list this in AffectedDevices list then the virtual DS4 device may be left visible and available for games.

See the following posts: https://github.com/Ryochan7/DS4Windows/issues/669#issuecomment-487302990 https://github.com/Ryochan7/DS4Windows/issues/844#issuecomment-541345798

Another issue may be with Steam client. It has a nasty feature. See the following doc page: https://github.com/Ryochan7/DS4Windows/wiki/Troubleshooting#steam-doesnt-see-the-virtual-output-controller-if-a-profile-uses-the-dualshock4-output-type-steam-sees-the-ds4-controller-only-if-ds4windows-uses-xbox360-output-controller-type

Fredrik95 commented 4 years ago

Hey, thank you for the reply!

I have the v2, or it says so in the log at least ("Found Controller: F4:93:9F:A4:9A:4A (BT) (DS4 v.2)").

I tried that registry edit, now it indeed seems to work I think (Didn't at first but noticed you missed a few '\' in the paths you linked to), the AffectedDevices entry is now. HID\VID_054C&PID_09CC&REV_0100&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

With the linked HTML gamepad tester ( https://html5gamepad.com/ ), the '05c4' controller now shows up where there were none before (and would before have 2 controllers simultaneously if HIDGuardian and Hide option were disabled and none if enabled), I assume that's the virtual one, and '09cc' the "real" one?

I have disabled all Steam controller functionality (and do not use Big Picture Mode or anything like that, only games) so that shouldn't interfere.

mika-n commented 4 years ago

Yes. 05c4 is a physical rev1 ds4 OR a virtual ds4 gamepad. Because you have rev2 (DS4 v.2) physical gamepad then you know this is for sure the virtual output gamepad device. 09cc is a rev2 DS4 gamepad (ViGem driver and DS4Win app never uses this ID for virtual output gamepad devices). HidG seems to be doing it's job now.

Reminder. If HidG stops working after major WinOS feature updates then you have to re-install HidG driver (keep the installer near by) because sometimes major feature updates break the driver registration.

Ryochan7 commented 4 years ago

Besides what has been mentioned already, getting a rev. 1 controller working with HidGuardian would require a change to the driver itself to ignore virtual controllers. I had a test patch at one point that made HidGuardian ignore any HID device with a UINumber(?) associated with it. ViGEmBus puts that attribute on virtual devices that it creates so that is the only way to distinguish a real DS4 v.1 from an emulated DS4 v.1.

Fredrik95 commented 4 years ago

Great, thank you both for the information, it has helped immensely! I now know how to setup HIDGuardian properly and how to fix it again if it stops working. (The wiki should really include the explanation between the rev1 and 2, in addition to the AffectedDevices string, directly and not just link to it) :)

Thanks again!