MnK: a bindings.ini saved by hand is read again while the game runs (#1283) #3722

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

@⁠sansj24k on GitHub · 2026-11-30 04:48 UTC · original
sansj24k:fix/mnk-bindings-hand-edits → main · +72 −4 · 2 files · 1 commits · open

Fixes #1283

What it changes

#1283 has two halves. The F1 half (KEY BINDINGS saved, old bindings still used) was fixed on main by 234456f2 (refresh()). This is the other half: "I set up my keybinds in bindings.ini, but they didn't take effect in-game".

1. A save by hand was never read again. Only F1's KEY BINDINGS moved MNK_BINDINGS_CHANGED, so config() read the file once and then not again: a key changed in bindings.ini with the game running did nothing until a restart. hand_edits() now looks at the file's modification time at most once a second (the pad poll runs every few ms, so it does not stat the file each time) and counts each save. config() adds that count to the write counter, so refresh() reads the file again. Nothing else in refresh() changes: a save that does not parse keeps the last bindings, as a KEY BINDINGS write already does. A KEY BINDINGS write now also moves the file's time, so the file is read once more a second later. That read is harmless: it is the same file.

2. The README named the wrong file, in effect. It said only "bindings.ini". The repository has one at its root, but both launchers (play.rs, play-foxhound.ps1) start the game with %LOCALAPPDATA%\victory\bindings.ini (VICTORY_HOME when set), copied from the repository's file the first time. Editing the repository's file afterwards changes nothing, which is likely what the reporter did. The README now names the file, points at the console's mouse/keyboard on: line that prints it, and says that both ways of editing apply while the game runs.

How it was tested

  • GPU and profile: not run in the game (no dump on this PC). The change is in the bindings reload, which the unit tests cover.
  • New test a_bindings_file_saved_by_hand_counts_as_an_edit: the first look is not an edit, it looks again only after a second, and an unchanged time, a save and a replaced file (gone, then back) are each counted correctly. No file named means no edits.
  • Before: cargo test -p victory-hle --lib: 422 passed (plus the flaky xmem range-lock test, see #2439 / #3621).
  • After: 423 passed, 0 failed (that flaky test skipped).
  • cargo clippy -p victory-hle --all-targets --no-deps -- -D warnings: the same 5 errors as on main (gameinput.rs, lifecycle.rs), none in mnk.rs. The workspace gate fails on main for the reasons #2019 / #3530 fix.
  • cargo xtask policy --staged: ok.
  • cargo test passed for the crates it touches: yes (victory-hle, apart from the known flaky test above).

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #1739 removes MNK_BINDINGS_CHANGED in its rewrite of the MnK layout, so whichever of the two lands second needs a small rebase. #2545, #2866, #1949, #3055 and #1913 touch mnk.rs but not config() / refresh().
**@⁠sansj24k** on GitHub · 2026-11-30 04:48 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3722) `sansj24k:fix/mnk-bindings-hand-edits` → `main` · +72 −4 · 2 files · 1 commits · open Fixes #1283 ## What it changes #1283 has two halves. The F1 half (KEY BINDINGS saved, old bindings still used) was fixed on main by `234456f2` (`refresh()`). This is the other half: *"I set up my keybinds in bindings.ini, but they didn't take effect in-game"*. **1. A save by hand was never read again.** Only F1's KEY BINDINGS moved `MNK_BINDINGS_CHANGED`, so `config()` read the file once and then not again: a key changed in `bindings.ini` with the game running did nothing until a restart. `hand_edits()` now looks at the file's modification time at most once a second (the pad poll runs every few ms, so it does not stat the file each time) and counts each save. `config()` adds that count to the write counter, so `refresh()` reads the file again. Nothing else in `refresh()` changes: a save that does not parse keeps the last bindings, as a KEY BINDINGS write already does. A KEY BINDINGS write now also moves the file's time, so the file is read once more a second later. That read is harmless: it is the same file. **2. The README named the wrong file, in effect.** It said only "`bindings.ini`". The repository has one at its root, but both launchers (`play.rs`, `play-foxhound.ps1`) start the game with `%LOCALAPPDATA%\victory\bindings.ini` (`VICTORY_HOME` when set), copied from the repository's file the first time. Editing the repository's file afterwards changes nothing, which is likely what the reporter did. The README now names the file, points at the console's `mouse/keyboard on:` line that prints it, and says that both ways of editing apply while the game runs. ## How it was tested - GPU and profile: not run in the game (no dump on this PC). The change is in the bindings reload, which the unit tests cover. - New test `a_bindings_file_saved_by_hand_counts_as_an_edit`: the first look is not an edit, it looks again only after a second, and an unchanged time, a save and a replaced file (gone, then back) are each counted correctly. No file named means no edits. - Before: `cargo test -p victory-hle --lib`: 422 passed (plus the flaky `xmem` range-lock test, see #2439 / #3621). - After: 423 passed, 0 failed (that flaky test skipped). - `cargo clippy -p victory-hle --all-targets --no-deps -- -D warnings`: the same 5 errors as on main (`gameinput.rs`, `lifecycle.rs`), none in `mnk.rs`. The workspace gate fails on main for the reasons #2019 / #3530 fix. - `cargo xtask policy --staged`: ok. - `cargo test` passed for the crates it touches: yes (`victory-hle`, apart from the known flaky test above). ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #1739 removes `MNK_BINDINGS_CHANGED` in its rewrite of the MnK layout, so whichever of the two lands second needs a small rebase. #2545, #2866, #1949, #3055 and #1913 touch `mnk.rs` but not `config()` / `refresh()`.
Only F1's KEY BINDINGS made config() read the bindings file again
(MNK_BINDINGS_CHANGED), so a key changed in bindings.ini with the game
running did nothing until a restart. hand_edits() now looks at the file's
modification time at most once a second and counts each save; config()
adds that count to the write counter, so refresh() reads the file again.
A save that does not parse keeps the last bindings, as a KEY BINDINGS
write does.

The README named only "bindings.ini". The game reads the copy in
%LOCALAPPDATA%\victory (VICTORY_HOME), which both launchers make from the
repository's file the first time; editing the repository's file
afterwards changes nothing. It now says which file, and that both ways
of editing it take effect at once.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 04:51:21 +00:00
This pull request has changes conflicting with the target branch.
  • README.md
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/3722/head:github-bot/gh-3722'
git switch 'github-bot/gh-3722'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3722'
git switch 'github-bot/gh-3722'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3722'
git switch 'github-bot/gh-3722'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3722'
git switch 'main'
git merge --squash 'github-bot/gh-3722'
git switch 'main'
git merge --ff-only 'github-bot/gh-3722'
git switch 'main'
git merge 'github-bot/gh-3722'
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/trustno1-coder--VIctory-NVIDIA!3722
No description provided.