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

Open
sansj24k wants to merge 1 commit from upstream-pr/3722 into main
sansj24k commented 2026-11-30 04:48:51 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by sansj24k on 2026-11-30T04:48:51Z.


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().
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5559185121 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3722). Originally posted by [sansj24k](https://github.com/sansj24k) on 2026-11-30T04:48:51Z. --- 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()`.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3722:upstream-pr/3722'
git switch 'upstream-pr/3722'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3722'
git switch 'upstream-pr/3722'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3722'
git switch 'upstream-pr/3722'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3722'
git switch 'main'
git merge --squash 'upstream-pr/3722'
git switch 'main'
git merge --ff-only 'upstream-pr/3722'
git switch 'main'
git merge 'upstream-pr/3722'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
trustno1-coder/VIctory-NVIDIA!3722
No description provided.