Repository navigation
gameinput: GetCurrentReading with no device filters by the requested kind - #5019
tupacfan04 wants to merge 1 commit into
Conversation
The null-device branch returned the newest reading from any connected device, even when that device cannot produce the requested kind. On a plain pad, GetCurrentReading(GameInputKindMotion, nullptr) returned S_OK with a gamepad reading, while the explicit-device and aggregate branches already return GAMEINPUT_E_READING_NOT_FOUND. Skip devices whose supportedInput does not intersect the requested kind; GameInputKindUnknown still means any.
|
Independent check — pass on Windows. Environment: Windows 11, MSVC 19.44 (RelWithDebInfo, Ninja), CPU only. Built
Playability-relevant: games routinely call AI-assisted (Devin). |
|
Closing as a duplicate: #2612 already adds the same null-device \supportedInput\ filter and a \GetCurrentReading(GameInputKindMotion, nullptr) == GAMEINPUT_E_READING_NOT_FOUND\ regression. My claim missed that overlap; maintainers should not spend review time on a second implementation. The test/build evidence here (332 checks, 2 failures on main without the filter) still stands if a clean extraction is ever wanted. |
kacper-serewis
left a comment
There was a problem hiding this comment.
At 51b1a60 all 332 original checks passed. Combining the change with #4924, retaining both kind filtering and reading-order comparison, passed 337 checks. A separate virtual-device diagnostic found that before its first HID report a raw-capable pad can return S_OK for RawDeviceReport with the requested bit absent from the actual reading. This affects both null-device and explicit-device lookup. AI-assisted Windows CPU verification using SDL 3.4.20.
Claimed in the coordination issue: #4933 (comment)
Depends on: none. This shares the null-device loop with #4924 (which changes its tie-break to
Reading::order()); whichever lands second rebases. #4553 already added the analogoussupportedInputfilter for reading callbacks, and this applies the same rule toGetCurrentReading.What and why
IGameInput::GetCurrentReading(kind, nullptr, out)returned the newest reading from any connected device, even when that device cannot produce the requested kind. On a plain pad,GetCurrentReading(GameInputKindMotion, nullptr)returnedS_OKwith a gamepad reading. The explicit-device branch and the aggregate-device branch already returnGAMEINPUT_E_READING_NOT_FOUNDin that case.The null-device branch now skips devices whose
supportedInputdoes not intersect the requested kind.GameInputKindUnknownstill means any kind, as in the other branches.Tested
gameinput_test.exe: 332 checks, 0 failures (329 before the change, plus 3 new checks).origin/main3faac55 with the old shim gives 332 checks, 2 failures - the two new null-device checks. The motion positive check passes on both.ctest --test-dir runtime/build-gi -C RelWithDebInfo -R "^(gameinput|active_input)$" --repeat until-fail:5 --output-on-failure: 2/2 tests passed with 5 repeats each (10 runs).git diff --check: clean.AI-assisted: yes (OpenCode).
Checklist
docs/design.md, with how it was confirmed. (no translator change)