fix(libSceVideoOut): add APS5_NO_WGI to turn off SDL's Windows.Gaming.Input backend #7005

Merged
TheSovietWaffle merged 3 commits from upstream-pr/7005 into main 2026-10-19 22:53:01 +00:00
TheSovietWaffle commented 2026-10-17 04:07:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TheSovietWaffle on 2026-10-17T04:07:22Z.


What

On Windows, VideoOutDriver keeps SDL's Windows.Gaming.Input joystick backend on by default. When APS5_NO_WGI is set, it sets SDL_HINT_JOYSTICK_WGI to 0 at SDL_HINT_DEFAULT priority before SDL_InitSubSystem, next to the existing SDL_HINT_DIRECTINPUT_ENABLED line, following the other APS5_NO_* switches. The Windows game controllers entry in docs/dev/debt/libSceVideoOut.md describes the opt-out: what it fixes, what it drops (racing wheels, arcade and flight sticks, HID pads without an HIDAPI driver, Xbox One/Series trigger rumble) and the host where the fault was seen.

On that Windows 10 host the WGI backend faults a few seconds into every run, in every title I ran:

FATAL: unhandled exception 0xc0000005 on thread 3792 ''
  rip 0x00007ffecc230a84 Windows.Gaming.Input.dll+0x10a84
  read of 0x0000000000000000
  stack return address candidates:
    [rsp+0x28] libSceAgcDriver.prx+0x669f51
    [rsp+0xc8] libSceVideoOut.prx+0x8362
    [rsp+0x158] libSceVideoOut.prx+0x8ab5

[rsi] holds the tail of SDL's SDL_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED hint name. Device Manager on this host lists Nefarius Virtual Gamepad Emulation Bus (OK) and Oculus Virtual Gamepad Emulation Bus (Error); I have not established which, if either, triggers the fault.

Tested

Windows 10 Pro 22H2 (19045), Ryzen 7 7800X3D, RTX 3080 (NVIDIA 617.42), WinLibs GCC 15.2.0 r7, Release.

Title Build Runs Faults at Windows.Gaming.Input.dll+0x10a84
EVO Player (PPSA99039), catalog 0.12.0 main 26 26
EVO Player this PR, default 3 3
EVO Player this PR, APS5_NO_WGI=1 3 0
Onimusha: Way of the Sword (PPSA27836) WGI off many 0; reaches the title screen and the story
  • pad_input, pad_input_mapping, pad_keyboard_mouse, pad_sdl, guest_pad and guest_pad_vibration_mode pass on this head.
  • Earlier results on this PR (WGI off by default): a wired Xbox 360 controller is still opened as XInput Controller #1; @screamm's RTX 4070 / Windows 11 cross-check and @cadenasynyster's DualSense over Bluetooth check are in the comments.
  • tools/check_conventions.py --base origin/main passes.

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 under Silent stubs in their library's technical debt file
  • 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
  • Unblocks: none (EVO Player PPSA99039 and Onimusha PPSA27836 start on this host with APS5_NO_WGI; no bring-up discussion)
  • GPUs tested: NVIDIA RTX 3080, 617.42, Windows 10 Pro 22H2 (19045)
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4897117024 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7005). Originally posted by [TheSovietWaffle](https://github.com/TheSovietWaffle) on 2026-10-17T04:07:22Z. --- ### What On Windows, `VideoOutDriver` keeps SDL's Windows.Gaming.Input joystick backend on by default. When `APS5_NO_WGI` is set, it sets `SDL_HINT_JOYSTICK_WGI` to `0` at `SDL_HINT_DEFAULT` priority before `SDL_InitSubSystem`, next to the existing `SDL_HINT_DIRECTINPUT_ENABLED` line, following the other `APS5_NO_*` switches. The Windows game controllers entry in `docs/dev/debt/libSceVideoOut.md` describes the opt-out: what it fixes, what it drops (racing wheels, arcade and flight sticks, HID pads without an HIDAPI driver, Xbox One/Series trigger rumble) and the host where the fault was seen. On that Windows 10 host the WGI backend faults a few seconds into every run, in every title I ran: ``` FATAL: unhandled exception 0xc0000005 on thread 3792 '' rip 0x00007ffecc230a84 Windows.Gaming.Input.dll+0x10a84 read of 0x0000000000000000 stack return address candidates: [rsp+0x28] libSceAgcDriver.prx+0x669f51 [rsp+0xc8] libSceVideoOut.prx+0x8362 [rsp+0x158] libSceVideoOut.prx+0x8ab5 ``` `[rsi]` holds the tail of SDL's `SDL_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED` hint name. Device Manager on this host lists `Nefarius Virtual Gamepad Emulation Bus` (OK) and `Oculus Virtual Gamepad Emulation Bus` (Error); I have not established which, if either, triggers the fault. ### Tested Windows 10 Pro 22H2 (19045), Ryzen 7 7800X3D, RTX 3080 (NVIDIA 617.42), WinLibs GCC 15.2.0 r7, Release. | Title | Build | Runs | Faults at `Windows.Gaming.Input.dll+0x10a84` | |---|---|---|---| | EVO Player (PPSA99039), catalog 0.12.0 | `main` | 26 | 26 | | EVO Player | this PR, default | 3 | 3 | | EVO Player | this PR, `APS5_NO_WGI=1` | 3 | 0 | | Onimusha: Way of the Sword (PPSA27836) | WGI off | many | 0; reaches the title screen and the story | - `pad_input`, `pad_input_mapping`, `pad_keyboard_mouse`, `pad_sdl`, `guest_pad` and `guest_pad_vibration_mode` pass on this head. - Earlier results on this PR (WGI off by default): a wired Xbox 360 controller is still opened as `XInput Controller #1`; @screamm's RTX 4070 / Windows 11 cross-check and @cadenasynyster's DualSense over Bluetooth check are in the comments. - `tools/check_conventions.py --base origin/main` passes. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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 - [x] Unblocks: none (EVO Player PPSA99039 and Onimusha PPSA27836 start on this host with `APS5_NO_WGI`; no bring-up discussion) - [x] GPUs tested: NVIDIA RTX 3080, 617.42, Windows 10 Pro 22H2 (19045) - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-17 04:15:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T04:15:47Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 674 core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp
PR 4040 docs/dev/debt/libSceVideoOut.md
PR 5021 core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp
PR 6879 core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp
PR 6977 docs/dev/debt/libSceVideoOut.md
PR 7201 core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp
PR 7332 core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp
PR 7690 docs/dev/debt/libSceVideoOut.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6229525070 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7005#issuecomment-6229525070). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-17T04:15:47Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 674](https://www.github.com/boykopovar/AnyPS5/pull/674) | `core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp` | | [PR 4040](https://www.github.com/boykopovar/AnyPS5/pull/4040) | `docs/dev/debt/libSceVideoOut.md` | | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp` | | [PR 6879](https://www.github.com/boykopovar/AnyPS5/pull/6879) | `core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp` | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `docs/dev/debt/libSceVideoOut.md` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp` | | [PR 7332](https://www.github.com/boykopovar/AnyPS5/pull/7332) | `core/libs/prx/libSceVideoOut/src/VideoOutDriver.cpp` | | [PR 7690](https://www.github.com/boykopovar/AnyPS5/pull/7690) | `docs/dev/debt/libSceVideoOut.md` |
screamm commented 2026-10-17 10:05:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-17T10:05:47Z.


Cross-validation on Windows 11 Pro 26220, NVIDIA RTX 4070 (596.21), MinGW GCC 15.2, PR head 9c5920b9f, built together with #6956 (disjoint files) on main 5f61879a9 (clean merge). Before-runs used a build of 3b10c7ef0; the SDL/VideoOut/Pthread/Time sources are identical between the two.

  • Full build and libs: pass.
  • pad_input, guest_pad, guest_pad_vibration_mode, pad_sdl, pad_input_mapping, pad_keyboard_mouse, --repeat until-fail:3: 3 of 3 pass each (run twice, once on a busy host).
  • EVO Player PPSA99039, relinked, 60 s per run, no stop line in any run. Checking the process modules every 3 s: on main, Windows.Gaming.Input.dll is loaded 22 s and 33 s into the two runs with a complete sample (two earlier runs: by 20 s and by 50 s), together with xinput1_4.dll. With this PR it is never loaded in the two complete runs (62 s and 57 s; xinput1_4.dll is loaded at 27 s and 32 s), and with SDL_JOYSTICK_WGI=1 set on the PR build it is loaded again (26.6 s). So the hint takes effect and the environment variable turns it back on, as the description says.
  • Your fault (Windows.Gaming.Input.dll+0x10a84) does not occur on my host with or without the PR (no virtual gamepad buses here), so I cannot confirm the 26/26 -> 0 result, only that the title runs normally with WGI off.
  • No gamepad was attached here (XInputGetState 0-3 all "not connected"), so I could not check that a pad still opens and reads through XInput; that rests on your Xbox 360 check.
  • ctest -j8 --timeout 120 -E '^agc_driver_|^video_out_flip': 855 of 877 pass, 2 skipped, 20 timeouts on a host with other builds running; all 20 pass on serial reruns (conventions/tooling tests and four libkernel tests), none touches this line.
  • tools/check_conventions.py --base origin/main and git diff --check: pass.

Suggestion: docs/dev/debt/libSceVideoOut.md ("Windows game controllers") already lists the DirectInput disable and its SDL_DIRECTINPUT_ENABLED=1 override; the WGI disable has the same trade-off (devices reachable only through WGI, such as Xbox One/Series trigger rumble, are not used) and could be added there with SDL_JOYSTICK_WGI=1.

Not checked: pad input over XInput on a physical pad, Windows 10, Linux/macOS (the line is Windows-only).

Written with Claude Code assistance (validation by a subagent, reviewed in this session).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6232624119 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7005#issuecomment-6232624119). Originally posted by [screamm](https://github.com/screamm) on 2026-10-17T10:05:47Z. --- Cross-validation on Windows 11 Pro 26220, NVIDIA RTX 4070 (596.21), MinGW GCC 15.2, PR head `9c5920b9f`, built together with #6956 (disjoint files) on main `5f61879a9` (clean merge). Before-runs used a build of `3b10c7ef0`; the SDL/VideoOut/Pthread/Time sources are identical between the two. - Full build and `libs`: pass. - `pad_input`, `guest_pad`, `guest_pad_vibration_mode`, `pad_sdl`, `pad_input_mapping`, `pad_keyboard_mouse`, `--repeat until-fail:3`: 3 of 3 pass each (run twice, once on a busy host). - EVO Player PPSA99039, relinked, 60 s per run, no stop line in any run. Checking the process modules every 3 s: on `main`, `Windows.Gaming.Input.dll` is loaded 22 s and 33 s into the two runs with a complete sample (two earlier runs: by 20 s and by 50 s), together with `xinput1_4.dll`. With this PR it is never loaded in the two complete runs (62 s and 57 s; `xinput1_4.dll` is loaded at 27 s and 32 s), and with `SDL_JOYSTICK_WGI=1` set on the PR build it is loaded again (26.6 s). So the hint takes effect and the environment variable turns it back on, as the description says. - Your fault (`Windows.Gaming.Input.dll+0x10a84`) does not occur on my host with or without the PR (no virtual gamepad buses here), so I cannot confirm the 26/26 -> 0 result, only that the title runs normally with WGI off. - No gamepad was attached here (`XInputGetState` 0-3 all "not connected"), so I could not check that a pad still opens and reads through XInput; that rests on your Xbox 360 check. - `ctest -j8 --timeout 120 -E '^agc_driver_|^video_out_flip'`: 855 of 877 pass, 2 skipped, 20 timeouts on a host with other builds running; all 20 pass on serial reruns (conventions/tooling tests and four libkernel tests), none touches this line. - `tools/check_conventions.py --base origin/main` and `git diff --check`: pass. Suggestion: `docs/dev/debt/libSceVideoOut.md` ("Windows game controllers") already lists the DirectInput disable and its `SDL_DIRECTINPUT_ENABLED=1` override; the WGI disable has the same trade-off (devices reachable only through WGI, such as Xbox One/Series trigger rumble, are not used) and could be added there with `SDL_JOYSTICK_WGI=1`. Not checked: pad input over XInput on a physical pad, Windows 10, Linux/macOS (the line is Windows-only). Written with Claude Code assistance (validation by a subagent, reviewed in this session).
cadenasynyster commented 2026-10-17 19:44:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by cadenasynyster on 2026-10-17T19:44:07Z.


DualSense check, since the PR was tested only with a wired Xbox 360 controller:

Windows 11 10.0.26200.9711, RTX 5070 Ti (NVIDIA 617.42), WinLibs GCC 15.2.0 r7, Release. DualSense over Bluetooth, no Steam/DS4Windows running. Head c2f466de5 merged onto main f3263dfbf (clean merge, no new build errors).

Controller detection, from video_out_flip_tests with a real window, same run on both:

main: Pad: connected game controller: DualSense Wireless Controller (type 7, sensors accel=1 gyro=1, touchpads=1, led=1, trigger rumble=0)
PR:   Pad: connected game controller: DualSense Wireless Controller (type 7, sensors accel=1 gyro=1, touchpads=1, led=1, trigger rumble=0)

So with WGI off, the Bluetooth DualSense is still opened as a game controller with motion sensors, touchpad and LED, as the commit message expects. guest_pad, guest_pad_vibration_mode and pad_sdl pass with the PR.

Not checked: button and stick input in a title, rumble, a wired DualSense, and the WGI crash itself (this host doesn't reproduce it on main).

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6239844270 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7005#issuecomment-6239844270). Originally posted by [cadenasynyster](https://github.com/cadenasynyster) on 2026-10-17T19:44:07Z. --- DualSense check, since the PR was tested only with a wired Xbox 360 controller: Windows 11 10.0.26200.9711, RTX 5070 Ti (NVIDIA 617.42), WinLibs GCC 15.2.0 r7, Release. DualSense over **Bluetooth**, no Steam/DS4Windows running. Head c2f466de5 merged onto main f3263dfbf (clean merge, no new build errors). Controller detection, from `video_out_flip_tests` with a real window, same run on both: ``` main: Pad: connected game controller: DualSense Wireless Controller (type 7, sensors accel=1 gyro=1, touchpads=1, led=1, trigger rumble=0) PR: Pad: connected game controller: DualSense Wireless Controller (type 7, sensors accel=1 gyro=1, touchpads=1, led=1, trigger rumble=0) ``` So with WGI off, the Bluetooth DualSense is still opened as a game controller with motion sensors, touchpad and LED, as the commit message expects. guest_pad, guest_pad_vibration_mode and pad_sdl pass with the PR. Not checked: button and stick input in a title, rumble, a wired DualSense, and the WGI crash itself (this host doesn't reproduce it on main). AI-assisted: yes
oneandonlydean commented 2026-10-17 21:40:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T21:40:31Z.


@TheSovietWaffle thanks for the careful crash data, and for the cross-checks from others.

We'd rather not turn Windows.Gaming.Input off for everyone. With it off, Windows loses devices and features only WGI reaches once DirectInput is off: racing wheels, arcade and flight sticks, HID pads with no HIDAPI driver, and Xbox One/Series trigger rumble. Wheels matter for a lot of PS5 titles.

Could you flip it around so WGI stays on by default and an environment variable turns it off for hosts that hit the Windows.Gaming.Input.dll+0x10a84 fault? Please name it in our existing APS5_* style, for example APS5_NO_WGI, following the APS5_NO_* switches, and only set SDL_HINT_JOYSTICK_WGI to 0 in VideoOutDriver when it's set.

Then please update the Windows game controllers entry in docs/dev/debt/libSceVideoOut.md to describe the opt-out: what it fixes, what it drops (name wheels, arcade sticks and flight sticks there), and the host setup where you saw the fault.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6241583427 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7005#issuecomment-6241583427). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-17T21:40:31Z. --- @TheSovietWaffle thanks for the careful crash data, and for the cross-checks from others. We'd rather not turn Windows.Gaming.Input off for everyone. With it off, Windows loses devices and features only WGI reaches once DirectInput is off: racing wheels, arcade and flight sticks, HID pads with no HIDAPI driver, and Xbox One/Series trigger rumble. Wheels matter for a lot of PS5 titles. Could you flip it around so WGI stays on by default and an environment variable turns it off for hosts that hit the `Windows.Gaming.Input.dll+0x10a84` fault? Please name it in our existing `APS5_*` style, for example `APS5_NO_WGI`, following the `APS5_NO_*` switches, and only set `SDL_HINT_JOYSTICK_WGI` to `0` in `VideoOutDriver` when it's set. Then please update the Windows game controllers entry in `docs/dev/debt/libSceVideoOut.md` to describe the opt-out: what it fixes, what it drops (name wheels, arcade sticks and flight sticks there), and the host setup where you saw the fault.
TheSovietWaffle commented 2026-10-19 18:23:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TheSovietWaffle on 2026-10-19T18:23:47Z.


@oneandonlydean done in a55dc4c53: Windows.Gaming.Input stays on by default, and SDL_HINT_JOYSTICK_WGI is set to 0 only when APS5_NO_WGI is set. The Windows game controllers debt entry now describes the opt-out, what it drops (racing wheels, arcade and flight sticks, HID pads without an HIDAPI driver, Xbox One/Series trigger rumble) and the host where I saw the fault. On that host EVO Player faults 3 of 3 runs by default and 0 of 3 with APS5_NO_WGI=1; the pad tests pass. Title and description are updated to match.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6274233665 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7005#issuecomment-6274233665). Originally posted by [TheSovietWaffle](https://github.com/TheSovietWaffle) on 2026-10-19T18:23:47Z. --- @oneandonlydean done in `a55dc4c53`: Windows.Gaming.Input stays on by default, and `SDL_HINT_JOYSTICK_WGI` is set to `0` only when `APS5_NO_WGI` is set. The Windows game controllers debt entry now describes the opt-out, what it drops (racing wheels, arcade and flight sticks, HID pads without an HIDAPI driver, Xbox One/Series trigger rumble) and the host where I saw the fault. On that host EVO Player faults 3 of 3 runs by default and 0 of 3 with `APS5_NO_WGI=1`; the pad tests pass. Title and description are updated to match. AI-assisted: yes (Claude Code).
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!7005
No description provided.