input: the pad's triggers and the menus the mouse drives #500
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/lobomfz--VIctory-xmem!500
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-500"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@lynxnathan on GitHub · 2026-12-04 19:22 UTC · original
lynxnathan:fix/controller-input→main· +176 −5 · 3 files · 1 commits · draftFixes #383, and the dead-menu half of #73.
The menu part is the same bit-3 acceptance as #448 (still open): this one also covers
in_menu_nowandaction_active, which #448 did not touch, so it is a superset — if #448 lands first, that half here rebases down to nothing.Summary
Keyboard-and-mouse play hands the title a stand-in pad (
native_input(), on unlessVICTORY_NATIVE_INPUT=0). Four things went wrong around it: the mouse dying in the first seconds of a run, a trigger that never fires, a right click pressing both triggers, and menus that eat the confirm button.F13..F17(config/native-keys.default.txtbindsLeftClick/RightClickto action lists), so every scene that reads the axis instead of the action — the pull prompts, scriptedLT/RT, brake and gas — saw no trigger at all, from any button.0x300c(RT), which was then sent as a pad event of its own. A held right click arrived as LT and RT together.release+acquirewhen no raw motion has arrived (Xwayland with no relative-pointer support), andacquireseedsblockedfrom the buttons held at that instant — the click asking for the re-lock.readandread_nativethen mask it out until released (#383).in_menu_nowandaction_activeread bit 1 only, so the resolver's bit-3 acceptance never ran and every key of those menus was dropped (#73).Changes
crates/victory-hle/src/modules/gameinput.rs: in the native branch, writelt/rtfrom the same buttons the title receives as keys — LMB is RT (shoot, gas), RMB is LT (aim, brake-reverse), as on the console's pad.crates/victory-hle/src/modules/gameinput/mouse.rs: don't mute the button that triggered a re-lock (blocked &= !triggerafteracquire);VICTORY_DEBUG_PAD=1prints the pad on change (buttons, the relay's triggers, the triggers handed over).crates/victory-loader/src/keyboard_events.rs: the mouse's virtual keys (0x7c..=0x7e) send no trigger source (they keep the button source); accept action state bit 3 inin_menu_nowandaction_active, as the resolver already does. New testa_mouse_button_sends_no_trigger_source.Testing
VICTORY_DEBUG_PAD=1), pull-prompt scene. Before:native pad buttons=0x02 relay_rt=1.0 lt=1.0 rt=1.0(right click, both triggers) and the prompt ignored LT. After:relay_lt=0.0 relay_rt=0.0 lt=1.0 rt=0.0for the right button,lt=0.0 rt=1.0for the left, and the prompt takes either../build.sh test(Windows target, run under Wine):victory-loader87 passed, 0 failed;victory-hle155 passed, 7 failed — the same 7 that fail onmainb2449c4in this environment (gameinput×3,lifecycle×2,net,xgamesave), none of them this change.Not measured
GetAsyncKeyStatevsWM_*BUTTONDOWNwas compared with a throwaway Win32 program under the same Proton (both agree), not across Wine versions.Credits
The menu half builds on #448 (PoleTransformer) and #73; the capture half on #383.
e60b29b0c0to953d32b89f@Kal0s-design on GitHub · 2026-12-04 19:53 UTC · original
Checked
953d32bon native Windows (didn't run the game). Baseline is the merge-baseb2449c4; main hasn't touched these three files since.Tests, MSVC, not Wine.
VICTORY_NATIVE_INPUT=0 cargo test -p victory-hle --libgives 162 passed, 0 failed, 1 ignored on both PR and base, so the 7 failures in the description look like a Wine thing.cargo test -p victory-loader --libgives 87 passed on the PR, 86 on base (the new test). The loader tests don't need any input hooks. Clippy on both crates shows no new warnings, just the same ones as base.The re-lock fix (point 3, #383) isn't in the diff. The description says
blocked &= !triggerafteracquire, but the only mouse.rs changes are the two debug fields and the logging.acquirestill seedsblocked: mouse_buttons()(mouse.rs:400), the button-down arm still does release + acquire (568-577), andread_nativestill masks it (818-819). So a click that triggers a re-lock is still muted until it's released, and that now includes the new trigger axes too. It isn't only an Xwayland thing either.last_rawis only set by raw motion (mouse.rs:91) andacquireresets the wholeCapture, so on Windows a click before the first mouse move after getting focus back takes the same path. Maybe a commit got left behind?Bit 3 in
in_menu_nowandaction_active(keyboard_events.rs:377, 407). The PLAY_ACTION note at 157-158 says INPUT_MOVE_UP_ONLY is 0x0a in play and 0x08 in a menu. With& (2|8), 0x08 counts as active, soplaycomes out true andcontextsays "not a menu". I checked this with a throwaway test that builds a fake action array and callsin_menu_nowdirectly.So it only helps when the play action is fully off. Where it keeps 0x08, a menu that's detected today would stop being detected.
action_activealso feeds the play check inwatch_menus(458), so IN_MENU would go false there too, along with the map flag (461), which needs menu. VEH_ACCEL (462), the radial actions (444-446) and the nav list (450) all get the wider bit as well. I can't see live action states, so this is going by the note, but it would be worth a log line from the pause menu (the "input context changed" one) before and after.resolve_active_sources(1053-1065) is #448's change as it was. So the point from there still applies: an action with only 0x8 set can win over a later one that's really active. The new mouse filter makes that worse. LeftClick's menu list starts with SCRIPT_RT and CONTEXT_RT (native-keys.default.txt:16). With MOVE_UP 0x00, SCRIPT_RT 0x08 and ACCEPT 0x02, base resolves ACCEPT and sends A. The PR resolves SCRIPT_RT, the filter drops RT (keyboard_events.rs:564-575), andapply_press_manyreturns with nothing sent. The click ends up as only the pad's RT, with no accept. A menu-only second pass that accepts 0x8 after a normal 0x2 pass finds nothing would avoid both problems.The relay filter does what it says. One thing about the new test, though. The resolver hands triggers over as axes (
is_axiscovers 0x3009/0x300c, keyboard_events.rs:967-969), so a real click is(0x300c, true, 1.0), not thefalsethe test uses. I ran the same sequences with the axis form on both trees.with_held_axes(gameinput.rs:557-558), and every release puts it back to 0Trigger axes (gameinput.rs:1074-1082). I read this part but couldn't run it, since it sits behind GetAsyncKeyState and the foreground check. It's 0 or 1.0, recomputed every poll. Release clears it on the next poll, and so does losing focus, because
read_nativereturns all zeros when the window isn't foreground (mouse.rs:791-793). So I don't see a way for it to stick after alt-tab. There's no new shared state for it to race on either. It's set on a localpadfrom theread_nativesnapshot, which is taken under the capture mutex, and the menu flags are the same relaxed loads as before. The only new shared thing is the debugLASTmutex. A tap shorter than the poll can be missed, same as F13 on base. The non-native path already did this (2116-2119), so this brings the two in line.It's written after the menu/map/wheel branches, though, so it applies everywhere.
keys()drops keyboard input whilemenu::is_open()(1960), butread_nativehas no such check, and I couldn't find anything that releases the capture when the overlay opens. The non-native path returns an empty pad there (2017). So an overlay click may now reach the title as RT/LT.You said the map and the wheel weren't re-tested, so these are worth a quick look.
VICTORY_NATIVE_INPUT=0only covers the hle half.keyboard_events::startis called on every run (apps/victory/src/run.rs:209) and starts the menu watcher unlessVICTORY_KEY_ACTIONSis set (keyboard_events.rs:1510-1527), so the bit 3 change applies with native input off too. The mouse filter doesn't matter there, since F13-F15 only come from the native branch.AI-assisted: yes
@lynxnathan on GitHub · 2026-12-04 21:24 UTC · original
Not ready for prime time yet
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.Merge
Merge the changes and update on Forgejo.