fix: disable DirectInput joystick enumeration on Windows #1050

Closed
Tenith01 wants to merge 1 commit from upstream-pr/1050 into main
Tenith01 commented 2026-10-07 04:37:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Tenith01 on 2026-10-07T04:37:36Z.


What

Disables SDL's DirectInput joystick backend on Windows (SDL_HINT_DIRECTINPUT_ENABLED = 0, SDL_HINT_DEFAULT priority, so the SDL_DIRECTINPUT_ENABLED environment variable still overrides it) before SDL_InitSubSystem in the VideoOutDriver constructor. DirectInput enumeration blocks forever in sceVideoOutOpen on machines with some vendor HID devices (Corsair iCUE, SteelSeries). XInput and HIDAPI pads stay; DirectInput-only devices are no longer detected (TechnicalDebt line added).

Fixes #1042

Tested

  • Windows 11, Ryzen 7 5800X, RTX 4090, WinLibs GCC 15.2.0, Release, on the machine that reproduces #1042 (@frankea): guest_video_out_wqhd_detection passes in 0.25 s with this change; the unpatched main build hangs and times out at 20 s.
  • Windows 11, WinLibs GCC 15.2.0, merged onto main (@WifeInLantern): builds, guest_video_out_wqhd_detection passes (machine does not reproduce the hang).
  • Not tested with a DirectInput-only pad connected.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted:
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4768003081 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1050). Originally posted by [Tenith01](https://github.com/Tenith01) on 2026-10-07T04:37:36Z. --- ### What Disables SDL's DirectInput joystick backend on Windows (`SDL_HINT_DIRECTINPUT_ENABLED` = `0`, `SDL_HINT_DEFAULT` priority, so the `SDL_DIRECTINPUT_ENABLED` environment variable still overrides it) before `SDL_InitSubSystem` in the `VideoOutDriver` constructor. DirectInput enumeration blocks forever in `sceVideoOutOpen` on machines with some vendor HID devices (Corsair iCUE, SteelSeries). XInput and HIDAPI pads stay; DirectInput-only devices are no longer detected (TechnicalDebt line added). Fixes #1042 ### Tested - Windows 11, Ryzen 7 5800X, RTX 4090, WinLibs GCC 15.2.0, Release, on the machine that reproduces #1042 (@frankea): `guest_video_out_wqhd_detection` passes in 0.25 s with this change; the unpatched `main` build hangs and times out at 20 s. - Windows 11, WinLibs GCC 15.2.0, merged onto main (@WifeInLantern): builds, `guest_video_out_wqhd_detection` passes (machine does not reproduce the hang). - Not tested with a DirectInput-only pad connected. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [ ] AI-assisted: <!-- yes / no -->
oneandonlydean commented 2026-10-08 03:25:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-08T03:25:29Z.


Has this been run on a machine that shows the hang? The Windows tests were skipped, and frankea offered on #1042 to test a change, so a confirmation there would do. Please also fill in the PR template and say which pads stop being detected without DirectInput.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6051536506 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1050#issuecomment-6051536506). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-08T03:25:29Z. --- Has this been run on a machine that shows the hang? The Windows tests were skipped, and frankea offered on #1042 to test a change, so a confirmation there would do. Please also fill in the PR template and say which pads stop being detected without DirectInput.
WifeInLantern commented 2026-10-09 07:24:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by WifeInLantern on 2026-10-09T07:24:27Z.


Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON, #1050 merged onto current main (clean, 3-line change). It builds and guest_video_out_wqhd_detection passes. This machine (18 HID devices) doesn't reproduce the #1042 hang, so that pass doesn't show the hang is fixed; confirmation needs a machine that hangs.

On the reviewer's question, from SDL 2.33.0 source: with the hint off, SDL_DINPUT_JoystickInit returns 0 with dinput = NULL and the DInput haptic path is skipped. XInput (Xbox pads) and HIDAPI (PS4/DualSense) are unaffected. Devices that stop being detected are DirectInput-only pads not handled by XInput or HIDAPI (generic gamepads, wheels, flight sticks). I haven't tested any such device.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6076422592 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1050#issuecomment-6076422592). Originally posted by [WifeInLantern](https://github.com/WifeInLantern) on 2026-10-09T07:24:27Z. --- Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`, #1050 merged onto current main (clean, 3-line change). It builds and `guest_video_out_wqhd_detection` passes. This machine (18 HID devices) doesn't reproduce the #1042 hang, so that pass doesn't show the hang is fixed; confirmation needs a machine that hangs. On the reviewer's question, from SDL 2.33.0 source: with the hint off, `SDL_DINPUT_JoystickInit` returns 0 with `dinput = NULL` and the DInput haptic path is skipped. XInput (Xbox pads) and HIDAPI (PS4/DualSense) are unaffected. Devices that stop being detected are DirectInput-only pads not handled by XInput or HIDAPI (generic gamepads, wheels, flight sticks). I haven't tested any such device.
adriadam10 commented 2026-10-09 22:04:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T22:04:05Z.

Review: CHANGES_REQUESTED


Thanks. The change itself looks right (hint exists in the bundled SDL2, set before SDL_InitSubSystem, SDL_HINT_DEFAULT keeps the env override). What's missing before it can merge:

  • Confirmation on a machine that actually hangs. @WifeInLantern's Windows run builds and passes guest_video_out_wqhd_detection, but that machine doesn't reproduce #1042, so it doesn't show the hang is fixed. @frankea offered to test on #1042; please ask for a run with and without the change and post the result here.
  • It drops DirectInput-only devices (generic pads, wheels, flight sticks; XInput and HIDAPI pads stay). That is a behaviour change on Windows: add a line under the matching section of docs/dev/TechnicalDebt.md saying so.
  • Fill in the PR template (What, Tested with OS and what was checked, the checklist including AI-assisted:). "Verified syntax correctness" is not a test.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5475775346 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1050#pullrequestreview-5475775346). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-09T22:04:05Z. **Review:** CHANGES_REQUESTED --- Thanks. The change itself looks right (hint exists in the bundled SDL2, set before `SDL_InitSubSystem`, `SDL_HINT_DEFAULT` keeps the env override). What's missing before it can merge: - Confirmation on a machine that actually hangs. @WifeInLantern's Windows run builds and passes `guest_video_out_wqhd_detection`, but that machine doesn't reproduce #1042, so it doesn't show the hang is fixed. @frankea offered to test on #1042; please ask for a run with and without the change and post the result here. - It drops DirectInput-only devices (generic pads, wheels, flight sticks; XInput and HIDAPI pads stay). That is a behaviour change on Windows: add a line under the matching section of `docs/dev/TechnicalDebt.md` saying so. - Fill in the PR template (`What`, `Tested` with OS and what was checked, the checklist including `AI-assisted:`). "Verified syntax correctness" is not a test.
frankea commented 2026-10-10 03:52:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-10T03:52:31Z.


Tested on the machine that reproduces #1042 (Windows 11 10.0.26200, Ryzen 7 5800X, RTX 4090 driver 616.92, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON). No SDL_* variable is set in the environment.

  • This branch as-is (7c28b1a0, base 000f2f74): guest_video_out_wqhd_detection passes in 0.25 s under ctest, and also exits 0 in 0.14 s when started in the logged-on desktop session via schtasks /IT. sceVideoOutOpen returns.
  • Control, same machine, same day: the unpatched main build (0c952fe5) still hangs in the same test and times out at 20 s.
  • Full suite on this branch: 379 of 379 passed, 0 skipped.

Not tested: a DirectInput-only pad, since none is connected here. The branch is 1320 commits behind main and was not rebased for this test.

Tested with AI assistance (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6093486267 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1050#issuecomment-6093486267). Originally posted by [frankea](https://github.com/frankea) on 2026-10-10T03:52:31Z. --- Tested on the machine that reproduces #1042 (Windows 11 10.0.26200, Ryzen 7 5800X, RTX 4090 driver 616.92, WinLibs GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`). No `SDL_*` variable is set in the environment. - This branch as-is (`7c28b1a0`, base `000f2f74`): `guest_video_out_wqhd_detection` passes in 0.25 s under ctest, and also exits 0 in 0.14 s when started in the logged-on desktop session via `schtasks /IT`. `sceVideoOutOpen` returns. - Control, same machine, same day: the unpatched `main` build (`0c952fe5`) still hangs in the same test and times out at 20 s. - Full suite on this branch: 379 of 379 passed, 0 skipped. Not tested: a DirectInput-only pad, since none is connected here. The branch is 1320 commits behind `main` and was not rebased for this test. Tested with AI assistance (Claude Code).
MarcZX10 commented 2026-10-10 09:46:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T09:46:25Z.


Follow-up on the requested review items

The report from frankea above now supplies the missing reproducer confirmation: on the affected Windows machine, sceVideoOutOpen returns with this change under the default environment, while the unpatched build still hangs. That closes the first item in the maintainer's review for the tested head.

Remaining item Current state Suggested update
Windows behavior change The hint disables DirectInput-only devices; XInput and HIDAPI remain available. No DirectInput-only pad was connected for a runtime check. Add a TechnicalDebt.md entry with that limitation and the SDL_DIRECTINPUT_ENABLED=1 opt-in.
PR description It still says only “Verified syntax correctness,” and does not include the new Windows reproduction/control result or the requested checklist. Replace it with the repository PR template and report the actual Windows and hosted test results, including AI assistance.
Base branch The head is based on 000f2f74; current upstream main is be403084c. Rebase onto current main and rerun the focused reproducer on the rebased head before merge.

My duplicate #2047 was closed in favor of this PR; it included a user-facing INPUT_MAPPING.md note that could also be adapted here. There is no need for a second PR. The current implementation's Windows guard and default-priority hint should remain the active fix.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6096259023 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1050#issuecomment-6096259023). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-10T09:46:25Z. --- ### Follow-up on the requested review items The report from `frankea` above now supplies the missing reproducer confirmation: on the affected Windows machine, `sceVideoOutOpen` returns with this change under the default environment, while the unpatched build still hangs. That closes the first item in the maintainer's review for the tested head. | Remaining item | Current state | Suggested update | |---|---|---| | Windows behavior change | The hint disables DirectInput-only devices; XInput and HIDAPI remain available. No DirectInput-only pad was connected for a runtime check. | Add a `TechnicalDebt.md` entry with that limitation and the `SDL_DIRECTINPUT_ENABLED=1` opt-in. | | PR description | It still says only “Verified syntax correctness,” and does not include the new Windows reproduction/control result or the requested checklist. | Replace it with the repository PR template and report the actual Windows and hosted test results, including AI assistance. | | Base branch | The head is based on `000f2f74`; current upstream `main` is `be403084c`. | Rebase onto current `main` and rerun the focused reproducer on the rebased head before merge. | My duplicate #2047 was closed in favor of this PR; it included a user-facing `INPUT_MAPPING.md` note that could also be adapted here. There is no need for a second PR. The current implementation's Windows guard and default-priority hint should remain the active fix.
adriadam10 commented 2026-10-11 08:49:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T08:49:59Z.


Ready to merge from my side, but the PR description fails the conventions check:

  • [pr-template] Fill in the pull request template: unchecked: AI-assisted:
  • [pr-template] Fill in the pull request template: answer AI-assisted with yes or no

Please fill those template lines in (only you can answer AI-assisted); it merges once they pass.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107294555 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1050#issuecomment-6107294555). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T08:49:59Z. --- Ready to merge from my side, but the PR description fails the conventions check: - [pr-template] Fill in the pull request template: unchecked: AI-assisted: - [pr-template] Fill in the pull request template: answer AI-assisted with yes or no Please fill those template lines in (only you can answer AI-assisted); it merges once they pass.
github-actions[bot] commented 2026-10-13 16:33:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T16:33:40Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#3664 core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp L261
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6150323908 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1050#issuecomment-6150323908). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-13T16:33:40Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #3664 | `core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp` [L261](https://github.com/boykopovar/AnyPS5/blob/604ce71864f952cc8cf6fb1f4966cc905e0c1466/core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp#L261) | | |
oneandonlydean commented 2026-10-14 01:02:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T01:02:31Z.


Thanks @Tenith01. Relanded in #5580 with your commit kept and you credited as co-author on the technical debt entry.
Closing in favour of it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6158524413 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1050#issuecomment-6158524413). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T01:02:31Z. --- Thanks @Tenith01. Relanded in #5580 with your commit kept and you credited as co-author on the technical debt entry. Closing in favour of it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!1050
No description provided.