SDL2: Fix PDP Afterglow Wireless Controller for Nintendo Switch #13308
+2
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
I received a few reports from players that the PDP Afterglow Wireless Controller caused Hades II to lock up and become nearly unresponsive. After acquiring the controller, this was readily reproducible by plugging it into a PC via cable. I noticed the same behavior on macOS, but not on Linux (via Proton).
The controller is intended for wireless use only according to the product manual. When connected over USB,
BReadDeviceInfo()
fails to get a response. This kicks the can down the road toSDL_JoystickOpen
, where the controller is equally unresponsive and procs theCouldn't load stick calibration
error. However, the SDL_JOYDEVICEADDED event continues firing, which is the source of the lock-up. Early-outing inHIDAPI_DriverSwitch_InitDevice()
seemed reasonable in this case.It might be better to simply return false if
BReadDeviceInfo()
also returns false, but I don't know if that'll work with all controllers. This is similar to the PowerA controller that's ignored inSDL_joystick.c
, which is also a "Lic Wireless Controller" in Windows. I tried ignoring the PDP controller too, but that prevented it from working over Bluetooth, which how I ended up with this fix.(I found a similar report on the Factorio support forum, but I was unable to repro this on the latest Steam build.)