Skip to content

fix: disable DirectInput joystick enumeration on Windows - #1050

Closed
Tenith01 wants to merge 1 commit into
boykopovar:mainfrom
Tenith01:fix/issue-1042-directinput-hang
Closed

Tenith01 wants to merge 1 commit into
boykopovar:mainfrom
Tenith01:fix/issue-1042-directinput-hang

Conversation

@Tenith01

@Tenith01 Tenith01 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

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

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:

@github-actions github-actions Bot added the prx label Oct 7, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown

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 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

frankea commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Collaborator

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

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

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

@oneandonlydean

Copy link
Copy Markdown
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: SDL DirectInput enumeration in sceVideoOutOpen blocks forever on a HID device, so video out never opens

6 participants