runtime: report the GameInput virtual pad as GameInputFamilyXboxOne #2539

Manually merged
github merged 2 commits from gh-pr/2539/head into gh-pr/2539/base 2026-11-27 01:00:28 +00:00
Owner

@⁠Asimmimx on GitHub · 2026-11-25 20:18 UTC · original
Asimmimx:runtime/gameinput-xbox-one-family → main · +17 −1 · 2 files · 2 commits · merged 2026-11-25 20:32 UTC

Summary

The virtual gamepad's GameInputDeviceInfo now carries deviceFamily = 1 (GameInputFamilyXboxOne) instead of 2 (GameInputFamilyXbox360). This matches its vendor/product 045E:0B12, a GIP device, and the existing "family: Xbox One" comment. The keyboard device info is unchanged.

Fixes #2538

Tests

startup_gameinput_contracts_check now reads the gamepad's device info through FindDeviceFromObject and expects vendor 045E, product 0B12 and deviceFamily 1.

Windows 11 26300, dev preset:

cmake --build --preset dev --target startup_stub_gameinput startup_gameinput_contracts_check startup_gameinput_keys startup_gameinput_history startup_gameinput_script startup_gameinput_script_syntax
ctest --preset dev --no-tests=error -j 1 -R '^startup_gameinput'

6 of 6 passed (keys, history, script_long, script_entries, contracts_check, script_syntax).

Fail-first

With gameinput.cpp reverted and the new check kept:

gamepad deviceFamily 2, expected 1
FAIL: gamepad GetDeviceInfo deviceFamily == GameInputFamilyXboxOne
startup_gameinput_contracts_check: 1 failure(s)

Open

  • The keyboard device keeps family 0; a desktop keyboard would report Hid (3) or I8042 (4). Left as is.
  • In sample(), a full XInput deflection of -32768 converts to -1.0000305, just outside GameInput's documented [-1, 1] range. That is a separate one-line follow-up.
  • No title behaviour was measured.

AI-assisted (Claude Code).

**@⁠Asimmimx** on GitHub · 2026-11-25 20:18 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2539) `Asimmimx:runtime/gameinput-xbox-one-family` → `main` · +17 −1 · 2 files · 2 commits · merged 2026-11-25 20:32 UTC ## Summary The virtual gamepad's `GameInputDeviceInfo` now carries `deviceFamily = 1` (`GameInputFamilyXboxOne`) instead of 2 (`GameInputFamilyXbox360`). This matches its vendor/product `045E:0B12`, a GIP device, and the existing "family: Xbox One" comment. The keyboard device info is unchanged. Fixes #2538 ## Tests `startup_gameinput_contracts_check` now reads the gamepad's device info through `FindDeviceFromObject` and expects vendor `045E`, product `0B12` and `deviceFamily` 1. Windows 11 26300, dev preset: ``` cmake --build --preset dev --target startup_stub_gameinput startup_gameinput_contracts_check startup_gameinput_keys startup_gameinput_history startup_gameinput_script startup_gameinput_script_syntax ctest --preset dev --no-tests=error -j 1 -R '^startup_gameinput' ``` 6 of 6 passed (`keys`, `history`, `script_long`, `script_entries`, `contracts_check`, `script_syntax`). ## Fail-first With `gameinput.cpp` reverted and the new check kept: ``` gamepad deviceFamily 2, expected 1 FAIL: gamepad GetDeviceInfo deviceFamily == GameInputFamilyXboxOne startup_gameinput_contracts_check: 1 failure(s) ``` ## Open - The keyboard device keeps family 0; a desktop keyboard would report `Hid` (3) or `I8042` (4). Left as is. - In `sample()`, a full XInput deflection of -32768 converts to -1.0000305, just outside GameInput's documented [-1, 1] range. That is a separate one-line follow-up. - No title behaviour was measured. AI-assisted (Claude Code).
The GameInput stand-in's GameInputDeviceInfo put 2 in deviceFamily (+0x60), commented as
"Xbox One". In GameInputDeviceFamily 2 is GameInputFamilyXbox360 (the XUSB22 driver);
GameInputFamilyXboxOne (XboxGIP / XInputHID) is 1. The same info names vendor 045E product
0B12, an Xbox Series pad, which is a GIP device. A title that branches on the family saw an
Xbox 360 controller.

Test: startup_gameinput_contracts_check reads the gamepad's device info through
FindDeviceFromObject and expects vendor 045E, product 0B12 and deviceFamily 1. On the
unfixed stand-in it fails with "gamepad deviceFamily 2, expected 1".
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:00:27 +00:00
github manually merged commit 34a582accb into gh-pr/2539/base 2026-11-27 01:00:28 +00:00
Author
Owner

@⁠ChazY11 on GitHub · 2026-11-25 20:23 UTC · original

Built and run here: 6/6 pass; the family value this PR changes is caught, and the two sibling fields in the same literal are not

ctest --preset dev -R 'startup_gameinput'
    1/6 startup_gameinput_keys ..............  Passed
    2/6 startup_gameinput_history ...........  Passed
    3/6 startup_gameinput_script_long .......  Passed
    4/6 startup_gameinput_script_entries ....  Passed
    5/6 startup_gameinput_contracts_check ...  Passed
    6/6 startup_gameinput_script_syntax .....  Passed
    100% tests passed, 0 tests failed out of 6

Reproduction notes, because I got both wrong before the run above:

  • five of the six report Not Run until startup_stub_gameinput and startup_gameinput_script are built. The
    target is startup_gameinput_script — there is no startup_gameinput_script_long / _entries target; those are
    modes (GameInput.dll long, GameInput.dll entries) of the one executable.
  • ctest -N -V prints their command before that as "D:/…/GameInput.dll" "long", which reads as a broken command
    but is only the unresolved first element.

Three mutations of the descriptor tail

mutation result
family_xbox_one 1 → 2 (Xbox360) caught
the rumble byte 0xF → 0x0 survived
kind_gamepad | kind_controller_bits → kind_gamepad survived

The caught one is the whole point of the change, so the rename to a named constant did bring an assertion with it: the
fixture must be reading the family out of the descriptor, not just checking that a device enumerates.

The two survivors are the other two fields of the same array

const std::uint32_t tail[4] = {family_xbox_one, 0, kind_gamepad | kind_controller_bits, 0xF /* rumble … */, …};

0xF is the rumble capability mask and kind_controller_bits (0xE) decides which kinds wants_gamepad() accepts:

bool wants_gamepad(std::uint32_t kind) { return (kind & (kind_gamepad | kind_controller_bits)) != 0; }

Dropping the controller bits leaves kind_gamepad (0x40000) set, so wants_gamepad still returns true — the change is
invisible to anything that only asks that question. It would show up in a title that filters on the controller sub-kind
specifically, and in a rumble query for the 0xF byte.

I am not claiming either is wrong; the descriptor looks right. The point is that this PR touches a four-word literal and
only one of the four words is now constrained. Two one-line assertions — the kind word equals
kind_gamepad | kind_controller_bits, and the rumble byte equals 0xF — would fix that, and they belong in the same
contracts check that already reads the family.

Environment

Windows 11 build 26300.9974; targets startup_stub_gameinput, startup_gameinput_keys, startup_gameinput_history,
startup_gameinput_script, startup_gameinput_script_syntax, startup_gameinput_contracts_check built individually.
Each mutation was rebuilt and re-run, then reverted and rebuilt; final state 6/6 green.

AI-assisted.

**@⁠ChazY11** on GitHub · 2026-11-25 20:23 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2539#issuecomment-7173612776) ## Built and run here: 6/6 pass; the family value this PR changes is caught, and the two sibling fields in the same literal are not ```text ctest --preset dev -R 'startup_gameinput' 1/6 startup_gameinput_keys .............. Passed 2/6 startup_gameinput_history ........... Passed 3/6 startup_gameinput_script_long ....... Passed 4/6 startup_gameinput_script_entries .... Passed 5/6 startup_gameinput_contracts_check ... Passed 6/6 startup_gameinput_script_syntax ..... Passed 100% tests passed, 0 tests failed out of 6 ``` Reproduction notes, because I got both wrong before the run above: - five of the six report `Not Run` until **`startup_stub_gameinput` and `startup_gameinput_script`** are built. The target is `startup_gameinput_script` — there is no `startup_gameinput_script_long` / `_entries` target; those are *modes* (`GameInput.dll long`, `GameInput.dll entries`) of the one executable. - `ctest -N -V` prints their command before that as ` "D:/…/GameInput.dll" "long"`, which reads as a broken command but is only the unresolved first element. ## Three mutations of the descriptor tail | mutation | result | |---|---| | `family_xbox_one` 1 → 2 (Xbox360) | **caught** | | the rumble byte `0xF` → `0x0` | survived | | `kind_gamepad \| kind_controller_bits` → `kind_gamepad` | survived | The caught one is the whole point of the change, so the rename to a named constant did bring an assertion with it: the fixture must be reading the family out of the descriptor, not just checking that a device enumerates. ## The two survivors are the other two fields of the same array ```cpp const std::uint32_t tail[4] = {family_xbox_one, 0, kind_gamepad | kind_controller_bits, 0xF /* rumble … */, …}; ``` `0xF` is the rumble capability mask and `kind_controller_bits` (`0xE`) decides which kinds `wants_gamepad()` accepts: ```cpp bool wants_gamepad(std::uint32_t kind) { return (kind & (kind_gamepad | kind_controller_bits)) != 0; } ``` Dropping the controller bits leaves `kind_gamepad` (`0x40000`) set, so `wants_gamepad` still returns true — the change is invisible to anything that only asks that question. It would show up in a title that filters on the controller sub-kind specifically, and in a rumble query for the `0xF` byte. I am not claiming either is wrong; the descriptor looks right. The point is that this PR touches a four-word literal and only one of the four words is now constrained. Two one-line assertions — the kind word equals `kind_gamepad | kind_controller_bits`, and the rumble byte equals `0xF` — would fix that, and they belong in the same contracts check that already reads the family. ## Environment Windows 11 build 26300.9974; targets `startup_stub_gameinput`, `startup_gameinput_keys`, `startup_gameinput_history`, `startup_gameinput_script`, `startup_gameinput_script_syntax`, `startup_gameinput_contracts_check` built individually. Each mutation was rebuilt and re-run, then reverted and rebuilt; final state 6/6 green. AI-assisted.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 20:27 UTC · original · reviewed

Review of head 8b16598e (comment only).

Looks sound. The gamepad GameInputDeviceInfo family becomes 1 (GameInputFamilyXboxOne), matching the 045E:0B12 GIP ids; the enum values in the new comment (Virtual -1, XboxOne 1, Xbox360 2, Hid 3, I8042 4) are consistent with the public GameInput header. The keyboard info is untouched. The new check reads vendor, product and family at the documented offsets (+4, +6, +0x60) through FindDeviceFromObject, so it guards the caller-visible value. The PR makes no startup claim and measures no title behaviour, so no game verification is implied.

Commands run locally on a worktree of the head:

  • git diff --check origin/main...HEAD -> clean
  • python3 tests/docs_links_check.py -> passed
  • python3 tests/bidi_controls_check.py -> passed
  • No other open or merged PR covers this slice (search "GameInput family XboxOne").
  • The C++ build and the fail-first run happen on Win2025 (next step on my side); I report them separately.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-25 20:27 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2539#pullrequestreview-6064483026) · **reviewed** Review of head 8b16598e (comment only). Looks sound. The gamepad `GameInputDeviceInfo` family becomes 1 (`GameInputFamilyXboxOne`), matching the 045E:0B12 GIP ids; the enum values in the new comment (Virtual -1, XboxOne 1, Xbox360 2, Hid 3, I8042 4) are consistent with the public GameInput header. The keyboard info is untouched. The new check reads vendor, product and family at the documented offsets (+4, +6, +0x60) through `FindDeviceFromObject`, so it guards the caller-visible value. The PR makes no startup claim and measures no title behaviour, so no game verification is implied. Commands run locally on a worktree of the head: - `git diff --check origin/main...HEAD` -> clean - `python3 tests/docs_links_check.py` -> passed - `python3 tests/bidi_controls_check.py` -> passed - No other open or merged PR covers this slice (search "GameInput family XboxOne"). - The C++ build and the fail-first run happen on Win2025 (next step on my side); I report them separately. AI-assisted; commands listed were executed locally.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 20:31 UTC · original

Win2025 WARP receipt for head 34a582ac after updating with main.

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit 34a582accbb57c307bcea8c4ebec7270e54066e2:

  • Debug (--preset dev): ctest --preset dev -R '^startup_gameinput' --parallel 2 --no-tests=error --output-on-failure: 6/6 passed (includes startup_gameinput_contracts_check)
  • Release /O2 (--preset release): same command: 6/6 passed
  • Fixture tests only; no title or game behaviour was run.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-25 20:31 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2539#issuecomment-7173809473) Win2025 WARP receipt for head 34a582ac after updating with main. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `34a582accbb57c307bcea8c4ebec7270e54066e2`: - **Debug (`--preset dev`)**: `ctest --preset dev -R '^startup_gameinput' --parallel 2 --no-tests=error --output-on-failure`: **6/6 passed** (includes `startup_gameinput_contracts_check`) - **Release `/O2` (`--preset release`)**: same command: **6/6 passed** - Fixture tests only; no title or game behaviour was run. AI-assisted; commands listed were executed locally.
This discussion has been locked. Commenting is limited to contributors.
No description provided.