HLE: write at-rest gamepad state for non-pad readings #574

Open
github-bot wants to merge 1 commit from github-bot/gh-574 into main AGit
Owner

@⁠Quat3rnion on GitHub · 2026-11-24 05:10 UTC · original
Quat3rnion:victory-gameinput-callbacks → main · +30 −8 · 1 files · 1 commits · open

What

IGameInputReading::GetGamepadState must write default at-rest values and
return false when the reading has no gamepad. The shim returned false
without touching the caller's buffer, so a title reusing one PadState
could keep a held button or displaced stick after switching to keyboard
input. The state is now written in both cases; pad readings still write
their real state and return true.

An AI tool wrote part of this change.

Tested

  • Linux: cargo test --workspace: 165 passed, 0 failed, 3 ignored. A regression seeds a PadState with pressed buttons and moved sticks, calls slot 0xb0 on a keyboard reading, and asserts both false and PadState::default().
  • Windows cross-build: cargo check --target x86_64-pc-windows-gnu --workspace --tests passes. No Windows host here.
  • cargo xtask policy passes (150 files ok). No game files or data from them were added.

Checklist

  • Workspace tests and Windows cross-check pass.
  • cargo xtask policy passes. No game files or data from them were added.
  • AI authorship is disclosed above.
**@⁠Quat3rnion** on GitHub · 2026-11-24 05:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/574) `Quat3rnion:victory-gameinput-callbacks` → `main` · +30 −8 · 1 files · 1 commits · open ## What `IGameInputReading::GetGamepadState` must write default at-rest values and return `false` when the reading has no gamepad. The shim returned `false` without touching the caller's buffer, so a title reusing one `PadState` could keep a held button or displaced stick after switching to keyboard input. The state is now written in both cases; pad readings still write their real state and return `true`. An AI tool wrote part of this change. ## Tested - Linux: `cargo test --workspace`: 165 passed, 0 failed, 3 ignored. A regression seeds a `PadState` with pressed buttons and moved sticks, calls slot `0xb0` on a keyboard reading, and asserts both `false` and `PadState::default()`. - Windows cross-build: `cargo check --target x86_64-pc-windows-gnu --workspace --tests` passes. No Windows host here. - `cargo xtask policy` passes (150 files ok). No game files or data from them were added. ## Checklist - [x] Workspace tests and Windows cross-check pass. - [x] `cargo xtask policy` passes. No game files or data from them were added. - [x] AI authorship is disclosed above.
GameInput's GetGamepadState writes default at-rest values and returns false when the reading has no gamepad. The shim returned false without touching the caller's buffer, so a title reusing its PadState could keep a held button or moved stick after switching to keyboard input. Write the state in both cases. Add a regression with a seeded PadState on a keyboard reading.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:08:55 +00:00
Author
Owner

@⁠geiyiliyabumo on GitHub · 2026-11-24 12:21 UTC · original

Independent verification & code review on Windows 11 x64 MSVC (merged onto main ffe310e):

Checks Run

  • cargo xtask policy: PASS (154 files ok)
  • cargo clippy -p victory-hle --all-targets --locked -- -D warnings (default + --features diagnostics): PASS (0 warnings)
  • cargo test -p victory-hle --locked -- gameinput: PASS (8/8 tests, including a_keyboard_reading_resets_the_gamepad_state_it_is_given)

Review

Looks clean and ready to merge — gamepad_state properly guards out.is_null(), writes PadState::default() on non-pad readings so reused caller buffers don't retain stale buttons/axes, and returns false (or writes real state and returns true for Value::Pad).

AI-assisted; synthetic tests only, no game files.

**@⁠geiyiliyabumo** on GitHub · 2026-11-24 12:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/574#issuecomment-7131317317) Independent verification & code review on Windows 11 x64 MSVC (merged onto `main` `ffe310e`): ### Checks Run - `cargo xtask policy`: **PASS** (`154 files ok`) - `cargo clippy -p victory-hle --all-targets --locked -- -D warnings` (default + `--features diagnostics`): **PASS** (0 warnings) - `cargo test -p victory-hle --locked -- gameinput`: **PASS** (`8/8` tests, including `a_keyboard_reading_resets_the_gamepad_state_it_is_given`) ### Review Looks clean and ready to merge — `gamepad_state` properly guards `out.is_null()`, writes `PadState::default()` on non-pad readings so reused caller buffers don't retain stale buttons/axes, and returns `false` (or writes real state and returns `true` for `Value::Pad`). *AI-assisted; synthetic tests only, no game files.*
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:16 UTC · original

Automated triage for the maintainers.

Needs rebase. This pull request conflicts with main (conflicting: crates/victory-hle/src/modules/gameinput.rs). It will be reviewed once it is rebased onto the current main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/574#issuecomment-7149384355) <!-- victory-triage v1 head=253b9db4a8f3fee57be96e3e224f337480b0b9a8 verdict=needs-rebase at=2026-11-25T01:16:41Z --> Automated triage for the maintainers. **Needs rebase.** This pull request conflicts with `main` (conflicting: `crates/victory-hle/src/modules/gameinput.rs`). It will be reviewed once it is rebased onto the current `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
github-bot force-pushed github-bot/gh-574 from 253b9db4a8 to 015d59a21e 2026-11-27 02:46:53 +00:00 Compare
Author
Owner

@⁠mercuryVM on GitHub · 2026-11-24 08:30 UTC · original · approved these changes

Tested c70c478 on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (265 passed, 0 failed), including a_keyboard_reading_resets_the_gamepad_state_it_is_given.

IGameInputReading::GetGamepadState fills the struct with at-rest values and returns false when the reading has no gamepad, so writing PadState::default() there matches it. A title that reuses its buffer can no longer keep a stale held button. A null out still returns false without writing.

No issues found.

AI-assisted (Claude Code).

**@⁠mercuryVM** on GitHub · 2026-11-24 08:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/574#pullrequestreview-6035942114) · **approved these changes** Tested c70c478 on Windows 11, RTX 5070, MSVC: `cargo test --workspace --no-fail-fast` passes (265 passed, 0 failed), including `a_keyboard_reading_resets_the_gamepad_state_it_is_given`. `IGameInputReading::GetGamepadState` fills the struct with at-rest values and returns `false` when the reading has no gamepad, so writing `PadState::default()` there matches it. A title that reuses its buffer can no longer keep a stale held button. A null `out` still returns `false` without writing. No issues found. AI-assisted (Claude Code).
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/574/head:github-bot/gh-574'
git switch 'github-bot/gh-574'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-574'
git switch 'github-bot/gh-574'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-574'
git switch 'github-bot/gh-574'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-574'
git switch 'main'
git merge --squash 'github-bot/gh-574'
git switch 'main'
git merge --ff-only 'github-bot/gh-574'
git switch 'main'
git merge 'github-bot/gh-574'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!574
No description provided.