Repository navigation
Conversation
On Windows OnMainThread runs its function on the calling thread, so the video driver's constructor initialised the game controller subsystem on whichever guest thread first used video output, while the present thread creates the window and pumps the events. SDL creates its HIDAPI device-notification window on the thread that initialises the joystick subsystem and only sees arrivals when that thread pumps messages, so a DualSense or DualShock plugged in after the game started was never opened: the controller only worked when it was connected before launch. PadInput now takes its own reference on SDL_INIT_GAMECONTROLLER where it is constructed, on the thread that pumps the events, and releases it when destroyed; the driver only initialises the video subsystem. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Ran the VideoOut and pad tests on Linux with a Wayland display, the Khronos validation layer and an NVIDIA GPU; CI skips Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release,
This machine has two controllers attached, so
With the joysticks hidden, No new AI-assisted: yes (Claude Code) |
|
Thanks @domx4q. The joystick-hidden bwrap run is exactly what was needed — it exercises the new subsystem-lifetime checks (up while the worker-thread PadInput lives, down after it, up while the shared one remains) and they pass on Ada with no new VUIDs. The fullscreen failure is the known pre-existing tiling-compositor one, so that's fine. Hotplug being untested is okay here; this change is the startup thread, not the hotplug path. |
|
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.
|
|
Tested head Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release,
Whole batch: the full This is one combined tree, not a run of this PR alone. AI-assisted: yes (Claude Code) |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The change moves game controller subsystem ownership to PadInput on the event-pumping thread, and the inspected construction and teardown paths support that behavior.
What I ran
Reviewed head 48b7a61e3ec7b4b61728c0297c4cb551e228e428 using the prepared diff and pinned reader. No tests or build commands were run; reported test results below are author supplied.
Results
| Check | Result | Note |
|---|---|---|
| Changed code review | passed | All four changed files read |
| Author reported checks | not run | Windows input tests reported in PR description |
| Local tests and build | not run | No commands run |
Findings
Blocking
None.
Non-blocking
None.
Not verified
The PR description reports Windows 11 testing and specific input tests, but these were not run during this review. No Vulkan window or game run was verified. files.json was unavailable through the reader; the manifest lists four changed files, all marked included, and all four were read: PadInput.hpp, PadInput.cpp, VideoOutDriver.cpp, and PadSdl.cpp. No files were excluded per the supplied manifest.
To get this to a good state
Nothing is required.
What
On Windows a DualSense (or any controller) plugged in after the game started was never connected; it only worked when it was plugged in before launch.
OnMainThreadruns its function inline on Windows, soVideoOutDriver's constructor initialisedSDL_INIT_GAMECONTROLLERon whichever guest thread first used video output, while the present thread creates the window and pumps the events. SDL creates its HIDAPI device-notification window on the thread that initialises the joystick subsystem, and that window only receivesWM_DEVICECHANGEwhen its thread pumps messages. The guest thread never does, so SDL never rescans and noSDL_CONTROLLERDEVICEADDEDarrives.PadInputnow takes its own reference onSDL_INIT_GAMECONTROLLERwhere it is constructed (the present thread, insidepresentLoop) and drops it in its destructor; the driver only initialises and quitsSDL_INIT_VIDEO. Linux and macOS behave as before (udev does not depend on the thread; on macOS both already ran on the main thread).Tested
Windows 11, MinGW GCC 15.2.0, USB DualSense.
SDL_PollEventon another. Restarting the DualSense's HID device (pnputil /restart-device, the same as unplugging and plugging it) givesremovedand then nothing,SDL_NumJoysticks() == 0at the end. With the game controller subsystem initialised on the pumping thread the same restart givesremoved,added 0, one joystick at the end.Pad: connected game controllerline and ignored the controller; at least 15 other games started with it already plugged in connected it.pad_sdlchecks thatPadInputconstructed on a worker thread starts the game controller subsystem and stops it when destroyed, and that a reference taken elsewhere survives aPadInput. Without thePadInputchange the test aborts (exit 0xc0000409); with itpad_sdl,pad_keyboard_mouseandmouse_inputpass.pad_sdlran withSDL_JOYSTICK_HIDAPI=0 SDL_JOYSTICK_RAWINPUT=0 SDL_XINPUT_ENABLED=0 SDL_JOYSTICK_WGI=0 SDL_DIRECTINPUT_ENABLED=0so the plugged-in controller did not make it skip.ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationthe log has noVUID-lines. The window and flip tests were not run because they open a window on a machine in use.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code