input: fix radial wheel mouse/scroll, X/Y actions, and scope zoom bindings #123

Open
github-bot wants to merge 9 commits from github-bot/gh-123 into main AGit
Owner

@⁠hnpf on GitHub · 2026-12-01 22:37 UTC · original
hnpf:fix-radial-wheel-and-zoom-kbm → main · +219 −62 · 4 files · 9 commits · open

Summary

  • Radial wheel mouse selection (WheelStick): Allow IN_WHEEL and WHEEL_HOLD to activate and stay active even when IN_MENU (!action_active(PLAY_ACTION)) is set, and prioritize in_wheel over in_menu (when !in_map) in gameinput.rs / mouse.rs so WheelStick drives pad.right_x/pad.right_y instead of falling back to menu_stepper.
  • Scroll wheel (WheelUp/WheelDown): Add a WM_MOUSEWHEEL fallback handler in mouse.rs (deduplicated against WM_INPUT RI_MOUSE_WHEEL within 50 ms) for setups where Wine/Proton delivers scroll notches via WM_MOUSEWHEEL rather than raw input.
  • Wheel R / F (console X / Y): While IN_WHEEL is active, prioritize INPUT_FRONTEND_X/INPUT_FRONTEND_RLEFT/INPUT_SCRIPT_RLEFT/INPUT_CONTEXT_X for R and INPUT_FRONTEND_Y/INPUT_FRONTEND_RUP/INPUT_SCRIPT_RUP/INPUT_CONTEXT_Y for F.
  • Sniper / binocular zoom: Add INPUT_SNIPER_ZOOM_IN_ONLY / INPUT_SNIPER_ZOOM_IN_SECONDARY to WheelUp and ArrowUp, and INPUT_SNIPER_ZOOM_OUT_ONLY / INPUT_SNIPER_ZOOM_OUT_SECONDARY to WheelDown and ArrowDown in config/native-keys.default.txt.

Build

  • Rebuilt victory.exe (./build.sh, release profile for x86_64-pc-windows-msvc).
**@⁠hnpf** on GitHub · 2026-12-01 22:37 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/123) `hnpf:fix-radial-wheel-and-zoom-kbm` → `main` · +219 −62 · 4 files · 9 commits · open ## Summary - **Radial wheel mouse selection (`WheelStick`)**: Allow `IN_WHEEL` and `WHEEL_HOLD` to activate and stay active even when `IN_MENU` (`!action_active(PLAY_ACTION)`) is set, and prioritize `in_wheel` over `in_menu` (when `!in_map`) in `gameinput.rs` / `mouse.rs` so `WheelStick` drives `pad.right_x`/`pad.right_y` instead of falling back to `menu_stepper`. - **Scroll wheel (`WheelUp`/`WheelDown`)**: Add a `WM_MOUSEWHEEL` fallback handler in `mouse.rs` (deduplicated against `WM_INPUT` `RI_MOUSE_WHEEL` within 50 ms) for setups where Wine/Proton delivers scroll notches via `WM_MOUSEWHEEL` rather than raw input. - **Wheel `R` / `F` (console `X` / `Y`)**: While `IN_WHEEL` is active, prioritize `INPUT_FRONTEND_X`/`INPUT_FRONTEND_RLEFT`/`INPUT_SCRIPT_RLEFT`/`INPUT_CONTEXT_X` for `R` and `INPUT_FRONTEND_Y`/`INPUT_FRONTEND_RUP`/`INPUT_SCRIPT_RUP`/`INPUT_CONTEXT_Y` for `F`. - **Sniper / binocular zoom**: Add `INPUT_SNIPER_ZOOM_IN_ONLY` / `INPUT_SNIPER_ZOOM_IN_SECONDARY` to `WheelUp` and `ArrowUp`, and `INPUT_SNIPER_ZOOM_OUT_ONLY` / `INPUT_SNIPER_ZOOM_OUT_SECONDARY` to `WheelDown` and `ArrowDown` in `config/native-keys.default.txt`. ## Build - Rebuilt `victory.exe` (`./build.sh`, `release` profile for `x86_64-pc-windows-msvc`).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 22:40:35 +00:00
Author
Owner

@⁠hnpf on GitHub · 2026-12-02 01:42 UTC · original

whoops, duplicate name for df7741d. meant to title it as "remove unwanted movement controls for dpad".

**@⁠hnpf** on GitHub · 2026-12-02 01:42 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/123#issuecomment-7332008571) whoops, duplicate name for df7741d. meant to title it as "remove unwanted movement controls for dpad".
Author
Owner

@⁠2001srikrishna on GitHub · 2026-12-04 07:41 UTC · original

Confirming the wheel X/Y part of this PR fixes the item wheel's "hold LB + X" (eating / using an item) on keyboard.

The full PR no longer applies on current main (1152b9c), so I rebased only that part: a small helper that, while IN_WHEEL is set, sends F as console X and R as Y (first active X/Y action, else the raw 0x3007 / 0x3004 source), tried before the key's own actions. Without it the title switches off the play actions on those keys inside the wheel, resolve_active_sources finds nothing, and the press is dropped (no "key sent" line in the log).

Tested in-game (RX 9070 XT, Proton CachyOS 11, native keys): hold Tab → item wheel → F now uses the item.

Minimal diff against 1152b9c, in case it helps land this piece separately:

diff --git a/crates/victory-loader/src/keyboard_events.rs b/crates/victory-loader/src/keyboard_events.rs
index 1d7e31e..05614a1 100644
--- a/crates/victory-loader/src/keyboard_events.rs
+++ b/crates/victory-loader/src/keyboard_events.rs
@@ -1004,6 +1004,29 @@ fn in_plane_now(base: usize) -> bool {
     is_plane_context(veh, plane_pitch_up, non_plane_veh)
 }
 
+/// While a radial wheel is open, F is the console's X and R its Y (the item
+/// wheel's "hold LB + X" to use an item): the title turns off the play
+/// actions these keys carry, so without this they sent nothing. Sent as the
+/// first active X/Y action, else as the raw button. (Ported from PR #123.)
+fn wheel_face_button(base: usize, key: u32) -> Option<(u32, Vec<(u32, bool, f32)>)> {
+    if !IN_WHEEL.load(Ordering::Relaxed) {
+        return None;
+    }
+    let (names, raw): (&[&str], u32) = match key {
+        0x46 => (
+            &["INPUT_FRONTEND_X", "INPUT_FRONTEND_RLEFT", "INPUT_SCRIPT_RLEFT", "INPUT_CONTEXT_X"],
+            0x3007,
+        ),
+        0x52 => (
+            &["INPUT_FRONTEND_Y", "INPUT_FRONTEND_RUP", "INPUT_SCRIPT_RUP", "INPUT_CONTEXT_Y"],
+            0x3004,
+        ),
+        _ => return None,
+    };
+    let ids: Vec<u32> = names.iter().map(|n| joaat(n)).collect();
+    resolve_active_sources(base, &ids).or(Some((0, vec![(raw, false, 1.0)])))
+}
+
 /// Finds the first active action in `actions` that has pad binding record(s) (`0x3000..=0x3013`).
 /// Returns `(action_id, vec![(pad_source, is_axis, value), ...])` — 1 source for normal OR entries,
 /// or all sources in the chord for `CHORD_ENTRY_VTABLE` entries so holding the PC key holds the full chord.
@@ -1168,7 +1191,9 @@ unsafe fn translate(me: &Relay, e: &Event) {
             if held.iter().any(|h| h.key == key) {
                 return;
             }
-            if let Some((id, sources)) = resolve_active_sources(base, &actions) {
+            if let Some((id, sources)) = wheel_face_button(base, key)
+                .or_else(|| resolve_active_sources(base, &actions))
+            {
                 // (Also where walking is off: a wheel's key that opens it is
                 // play, `context`.)
                 if matches!(id, OPEN_WHEEL_ACTION | OPEN_EMOTE_WHEEL | SELECT_ITEM_WHEEL) {

Credit for the approach goes to this PR.

**@⁠2001srikrishna** on GitHub · 2026-12-04 07:41 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/123#issuecomment-7404976448) Confirming the wheel X/Y part of this PR fixes the item wheel's "hold LB + X" (eating / using an item) on keyboard. The full PR no longer applies on current `main` (1152b9c), so I rebased only that part: a small helper that, while `IN_WHEEL` is set, sends F as console X and R as Y (first active X/Y action, else the raw `0x3007` / `0x3004` source), tried before the key's own actions. Without it the title switches off the play actions on those keys inside the wheel, `resolve_active_sources` finds nothing, and the press is dropped (no "key sent" line in the log). Tested in-game (RX 9070 XT, Proton CachyOS 11, native keys): hold Tab → item wheel → F now uses the item. Minimal diff against 1152b9c, in case it helps land this piece separately: ```diff diff --git a/crates/victory-loader/src/keyboard_events.rs b/crates/victory-loader/src/keyboard_events.rs index 1d7e31e..05614a1 100644 --- a/crates/victory-loader/src/keyboard_events.rs +++ b/crates/victory-loader/src/keyboard_events.rs @@ -1004,6 +1004,29 @@ fn in_plane_now(base: usize) -> bool { is_plane_context(veh, plane_pitch_up, non_plane_veh) } +/// While a radial wheel is open, F is the console's X and R its Y (the item +/// wheel's "hold LB + X" to use an item): the title turns off the play +/// actions these keys carry, so without this they sent nothing. Sent as the +/// first active X/Y action, else as the raw button. (Ported from PR #123.) +fn wheel_face_button(base: usize, key: u32) -> Option<(u32, Vec<(u32, bool, f32)>)> { + if !IN_WHEEL.load(Ordering::Relaxed) { + return None; + } + let (names, raw): (&[&str], u32) = match key { + 0x46 => ( + &["INPUT_FRONTEND_X", "INPUT_FRONTEND_RLEFT", "INPUT_SCRIPT_RLEFT", "INPUT_CONTEXT_X"], + 0x3007, + ), + 0x52 => ( + &["INPUT_FRONTEND_Y", "INPUT_FRONTEND_RUP", "INPUT_SCRIPT_RUP", "INPUT_CONTEXT_Y"], + 0x3004, + ), + _ => return None, + }; + let ids: Vec<u32> = names.iter().map(|n| joaat(n)).collect(); + resolve_active_sources(base, &ids).or(Some((0, vec![(raw, false, 1.0)]))) +} + /// Finds the first active action in `actions` that has pad binding record(s) (`0x3000..=0x3013`). /// Returns `(action_id, vec![(pad_source, is_axis, value), ...])` — 1 source for normal OR entries, /// or all sources in the chord for `CHORD_ENTRY_VTABLE` entries so holding the PC key holds the full chord. @@ -1168,7 +1191,9 @@ unsafe fn translate(me: &Relay, e: &Event) { if held.iter().any(|h| h.key == key) { return; } - if let Some((id, sources)) = resolve_active_sources(base, &actions) { + if let Some((id, sources)) = wheel_face_button(base, key) + .or_else(|| resolve_active_sources(base, &actions)) + { // (Also where walking is off: a wheel's key that opens it is // play, `context`.) if matches!(id, OPEN_WHEEL_ACTION | OPEN_EMOTE_WHEEL | SELECT_ITEM_WHEEL) { ``` Credit for the approach goes to this PR.
Author
Owner

@⁠Luxuride on GitHub · 2026-12-04 12:03 UTC · original

Nine gameplay commits on a 334-commit-old base cannot be reviewed as one thing, and the biggest of them is a competing answer to a question main has already answered — so: split, and the split is not arbitrary.

Two pieces are genuinely missing from main and worth a PR of their own:

  • LT trigger fix. Main still has let value = if axis && flags == 1 { -1.0 } else { 1.0 }; at crates/victory-loader/src/keyboard_events.rs:1056, and axis_value clamps triggers to 0.0..=1.0 (:516-518), so an inverse-flagged LT binding presses nothing. Your bound_axis_value with is_trigger is the correct fix and has a test.
  • WM_MOUSEWHEEL from a foreground child window. git grep WM_MOUSEWHEEL main crates finds nothing, so wheel input there is still unfixed upstream, and the 50 ms dedup against raw input is the right shape.

What should be dropped from this PR:

  • The binding-table redesign reverts what config/native-keys.default.txt on main now ships (pitch on I/K at :39/:42, sniper zoom on RightBracket at :62), and the wheel override hard-codes F→RLEFT (0x3007) while the config binds F through INPUT_CONTEXT_Y/INPUT_SCRIPT_RUP — one of the two is wrong, and the config is what users are told to edit.
  • The arrow-as-d-pad commit is already arrows_are_dpad() on main (keyboard_events.rs:193). Worth noting: VICTORY_ARROWS_DPAD is documented in neither docs/SETTINGS.md nor run.conf.default, so documenting it is worth more than re-landing it.

In what you keep, reuse main's named constants (const ARROWS: [u32; 4] = [0x25, 0x26, 0x27, 0x28]; at :185) instead of 0x46/0x52/0x26 with comments.

**@⁠Luxuride** on GitHub · 2026-12-04 12:03 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/123#issuecomment-7410915349) Nine gameplay commits on a 334-commit-old base cannot be reviewed as one thing, and the biggest of them is a competing answer to a question main has already answered — so: split, and the split is not arbitrary. Two pieces are genuinely missing from main and worth a PR of their own: - **LT trigger fix.** Main still has `let value = if axis && flags == 1 { -1.0 } else { 1.0 };` at `crates/victory-loader/src/keyboard_events.rs:1056`, and `axis_value` clamps triggers to `0.0..=1.0` (`:516-518`), so an inverse-flagged LT binding presses nothing. Your `bound_axis_value` with `is_trigger` is the correct fix and has a test. - **`WM_MOUSEWHEEL` from a foreground child window.** `git grep WM_MOUSEWHEEL main crates` finds nothing, so wheel input there is still unfixed upstream, and the 50 ms dedup against raw input is the right shape. What should be dropped from this PR: - The binding-table redesign reverts what `config/native-keys.default.txt` on main now ships (pitch on I/K at `:39`/`:42`, sniper zoom on `RightBracket` at `:62`), and the wheel override hard-codes F→RLEFT (`0x3007`) while the config binds F through `INPUT_CONTEXT_Y`/`INPUT_SCRIPT_RUP` — one of the two is wrong, and the config is what users are told to edit. - The arrow-as-d-pad commit is already `arrows_are_dpad()` on main (`keyboard_events.rs:193`). Worth noting: `VICTORY_ARROWS_DPAD` is documented in neither `docs/SETTINGS.md` nor `run.conf.default`, so documenting it is worth more than re-landing it. In what you keep, reuse main's named constants (`const ARROWS: [u32; 4] = [0x25, 0x26, 0x27, 0x28];` at `:185`) instead of `0x46`/`0x52`/`0x26` with comments.
This pull request has changes conflicting with the target branch.
  • config/native-keys.default.txt
  • crates/victory-hle/src/modules/gameinput.rs
  • crates/victory-hle/src/modules/gameinput/mouse.rs
  • crates/victory-loader/src/keyboard_events.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-123'
git switch 'github-bot/gh-123'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-123'
git switch 'github-bot/gh-123'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-123'
git switch 'main'
git merge --squash 'github-bot/gh-123'
git switch 'main'
git merge --ff-only 'github-bot/gh-123'
git switch 'main'
git merge 'github-bot/gh-123'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.