Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PS4 controllers not detected since 2.0.9 (Win10) #6167

Closed
plane opened this issue Sep 1, 2022 · 10 comments
Closed

PS4 controllers not detected since 2.0.9 (Win10) #6167

plane opened this issue Sep 1, 2022 · 10 comments
Labels
waiting Waiting on user response
Milestone

Comments

@plane
Copy link

plane commented Sep 1, 2022

I have two PS4 controllers which I use daily for playing games, and they work fine for most purposes. They're connected to a Windows 10 computer via USB. However, when I try to use them with any version of SDL from 2.0.9 onwards, they aren't detected.

At first, I thought I must be using the API wrong, but I don't think it's related to my own code at all, because I can reproduce the same problem using other software. I'll give an example:

There's a tool called SDL2 Gamepad Tool by General Arcade which comes with SDL 2.0.7, and that detects my PS4 controllers just fine! And if I replace that DLL with version 2.0.8, it still works. But if I replace that DLL with any version 2.0.9 or later, my controllers are no longer detected.

To track down the problem, I built various revisions between 2.0.8 and 2.0.9 from source. In ba90412, my PS4 controllers still worked fine. I believe that was the last working revision. In 4f41f07, they no longer work. (There are ten revisions in between, but they're missing files and I don't think they build successfully.)

Additional notes:

  • I do have DS4Windows installed, but the exact same behavior seems to occur when DS4Windows is disabled.
  • The controllers are both model number CUH-ZCT2U.
  • I keep both controllers connected with USB. I haven't tried Bluetooth.
  • I'm on Windows 10 version 21H1 build 19043.1889.
  • My tests were mostly done using the pre-built DLLs from the tagged GitHub releases, but when I started testing revisions between 2.0.8 and 2.0.9, I used the MinGW toolchain to build my own DLLs.
@slouken slouken added this to the 2.26.0 milestone Sep 1, 2022
@slouken
Copy link
Collaborator

slouken commented Sep 1, 2022

We ignore PS4 controllers if DS4Windows or InputMapper are running. Does SDL_IsPS4RemapperRunning() return true for you?

@slouken slouken added the waiting Waiting on user response label Sep 1, 2022
@plane
Copy link
Author

plane commented Sep 2, 2022

Thank you, that's the missing piece of the puzzle! I can't turn off DS4Windows, I have to close it entirely for my controllers to work.

So the unexpected factors are:

  1. SDL isn't detecting whether DS4Windows is active, it only detects if there's a process running. Disabling it is not enough.
  2. I typically leave DS4Windows to create virtual DS4s, only switching to a virtual 360 controllers if a game requires it. SDL 2.0.8 and earlier works fine with those virtual DS4s, but if I want to use newer SDL I have to specifically choose virtual 360 controllers, or close DS4Windows entirely.

I'm inclined to use 2.0.8 for now.

EDIT: To answer your question specifically, yes, it returns true.

@slouken
Copy link
Collaborator

slouken commented Sep 2, 2022

Is there any way to detect whether DS4Windows is running, but disabled?

@plane
Copy link
Author

plane commented Sep 2, 2022

I don't know.

We could ping Ryochan7 to ask your question, if that isn't a violation of GitHub etiquette. I think he might be the most likely to know the answer.

Interestingly, it seems some people rename DS4Windows.exe to work around this sort of detection. In fact, enough people do so, apparently, that there are guides for it and support for renaming the .exe in the DS4Windows updater.

I was unaware of all of this when I opened this issue. My personal feedback is that I was confused by SDL choosing to disable PS4 controller support.

@slouken
Copy link
Collaborator

slouken commented Sep 2, 2022

Well, the motivation to ignore the PS4 controllers is so that games don't get duplicate input from both the PS4 controllers and the Xbox controllers created by DS4Windows.

@Ryochan7, is there a better way for SDL to tell whether there are virtual controllers active?

@plane
Copy link
Author

plane commented Sep 2, 2022

Well, the motivation to ignore the PS4 controllers is so that games don't get duplicate input from both the PS4 controllers and the Xbox controllers created by DS4Windows.

I figured that was the case. The other problem in my case was that DS4Windows was creating virtual PS4 controllers, not virtual Xbox controllers, so both the physical and virtual controllers got ignored, and I wasn't sure why my controllers wouldn't work in SDL.

@slouken
Copy link
Collaborator

slouken commented Sep 2, 2022

Well, the motivation to ignore the PS4 controllers is so that games don't get duplicate input from both the PS4 controllers and the Xbox controllers created by DS4Windows.

I figured that was the case. The other problem in my case was that DS4Windows was creating virtual PS4 controllers, not virtual Xbox controllers, so both the physical and virtual controllers got ignored, and I wasn't sure why my controllers wouldn't work in SDL.

Ah, that's even worse. Hopefully @Ryochan7 can chime in with the best way to handle integration with SDL.

@AntTheAlchemist
Copy link
Contributor

Can I chime in? I would prefer SDL to see both the real and duplicated virtual controllers. That would be the default behaviour of games anyway, and users would only be expected to use DS4Windows for games that don't see PS controllers. I vote for the DS4Windows detection to be removed entirely, or at least wrap a hint around it.

@Ryochan7
Copy link

Ryochan7 commented Sep 8, 2022

DS4Windows virtual device detection only works for virtual DS4 controllers made with ViGEmBus currently. All DS4Windows does is check each detected DS4 controller for an exposed UINumber property which is populated by ViGEmBus. If the value returned is not null or empty then DS4Windows considers the device to be a virtual one and skips it. The same routine would not work when trying to detect virtual DS4 devices created with reWASD but most people would not try to use both mappers at the same time. It hasn't been a big concern.

Nefarius implemented a different approach that DS4Windows will probably use in the future; still working on some details. The approach finds the device parent and walks up the device tree. It looks like if the ROOT enumerator is detected then the device will be considered virtual.

https://github.com/nefarius/Nefarius.Utilities.DeviceManagement/blob/e005f582c9d62f0bc3055a3efc6fec509648bbed/PnP/PnPDevice.cs#L221

DS4Windows recommends people use HidHide on the initial setup window so the real DS4 can be hidden from other processes. Using the HidHide driver removes the double input issue when it comes to remapping. The HidHide configuration utility can be set up to hide and unhide devices as needed. I mainly use emulated DS4 output to play some older PC games that only support DirectInput that need extra remapping to work; Shadows of the Empire is one game that comes to mind.

@slouken
Copy link
Collaborator

slouken commented Sep 8, 2022

Okay, thanks for the feedback. We'll go ahead and remove the special handling for DS4Windows from SDL and Steam.

@slouken slouken closed this as completed in 4071573 Sep 8, 2022
PJB3005 pushed a commit to PJB3005/SDL that referenced this issue Oct 5, 2022
DS4Windows can create both emulated Xbox and emulated PS4 controllers, and we don't know which the user has it doing, so don't try to second guess it, just let it do it's thing. Users should follow the remapping software recommendations on when to enable/disable it for various situations.

Fixes libsdl-org#6167
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting Waiting on user response
Projects
None yet
Development

No branches or pull requests

4 participants