Skip to content

fix(test-backend)!: report the test rumble counts in size_t - #490

Merged
siracozmen01 merged 1 commit into
mainfrom
test-rumble-count
Nov 5, 2026
Merged

siracozmen01 merged 1 commit into
mainfrom
test-rumble-count

Conversation

@siracozmen01

Copy link
Copy Markdown
Contributor

Problem

mwinGamepad_GetTestRumble and mwinGamepad_GetTestTriggerRumble in include/maul-window/test.h report how many rumbles a gamepad of the test platform was given in a uint32_t* countOut. #376 made every count the API reports a size_t, and a count of calls is a count too.

Change

  • Both functions take size_t* countOut.
  • The test backend keeps the count as a size_t.
  • test/test_gamepad.c reads the count into a size_t.
  • test/test_outputs.c checks that a refused call clears the count, now apart from the other three outputs. It fills and checks those as one struct with no padding, and a size_t beside three 32-bit values leaves padding on a 64-bit build.

Verification

  • Built with no errors or warnings: the gcc-14 tree, the clang-20 ASan, minimal and fuzz trees, MinGW, wasm32-wasi and Android.
  • tools/check.sh changed passes, the gamepad and outputs suites included.
  • With the count's clear taken out of the test backend's GetRumble, outputs fails on both counts, for a call with no context and for a gamepad that is gone.

BREAKING CHANGE: mwinGamepad_GetTestRumble and mwinGamepad_GetTestTriggerRumble take size_t* countOut instead of uint32_t* countOut.
Closes #488

@siracozmen01 siracozmen01 added the bug Something does not work as documented label Nov 5, 2026

@siracozmen01 siracozmen01 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review at 30b26e2: ready, with one point not verified. No findings. Read, not run.

  • The clear-on-failure contract covers the wider type by construction. GetRumble clears with mwinClearOut(countOut, sizeof *countOut) (backend_test_pads.c:141), so the clear widens with the pointer's type to all 8 bytes on 64-bit, before any refusal. The stored mwinTestRumble.count is size_t too. *countOut = rumble->count and the rumble->count + 1 in backend_test.c:465 and 473 neither truncate nor change behavior. On 32-bit builds size_t is the same 32 bits as before.
  • The test change is right. Rumble drops the count so the struct's static_assert of no padding still holds (3 × 4 bytes). The count is filled with the pattern and checked on its own after each call, under the same status as the other outputs. With the clear removed, the 8-byte count keeps the pattern on a refused call. That is the failure the body reports.
  • test.h, the backend and test_gamepad.c take and pass size_t*, and the BREAKING CHANGE footer names both functions. That fits #371's ruling that a count is size_t.

Not verified: callers outside the five files. Any C caller still passing uint32_t* is an incompatible pointer type, which the warning-as-error builds would refuse. So the clean gcc-14, ASan, minimal, fuzz, MinGW, wasm32-wasi and Android builds cover everything those trees compile. Not covered are samples outside the build, the docs, and any JS or Java test hook that reaches these through a raw 4-byte slot. On wasm32 size_t is 4 bytes, so a JS slot stays right there. A search for GetTestRumble and GetTestTriggerRumble across the repository would settle it.

@siracozmen01
siracozmen01 merged commit 8d02e25 into main Nov 5, 2026
44 checks passed
@siracozmen01
siracozmen01 deleted the test-rumble-count branch November 5, 2026 12:52
@rawframe-release rawframe-release Bot mentioned this pull request Nov 5, 2026
siracozmen01 pushed a commit that referenced this pull request Nov 5, 2026
🤖 I have created a release *beep* *boop*
---


## [0.15.0](v0.14.0...v0.15.0) (2026-11-05)

The iOS device check, that a window shows no flash against the launch
screen before its first frame, is waived by the owner for this
release, which ships on the iOS simulator suite: its iOS changes leave
the launch and the first frame alone.

### Changed

- **Breaking:** `mwinMessageButtons` is now `mwinMessageChoice`, its
  constants `mwin_buttonsOk`, `mwin_buttonsOkCancel` and
  `mwin_buttonsYesNo` are now `mwin_choiceOk`, `mwin_choiceOkCancel`
  and `mwin_choiceYesNo`, and `mwinMessageBoxDef.buttons` is now
  `mwinMessageBoxDef.choice`. The type is a choice of one, but its
  plural name read as a set of flags, as every other plural type in
  the API is
  ([#489](#489)).
- **Breaking:** the test platform's `mwinGamepad_GetTestRumble` and
  `mwinGamepad_GetTestTriggerRumble` take `size_t* countOut` instead
  of `uint32_t* countOut`, as every other count the API reports is a
  `size_t`
  ([#490](#490)).
- Maul Window builds against Maul Unicode 1.2.0, which gives the
  results 1.1.2 gave, so nothing a program gets from Maul Window
  changes. The installed CMake config and pkg-config file ask for
  Maul Unicode 1.2.0, and a build on a machine with only Maul Unicode
  1.1.2 installed fetches 1.2.0 instead of using it
  ([#493](#493)).

### Fixed

- On Windows, a generic HID gamepad with more than 64 buttons down at
  once, such as a stick or button box of 128 whose toggle switches
  stay down, reads its buttons. Before, the library asked Windows'
  parser for the buttons down with room for 64, the parser refused,
  and the report's buttons were dropped: each button kept the state of
  the last report that listed 64 or fewer, and a press or a release in
  between was lost
  ([#495](#495)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something does not work as documented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The test rumble reads report their count in uint32_t, not size_t

1 participant