gameinput: publish the console GameInputDeviceInfo layout #528

Merged
csj0oe merged 1 commit from upstream-pr/528 into main 2026-11-29 21:51:41 +00:00
csj0oe commented 2026-11-29 20:09:53 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by csj0oe on 2026-11-29T20:09:53Z.


What

The console GameInputDeviceInfo is 320 bytes, not the desktop 328: a provider built against the desktop record leaves an 8-byte overrun, and the first pointer field sits at offset 160 (inputReportInfo).

  • runtime/gameinput/console_abi.h is our own declaration: the 320-byte info record with every field offset pinned, the state and reading records, the enums, the callback signatures and the three interface tables. The C view a guest calls and the table the provider fills are generated from one slot list, so a slot cannot move in one view without the other.
  • The provider, the control guest, Lanes input and the input tools include it; build.py passes the in-tree include directory. python build.py and python build.py lanes therefore build on a bare checkout with no environment variables.
  • tests/test_gameinput_abi.py checks the build wiring and dumps the record layout to confirm the declaration yields 320 bytes at the documented offsets.

Verification

  • Bare tree, rm -rf build: python build.py and python build.py all exit 0; build/gameinput/GameInput.dll sha256 890b715b002d064c6351b11059daf5a66c5ff75bf0d951078ff0f0d8adec46d8.
  • Under Proton GE the provider reports header_size=320 infoSize=320 overrun=0; the pre-change provider reported 328 and overrun=8.
  • python tuxbox.py check --no-gpu passes; clang-cl /W4 /WX is clean.
<!-- greyfinch-sync:brcly/TuxBox:issue:5554630771 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/528). Originally posted by [csj0oe](https://github.com/csj0oe) on 2026-11-29T20:09:53Z. --- ## What The console `GameInputDeviceInfo` is 320 bytes, not the desktop 328: a provider built against the desktop record leaves an 8-byte overrun, and the first pointer field sits at offset 160 (`inputReportInfo`). - `runtime/gameinput/console_abi.h` is our own declaration: the 320-byte info record with every field offset pinned, the state and reading records, the enums, the callback signatures and the three interface tables. The C view a guest calls and the table the provider fills are generated from one slot list, so a slot cannot move in one view without the other. - The provider, the control guest, Lanes input and the input tools include it; `build.py` passes the in-tree include directory. `python build.py` and `python build.py lanes` therefore build on a bare checkout with no environment variables. - `tests/test_gameinput_abi.py` checks the build wiring and dumps the record layout to confirm the declaration yields 320 bytes at the documented offsets. ## Verification - Bare tree, `rm -rf build`: `python build.py` and `python build.py all` exit 0; `build/gameinput/GameInput.dll` sha256 `890b715b002d064c6351b11059daf5a66c5ff75bf0d951078ff0f0d8adec46d8`. - Under Proton GE the provider reports `header_size=320 infoSize=320 overrun=0`; the pre-change provider reported 328 and `overrun=8`. - `python tuxbox.py check --no-gpu` passes; `clang-cl /W4 /WX` is clean.
brcly commented 2026-11-29 20:37:55 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-29T20:37:55Z.


Thanks. The 320-byte infoSize fix is right, and the offset checks are useful. But we can't make the build depend on the console reference:

  • With this PR, python build.py and python build.py lanes stop unless TUXBOX_CONSOLE_ROOT points at a GDK installation. Most contributors and CI don't have one, so GameInput would never be built or checked there, and Lanes would stop building for them.
  • The GDK headers are licensed per developer, and our rule is to keep the build and the repository independent of them (see AGENTS.md).

Could you instead define the console GameInputDeviceInfo layout in our own code (our own struct with the 320-byte layout, written from the documented fields, not copied from the header) and keep compiling against the desktop header? The offsetof checks against the real header can stay as an optional check that runs only when TUXBOX_CONSOLE_ROOT is set and skips otherwise, like #510's layout check.

<!-- greyfinch-sync:brcly/TuxBox:comment:7262234840 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/528#issuecomment-7262234840). Originally posted by [brcly](https://github.com/brcly) on 2026-11-29T20:37:55Z. --- Thanks. The 320-byte `infoSize` fix is right, and the offset checks are useful. But we can't make the build depend on the console reference: - With this PR, `python build.py` and `python build.py lanes` stop unless `TUXBOX_CONSOLE_ROOT` points at a GDK installation. Most contributors and CI don't have one, so GameInput would never be built or checked there, and Lanes would stop building for them. - The GDK headers are licensed per developer, and our rule is to keep the build and the repository independent of them (see AGENTS.md). Could you instead define the console `GameInputDeviceInfo` layout in our own code (our own struct with the 320-byte layout, written from the documented fields, not copied from the header) and keep compiling against the desktop header? The `offsetof` checks against the real header can stay as an **optional** check that runs only when `TUXBOX_CONSOLE_ROOT` is set and skips otherwise, like #510's layout check.
brcly commented 2026-11-29 21:11:46 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-29T21:11:46Z.


Thanks, this addresses what I raised. It conflicts with main now (after tonight's merges); could you rebase it? Then we'll run it through the check and merge.

<!-- greyfinch-sync:brcly/TuxBox:comment:7262681114 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/528#issuecomment-7262681114). Originally posted by [brcly](https://github.com/brcly) on 2026-11-29T21:11:46Z. --- Thanks, this addresses what I raised. It conflicts with `main` now (after tonight's merges); could you rebase it? Then we'll run it through the check and merge.
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
brcly/TuxBox!528
No description provided.