Key bindings: three small safeguards from #1365 (focus loss, failed save, default file) #2245
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2245"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by hussainmussa on 2026-11-29T11:00:24Z.
Part of #1365: the three small input safeguards listed there. The ideas are @ItsYungFlexer's, from that issue; the third is done the way their fork does it (
create_new). Three commits, each independent, so any one can be taken alone. The HUD prompts in #1365 are not touched.What it changes
menu.rs). F1's KEY BINDINGS waits for the key withGetAsyncKeyState, which sees keys in every program. After Enter on a line, a click on another window or a key typed there was saved tobindings.ini, and the wait stayed on while the player was away. Now the wait ends before any key is read, the line keeps its key, and the note says NOT CHANGED: THE GAME WINDOW WAS NOT IN FRONT. Not covered: Alt+Tab itself still binds Alt, because Alt goes down while the game is still in front.bindings.initook it (menu.rs).Binds::setchanged the shown text, then wrote the file. After a failed write the line showed the new key while the game used the old one, and the next line that did save wrote the failed key too. Now the text is written first and kept only if the write worked.bindings.iniis never written over one that is there (play.rs,scripts/play-foxhound.ps1). Both launchers did "is it there? if not, write", and the write empties whatever is at that path. Both now create the file in one step that fails if it exists. This is a small window, not an everyday bug; the test pins the rule.How it was tested
cargo test -p victory-gpu --lib host::menu -- --test-threads=1: 16 passed, with the newa_wait_for_a_key_ends_when_the_window_is_not_in_frontanda_binding_is_shown_only_once_its_file_took_it(the second fails with the old order: "a key that was not saved is shown").cargo test -p victory: 79 + 1 + 2 passed, with the newthe_default_bindings_are_never_written_over_a_file_that_is_there.a_change_is_saved_at_once_however_the_game_was_started) fails on main as well, without this change.Checked for overlap
Written with help from Claude; everything above was built and run on my machine.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ItsYungFlexer on 2026-11-29T12:06:38Z.
Thanks @hussainmussa for crediting my fork and keeping the HUD work separate. This covers the three safeguards I wanted upstream, so please proceed with your PR—I won’t submit duplicates.
My current build is victory-reviewed-defaults.exe, with its source now on [VIctory-NVIDIA-Reloaded/main](https://github.com/ItsYungFlexer/VIctory-NVIDIA-Reloaded). The previous main is preserved on a backup branch.
Codex reviewed your diff at
d59447b2cca584e45ef1e69376493327c107fb13and independently ran four isolated Rust checks plus the PowerShell no-overwrite copy check; all passed. That validation did not include the full upstream workspace suite or in-game testing.