hle(gameinput): input latch and stick dead zone for play at a few frames a second (#429) #435

Closed
github-bot wants to merge 1 commit from github-bot/gh-431 into main AGit
Owner

@⁠marcus-4 on GitHub · 2026-11-27 17:57 UTC · original
marcus-4:feat/input-latch-dead-zone → main · +377 −6 · 3 files · 1 commits · closed without merging

What this changes

Refs #433

Two input switches for play at a few frames a second, both off by default, ported from halfwave50/VIctory-macOS-halfwave50 (GPL-3.0) commits 52e0325 and f01d73e by halfwave50, into a child module crates/victory-hle/src/modules/gameinput_slow.rs:

  • VICTORY_INPUT_LATCH=1: a button change the title has not seen yet waits for its next reading, so a tap between two of the title's once-a-frame readings is seen once. Triggers show their peak since the last reading, sticks their latest value; readings within 15 ms agree; with no reading for 2 s the latch lets go.
  • VICTORY_STICK_DEADZONE=<share>: a round dead zone per host pad stick, the rest of the travel spread over 0 to 1.

Hooks in gameinput.rs: Slow::latch in State::poll for the host pads and the keyboard's stand-in pad; Slow::handed after a successful current_reading and temporal_reading; Slow::dead_zones in Hub::poll before scripted keys are merged. Documented in docs/native-host.md next to VICTORY_KEYS. halfwave50's Wine-only VICTORY_INPUT_REFOCUS is not ported: window.rs releases keys when the window loses key status.

How it was tested

M1 Pro, macOS 27.2.1, Xcode 27.2.

  • cargo test --target x86_64-apple-darwin -p victory-hle -p victory: 368 passed, 0 failed (arm64: 162 passed, 0 failed). New: halfwave50's five unit tests in gameinput_slow.rs (a second press before the release was seen, reads close together agree, a latch nobody reads lets go, the dead zone, trigger peaks), and latch_shows_a_tap_between_readings_once_and_held_buttons_while_held, end to end through GetCurrentReading with the fake host: with the switch off the tap is lost, with it on it is seen once.
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings: clean. cargo xtask policy: ok.
  • Ran the game: not done (no game run on this machine). Whether taps now register in the world needs a tester; both switches are off unless set.

Checklist

  • No game files, game code, disassembly listings or SDK files are included
  • Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md (none: this is host-side input timing)
  • New diagnostics are behind a VICTORY_* variable and documented
**@⁠marcus-4** on GitHub · 2026-11-27 17:57 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/431) `marcus-4:feat/input-latch-dead-zone` → `main` · +377 −6 · 3 files · 1 commits · closed without merging ## What this changes Refs #433 Two input switches for play at a few frames a second, both off by default, ported from halfwave50/VIctory-macOS-halfwave50 (GPL-3.0) commits `52e0325` and `f01d73e` by halfwave50, into a child module `crates/victory-hle/src/modules/gameinput_slow.rs`: - `VICTORY_INPUT_LATCH=1`: a button change the title has not seen yet waits for its next reading, so a tap between two of the title's once-a-frame readings is seen once. Triggers show their peak since the last reading, sticks their latest value; readings within 15 ms agree; with no reading for 2 s the latch lets go. - `VICTORY_STICK_DEADZONE=<share>`: a round dead zone per host pad stick, the rest of the travel spread over 0 to 1. Hooks in `gameinput.rs`: `Slow::latch` in `State::poll` for the host pads and the keyboard's stand-in pad; `Slow::handed` after a successful `current_reading` and `temporal_reading`; `Slow::dead_zones` in `Hub::poll` before scripted keys are merged. Documented in `docs/native-host.md` next to `VICTORY_KEYS`. halfwave50's Wine-only `VICTORY_INPUT_REFOCUS` is not ported: `window.rs` releases keys when the window loses key status. ## How it was tested M1 Pro, macOS 27.2.1, Xcode 27.2. - [x] `cargo test --target x86_64-apple-darwin -p victory-hle -p victory`: 368 passed, 0 failed (arm64: 162 passed, 0 failed). New: halfwave50's five unit tests in `gameinput_slow.rs` (a second press before the release was seen, reads close together agree, a latch nobody reads lets go, the dead zone, trigger peaks), and `latch_shows_a_tap_between_readings_once_and_held_buttons_while_held`, end to end through `GetCurrentReading` with the fake host: with the switch off the tap is lost, with it on it is seen once. - [x] `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings`: clean. `cargo xtask policy`: ok. - [ ] Ran the game: not done (no game run on this machine). Whether taps now register in the world needs a tester; both switches are off unless set. ## Checklist - [x] No game files, game code, disassembly listings or SDK files are included - [x] Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md (none: this is host-side input timing) - [x] New diagnostics are behind a `VICTORY_*` variable and documented
VICTORY_INPUT_LATCH=1: the title takes a pad's current reading once a
frame, seconds apart in the world here, so a press and release between two
readings (sprint, jump) was never seen. With the latch, each button change
the title has not seen yet waits for its next reading. Triggers show their
peak since the last reading, sticks their latest value; reads within 15 ms
agree; with no reading for 2 s the latch lets go.

VICTORY_STICK_DEADZONE=<share>: a round dead zone on host pad sticks, the
rest of the travel spread over 0 to 1 again.

Both off by default. Ported from halfwave50/VIctory-macOS-halfwave50
(GPL-3.0), commits 52e0325 and f01d73e, by halfwave50; the hooks are the
same (latch in State::poll, hand-outs in current_reading and
temporal_reading), the dead zone is applied in Hub::poll before scripted
keys are merged. Their Wine-only VICTORY_INPUT_REFOCUS is not ported: the
native window releases keys when it loses key status.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 18:03:55 +00:00
github-bot force-pushed github-bot/gh-431 from bcde46b6d6 to 2984e3308b 2026-11-27 23:55:16 +00:00 Compare
github-bot force-pushed github-bot/gh-431 from 2984e3308b to 1226455d68 2026-11-28 01:03:03 +00:00 Compare
github-bot force-pushed github-bot/gh-431 from 1226455d68 to 3ecea3e862 2026-11-28 02:05:02 +00:00 Compare
github-bot closed this pull request 2026-11-28 08:20:44 +00:00
Author
Owner

@⁠marcus-4 on GitHub · 2026-11-28 08:13 UTC · original

Closing: this change has been redone on a newer base.

**@⁠marcus-4** on GitHub · 2026-11-28 08:13 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/431#issuecomment-7236446155) Closing: this change has been redone on a newer base.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.