Skip to content

gameinput: give every aggregate kind its own device id (RT-731) - #8612

Open
shadshuvo wants to merge 1 commit into
ItsNotRexed:mainfrom
shadshuvo:rt-731-aggregate-device-id
Open

shadshuvo wants to merge 1 commit into
ItsNotRexed:mainfrom
shadshuvo:rt-731-aggregate-device-id

Conversation

@shadshuvo

Copy link
Copy Markdown

CreateAggregateDevice kept only kind bits 0-15 in deviceId.value[28..29], so gamepad (0x40000), arcade stick (0x10000), flight stick (0x20000) and racing wheel (0x80000) all wrote zero there and FindDeviceFromId answered the first of them. Keep all 32 kind bits in bytes 28..31.

gameinput_test now creates an aggregate for every supported kind, checks the ids are distinct and that FindDeviceFromId returns each one.

Claimed in the coordination issue as:

Depends on:

What and why

Tested

AI-assisted:

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.

CreateAggregateDevice kept only kind bits 0-15 in deviceId.value[28..29], so gamepad (0x40000), arcade stick (0x10000), flight stick (0x20000) and racing wheel (0x80000) all wrote zero there and FindDeviceFromId answered the first of them. Keep all 32 kind bits in bytes 28..31.

gameinput_test now creates an aggregate for every supported kind, checks the ids are distinct and that FindDeviceFromId returns each one.
@TillusStark26

Copy link
Copy Markdown

Tested commit d7fb826ec635ee5f25bea4fbdbb11411da43c515 on native Windows 11 x64 (MSVC 19.44.35230.0, Windows SDK 10.0.26100.0, SDL3 3.4.20, Ninja Release build, NVIDIA GeForce RTX 3050 8 GB, driver 591.86). Synthetic test only, zero game data.

Build & Test Verification

  • cmake --build build --target gameinput_test -j 6 -> built cleanly with /W4 /permissive- /utf-8 (0 warnings).
  • gameinput_test.exe -> 344 checks, 0 failures (exit code 0), including the new test_aggregate_device checks:
    • PASS aggregate device: one device per supported kind
    • PASS aggregate device: every supported kind has a distinct device id
    • PASS aggregate device: FindDeviceFromId returns each kind's aggregate
  • Negative control check: before this change, agg->info.deviceId.value[28..29] only stored bits 0..15 of kind, causing GameInputKindArcadeStick (0x10000), GameInputKindFlightStick (0x20000), GameInputKindGamepad (0x40000), and GameInputKindRacingWheel (0x80000) to all encode 0 in bytes 28..31 and collide in FindDeviceFromId. Writing all 4 bytes (28 + i for i in 0..3) fits within the 32-byte AppLocalDeviceId after the 27-byte prefix + NUL byte (0..27).
  • python -I scripts/check_no_game_data.py runtime/shims/gameinput.cpp runtime/test/gameinput_test.cpp -> clean (exit code 0).

Minor PR Metadata Note

  • The PR description still has the unfilled template placeholders (Claimed in the coordination issue as:, ### What and why, ### Tested, AI-assisted:) below the summary paragraph — please fill those in for the merge checklist.

AI-assisted.

@KoertLichtendonk

Copy link
Copy Markdown
Contributor

Coordinator note: RT-731 already has an open PR, #8246 by @x3ero0 (opened 18:18 UTC), so this looks like a duplicate. Please compare the two and either close this one or say here what it adds. The maintainer decides which one is merged.

@itsonlysimbo

Copy link
Copy Markdown
Contributor

Tested d7fb826e merged onto main 867d922f (merges cleanly) on RTX 4070, NVIDIA 621.14, Windows 11 (10.0.26300), MSVC 19.44, Ninja, RelWithDebInfo, Vulkan SDK 1.4.363, SDL3 3.4.20: pass.

AI-assisted (Claude Code).

@haayden

haayden commented Nov 23, 2026

Copy link
Copy Markdown

Thanks for this fix. It looks like the same change as #8246, which was opened earlier (18:18 UTC). Both PRs write all four bytes of the kind into the aggregate device id in CreateAggregateDevice and add the same check that each kind gets its own id. #8246 is MERGEABLE and has an independent pass on its current head: #8246 (comment)

If you agree, could you close this one in favour of #8246? If I've missed something only this PR covers, please say so in the PR cleanup issue.

PR cleanup issue: #8919 (comment)

agent: yes

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants