F1 menu since #4634: mouse, key-binding focus guard, safe save, RESET error and hand-set values are gone #4939

Open
opened 2026-12-01 14:47:57 +00:00 by Jesper-Andersson · 3 comments
Jesper-Andersson commented 2026-12-01 14:47:57 +00:00 (Migrated from github.com)
Contributor

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Jesper-Andersson on 2026-12-01T14:47:57Z.


What happened

Found by reading code while merging upstream main into our branch, not from a crash report or a play session. Nothing below has been seen in game yet (see "What was not tested"). Cause found only by reading code, so please treat these as likely regressions to confirm, not confirmed bugs.

The five points are posted together because they share one cause: the #4634 rewrite of menu.rs left them out. Each can be fixed on its own, and I can split this into separate issues if that is easier to track.

The merge of #4634 (f5c3d2434, commit 3bde49236 "UI: anti-aliased Segoe UI/Consolas F1 menu and slim F3 stats panel") rewrote crates/victory-gpu/src/host/menu.rs (3257 → 1752 lines). The new drawing is a clear improvement, but five behaviours that main had just before the merge did not come across. "Before" = 7d93ee075 (the merge's first parent, 3bde49236^); "now" = main at 5fabb46ea.

1. Mouse in F1 (added by #2225): only the wheel is left.

  • Before: the key thread watched VK_LBUTTON/VK_RBUTTON while the menu was open (menu.rs:817, :831-832). Hover selected the row under the cursor (handle_hover, :1654), left-click cycled a setting left/right of its value or ran an action, with the same two-click confirm as Enter for PRELOAD / CLEAR SHADERS / IMPORT (handle_left_click, :1750-1800, confirm at :1754), and right-click went back from KEY BINDINGS or IMPORT SAVE, or closed the menu (handle_right_click, :1803-1817; dispatched at :1904-1912).
  • Now: watch_keys watches seven keys, no mouse buttons (menu.rs:653); there is no hover or click handling. The wheel still moves the selection (menu.rs:1370).

2. Key binding: a wait for a key no longer ends when the game window loses focus (added by #2245, 9e0c369db).

  • Before: heard_from ended the wait with Heard::Lost as soon as the game window was not in front, before reading any key, and the note said NOT CHANGED: THE GAME WINDOW WAS NOT IN FRONT (menu.rs:2165-2170, :578, :1220-1227). GetAsyncKeyState answers for the whole desktop, so without this, a key typed in another window after Alt+Tab is written to bindings.ini (the reason given in the comment at :2159-2164).
  • Now: heard reads the keys without checking focus (menu.rs:1686-1696; caller :1101-1103). focused() still exists (:643-647) but is only used for the menu's own keys and pad buttons (:659, :1394), not for the binding wait.
  • Not regressed: the other #2245 safeguard, "a binding is shown only once bindings.ini took it", is still there (menu.rs:1666-1675).

3. Settings save is no longer safe: a failed read can drop the other saved F1 settings (added by #2256, 9b2b3ff46).

  • Before: write_settings (menu.rs:1351-1396) refused to save if the existing settings file could not be read (anything but "not found", :1360-1363), wrote a temp file, synced it and swapped it in (:1392-1396), and wrote through a symlink to its target (:1352-1359).
  • Now: save (menu.rs:1176-1219) reads the old file with .unwrap_or_default() (:1184-1185) and writes with plain std::fs::write (:1201).
  • Risk: if the read fails but the write works, the file is rewritten with only the values changed in this session, and every other saved F1 setting is lost. One case where that happens: read_to_string fails with InvalidData on a file that is not valid UTF-8 (for example one saved as UTF-16 "Unicode" in Notepad), while the write still succeeds. Also, a plain fs::write truncates first, so a crash, kill or full disk during the write can leave an empty or partial victory-settings.txt. Every setting change saves at once (change_and_save, :1355-1360), so this path runs on every Left/Right in F1. (A symlinked file is still written through, since fs::write follows the link; only the temp-file swap and the read check are gone.)

4. RESET always says it worked (added by #2256, 9b2b3ff46).

  • Before: reset_at reported a failed delete with COULD NOT RESET THE SETTINGS FILE and logged it; a missing file counted as reset (menu.rs:1587-1596).
  • Now: reset ignores the result of remove_file and always shows RESET. PLAY DEFAULTS AT THE NEXT START (menu.rs:1348-1353). If the delete fails (read-only file, file held open), the old settings come back at the next start while the menu said they were reset.

5. A value set by hand no longer stays in the setting's cycle (added by #2296, bb946c0ff).

  • Before: a value the game started with that the list does not offer (the comment's example: VICTORY_AMBIENT=1.5) was kept as an extra step after the last listed one, both ways (change, menu.rs:1265-1288, own at :1270). The save also skipped an empty VICTORY_MENU_*= line for a launcher choice returned to NOT SET, because an empty VICTORY_MENU_CONSOLE= reads as Series X (:1375-1380).
  • Now: change steps through the listed values only (menu.rs:1115-1132). One Left/Right on such a line replaces the hand-set value, and since the change is saved at once, it is also gone from the settings file. (The empty-line guard only matters together with the hand-set step, so it should come back with it.)

Also removed with the rewrite

  • Tests: menu.rs had 28 #[test] functions and panel.rs 10; both now have none. Among them were the tests for each point above: failed_settings_read_keeps_the_previous_file, failed_settings_replace_keeps_the_previous_file, reset_settings_reports_errors_and_accepts_missing_file, a_wait_for_a_key_ends_when_the_window_is_not_in_front, a_binding_is_shown_only_once_its_file_took_it, a_value_set_by_hand_stays_in_the_cycle_both_ways, hover_updates_selection_only_when_cursor_moves, left_click_cycles_setting_left_and_right_around_arrows, left_click_executes_actions_and_two_click_confirmation, right_click_exits_picking_or_closes_menu, wheel_scroll_steps_selection_and_drains_notches.
  • F3: the line saying which ray tracing runs (RAY TRACING HARDWARE (DXR) / SOFTWARE / OFF, panel.rs:357-365 before, added in 9a427c140) is not in the new panel.

Suggested fix

  • Points 2-5 don't depend on the drawing: heard_from + Heard::Lost, write_settings/save_to, reset_at and the launched/own step in change can be restored from 7d93ee075 nearly as they were.
  • Point 1 needs the hit test redone for the new pixel layout (the old hit_test_menu_box mapped the cursor to the old character grid), then the old handle_hover / handle_left_click / handle_right_click logic can sit on top of it.
  • Bring back the removed tests that don't test the old bitmap font or grid, so the next rewrite can't drop these silently.

Related, checked

  • #4711 (open, follow-up to #4634 on menu.rs) and #4764 (open, depends on #4711): their menu.rs diffs don't add back any of the above (searched for the old function names, VK_LBUTTON, NamedTempFile, ErrorKind::NotFound). A fix may be easiest inside or right after #4711 to avoid conflicts.
  • #4679, #4707 (open): clippy fixes for the same files, not these behaviours.
  • #2868 (open, from before #4634): also changes reset reporting, but against the old menu.rs.
  • No issue or PR found for any of the five points (searches: F1 menu mouse, F1 mouse, 4634, F1 menu regression, settings save F1, bindings.ini, menu tests, COULD NOT RESET, F1 menu click, menu.rs, victory-settings.txt).

What was not tested

  • None of the five points was tried in game, on main or on our merge build. They come from comparing the two versions of the source.
  • No cargo test run for this report.

Spec dependence

Likely general: the code paths don't depend on the GPU, the console profile or the card's memory. Our PC, for the record: RTX 2070 SUPER 8 GB, driver 621.40; Ryzen 7 5800X, 32 GB, Windows 11 Pro Insider 10.0.26320.

GPU and driver

RTX 2070 SUPER 8 GB, driver 621.40 (not used: found by reading code)

CPU, RAM and Windows version

Ryzen 7 5800X, 32 GB, Windows 11 Pro Insider 10.0.26320

VIctory release or commit

main at 5fabb46ea (compared with 7d93ee075, the parent of #4634's merge)

Settings

Not applicable (no run).

Logs

None: no run was made for this report.

Are you working on a fix?

No

Drafted with AI assistance (Claude Code).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:6723160603 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/4939). Originally posted by [Jesper-Andersson](https://github.com/Jesper-Andersson) on 2026-12-01T14:47:57Z. --- ### What happened Found by reading code while merging upstream `main` into our branch, **not** from a crash report or a play session. Nothing below has been seen in game yet (see "What was not tested"). Cause found only by reading code, so please treat these as likely regressions to confirm, not confirmed bugs. The five points are posted together because they share one cause: the #4634 rewrite of `menu.rs` left them out. Each can be fixed on its own, and I can split this into separate issues if that is easier to track. The merge of #4634 (`f5c3d2434`, commit `3bde49236` "UI: anti-aliased Segoe UI/Consolas F1 menu and slim F3 stats panel") rewrote `crates/victory-gpu/src/host/menu.rs` (3257 → 1752 lines). The new drawing is a clear improvement, but five behaviours that `main` had just before the merge did not come across. "Before" = `7d93ee075` (the merge's first parent, `3bde49236^`); "now" = `main` at `5fabb46ea`. **1. Mouse in F1 (added by #2225): only the wheel is left.** - Before: the key thread watched `VK_LBUTTON`/`VK_RBUTTON` while the menu was open (`menu.rs:817`, `:831-832`). Hover selected the row under the cursor (`handle_hover`, `:1654`), left-click cycled a setting left/right of its value or ran an action, with the same two-click confirm as Enter for PRELOAD / CLEAR SHADERS / IMPORT (`handle_left_click`, `:1750-1800`, confirm at `:1754`), and right-click went back from KEY BINDINGS or IMPORT SAVE, or closed the menu (`handle_right_click`, `:1803-1817`; dispatched at `:1904-1912`). - Now: `watch_keys` watches seven keys, no mouse buttons (`menu.rs:653`); there is no hover or click handling. The wheel still moves the selection (`menu.rs:1370`). **2. Key binding: a wait for a key no longer ends when the game window loses focus (added by #2245, `9e0c369db`).** - Before: `heard_from` ended the wait with `Heard::Lost` as soon as the game window was not in front, before reading any key, and the note said `NOT CHANGED: THE GAME WINDOW WAS NOT IN FRONT` (`menu.rs:2165-2170`, `:578`, `:1220-1227`). `GetAsyncKeyState` answers for the whole desktop, so without this, a key typed in another window after Alt+Tab is written to `bindings.ini` (the reason given in the comment at `:2159-2164`). - Now: `heard` reads the keys without checking focus (`menu.rs:1686-1696`; caller `:1101-1103`). `focused()` still exists (`:643-647`) but is only used for the menu's own keys and pad buttons (`:659`, `:1394`), not for the binding wait. - Not regressed: the other #2245 safeguard, "a binding is shown only once `bindings.ini` took it", is still there (`menu.rs:1666-1675`). **3. Settings save is no longer safe: a failed read can drop the other saved F1 settings (added by #2256, `9b2b3ff46`).** - Before: `write_settings` (`menu.rs:1351-1396`) refused to save if the existing settings file could not be read (anything but "not found", `:1360-1363`), wrote a temp file, synced it and swapped it in (`:1392-1396`), and wrote through a symlink to its target (`:1352-1359`). - Now: `save` (`menu.rs:1176-1219`) reads the old file with `.unwrap_or_default()` (`:1184-1185`) and writes with plain `std::fs::write` (`:1201`). - Risk: if the read fails but the write works, the file is rewritten with only the values changed in this session, and every other saved F1 setting is lost. One case where that happens: `read_to_string` fails with `InvalidData` on a file that is not valid UTF-8 (for example one saved as UTF-16 "Unicode" in Notepad), while the write still succeeds. Also, a plain `fs::write` truncates first, so a crash, kill or full disk during the write can leave an empty or partial `victory-settings.txt`. Every setting change saves at once (`change_and_save`, `:1355-1360`), so this path runs on every Left/Right in F1. (A symlinked file is still written through, since `fs::write` follows the link; only the temp-file swap and the read check are gone.) **4. RESET always says it worked (added by #2256, `9b2b3ff46`).** - Before: `reset_at` reported a failed delete with `COULD NOT RESET THE SETTINGS FILE` and logged it; a missing file counted as reset (`menu.rs:1587-1596`). - Now: `reset` ignores the result of `remove_file` and always shows `RESET. PLAY DEFAULTS AT THE NEXT START` (`menu.rs:1348-1353`). If the delete fails (read-only file, file held open), the old settings come back at the next start while the menu said they were reset. **5. A value set by hand no longer stays in the setting's cycle (added by #2296, `bb946c0ff`).** - Before: a value the game started with that the list does not offer (the comment's example: `VICTORY_AMBIENT=1.5`) was kept as an extra step after the last listed one, both ways (`change`, `menu.rs:1265-1288`, `own` at `:1270`). The save also skipped an empty `VICTORY_MENU_*=` line for a launcher choice returned to NOT SET, because an empty `VICTORY_MENU_CONSOLE=` reads as Series X (`:1375-1380`). - Now: `change` steps through the listed values only (`menu.rs:1115-1132`). One Left/Right on such a line replaces the hand-set value, and since the change is saved at once, it is also gone from the settings file. (The empty-line guard only matters together with the hand-set step, so it should come back with it.) **Also removed with the rewrite** - Tests: `menu.rs` had 28 `#[test]` functions and `panel.rs` 10; both now have none. Among them were the tests for each point above: `failed_settings_read_keeps_the_previous_file`, `failed_settings_replace_keeps_the_previous_file`, `reset_settings_reports_errors_and_accepts_missing_file`, `a_wait_for_a_key_ends_when_the_window_is_not_in_front`, `a_binding_is_shown_only_once_its_file_took_it`, `a_value_set_by_hand_stays_in_the_cycle_both_ways`, `hover_updates_selection_only_when_cursor_moves`, `left_click_cycles_setting_left_and_right_around_arrows`, `left_click_executes_actions_and_two_click_confirmation`, `right_click_exits_picking_or_closes_menu`, `wheel_scroll_steps_selection_and_drains_notches`. - F3: the line saying which ray tracing runs (`RAY TRACING HARDWARE (DXR)` / `SOFTWARE` / `OFF`, `panel.rs:357-365` before, added in `9a427c140`) is not in the new panel. **Suggested fix** - Points 2-5 don't depend on the drawing: `heard_from` + `Heard::Lost`, `write_settings`/`save_to`, `reset_at` and the `launched`/`own` step in `change` can be restored from `7d93ee075` nearly as they were. - Point 1 needs the hit test redone for the new pixel layout (the old `hit_test_menu_box` mapped the cursor to the old character grid), then the old `handle_hover` / `handle_left_click` / `handle_right_click` logic can sit on top of it. - Bring back the removed tests that don't test the old bitmap font or grid, so the next rewrite can't drop these silently. **Related, checked** - #4711 (open, follow-up to #4634 on `menu.rs`) and #4764 (open, depends on #4711): their `menu.rs` diffs don't add back any of the above (searched for the old function names, `VK_LBUTTON`, `NamedTempFile`, `ErrorKind::NotFound`). A fix may be easiest inside or right after #4711 to avoid conflicts. - #4679, #4707 (open): clippy fixes for the same files, not these behaviours. - #2868 (open, from before #4634): also changes reset reporting, but against the old `menu.rs`. - No issue or PR found for any of the five points (searches: F1 menu mouse, F1 mouse, 4634, F1 menu regression, settings save F1, bindings.ini, menu tests, COULD NOT RESET, F1 menu click, menu.rs, victory-settings.txt). ### What was not tested - None of the five points was tried in game, on `main` or on our merge build. They come from comparing the two versions of the source. - No `cargo test` run for this report. ### Spec dependence Likely general: the code paths don't depend on the GPU, the console profile or the card's memory. Our PC, for the record: RTX 2070 SUPER 8 GB, driver 621.40; Ryzen 7 5800X, 32 GB, Windows 11 Pro Insider 10.0.26320. ### GPU and driver RTX 2070 SUPER 8 GB, driver 621.40 (not used: found by reading code) ### CPU, RAM and Windows version Ryzen 7 5800X, 32 GB, Windows 11 Pro Insider 10.0.26320 ### VIctory release or commit `main` at `5fabb46ea` (compared with `7d93ee075`, the parent of #4634's merge) ### Settings Not applicable (no run). ### Logs None: no run was made for this report. ### Are you working on a fix? No Drafted with AI assistance (Claude Code).
github-actions[bot] commented 2026-12-01 14:48:07 +00:00 (Migrated from github.com)
Author
Contributor

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by github-actions[bot] on 2026-12-01T14:48:07Z.


Please attach both logs from the run that went wrong. Without them we can only guess. Paste %LOCALAPPDATA% into the address bar of File Explorer to get there.

  1. The play log, in %LOCALAPPDATA%\victory\logs\: the newest victory-nvidia-play-<date>-<time>-<number>.log (from victory.exe) or victory-nvidia-<date>-<time>.log (from the script launcher). The window shows its path at the start, on the line Log: ....
  2. The crash log: %LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, and, if there is one from that run, the newest victory-<date>-<time>-<number>.crash.log in %LOCALAPPDATA%\VIctory\data\7952987A\temp\.

Also say which GPU you have and which Windows version (10 or 11).

If this issue needs logs and none are posted here within 12 hours, it will be closed. Add them by editing your post or in a comment.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7314849602 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/4939#issuecomment-7314849602). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-12-01T14:48:07Z. --- Please attach both logs from the run that went wrong. Without them we can only guess. Paste `%LOCALAPPDATA%` into the address bar of File Explorer to get there. 1. The play log, in `%LOCALAPPDATA%\victory\logs\`: the newest `victory-nvidia-play-<date>-<time>-<number>.log` (from `victory.exe`) or `victory-nvidia-<date>-<time>.log` (from the script launcher). The window shows its path at the start, on the line `Log: ...`. 2. The crash log: `%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log`, and, if there is one from that run, the newest `victory-<date>-<time>-<number>.crash.log` in `%LOCALAPPDATA%\VIctory\data\7952987A\temp\`. Also say which GPU you have and which Windows version (10 or 11). **If this issue needs logs and none are posted here within 12 hours, it will be closed.** Add them by editing your post or in a comment.
Jesper-Andersson commented 2026-12-01 15:42:52 +00:00 (Migrated from github.com)
Author
Contributor

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Jesper-Andersson on 2026-12-01T15:42:52Z.


Checked in game now (a short menu-only session, 2026-12-01):

  • 1. Mouse: confirmed on our merge build. In F1, hovering over a row does nothing, and neither left-click nor right-click on a setting does anything. The wheel was not tried.
  • 4. RESET: it shows RESET. PLAY DEFAULTS AT THE NEXT START. We did not make the delete fail (read-only or held file), so the failure case is still untested.
  • Changing a value with Left/Right works.
  • 2, 3 and 5 were not tried in game.

Build: our fork's merge of main at 5fabb46ea, not clean main. Our menu.rs adds rows and slider lines (sharpen, vignette, lens flares, depth of field, map key speed, fog cap, light sliders, four look-key binding rows), a hook note and an off-by-default retire switch. Our menu.rs adds no mouse, hover or click code (it does change what Left/Right does on the new light-slider rows), and main's menu.rs has no hover or click code either. But our merge differs from main in about 75 files (a large bundle of our own changes), including the input code in mnk.rs and gameinput.rs, so we cannot rule our build out; we have not tried clean main. RTX 2070 SUPER 8 GB, driver 621.40, Ryzen 7 5800X, 32 GB, Windows 11 Pro Insider 10.0.26320, Series S.

Logs: no crash, and crashes.log has no entry from this session (its last entry is from around 2026-11-28). The play log is not attached: it has the user name and game paths, and no RESET line was logged (only four settings menu: saved lines). Happy to paste specific lines. This note is in place of the logs the bot asked for.

Drafted with AI assistance (Claude Code).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7316381894 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/4939#issuecomment-7316381894). Originally posted by [Jesper-Andersson](https://github.com/Jesper-Andersson) on 2026-12-01T15:42:52Z. --- Checked in game now (a short menu-only session, 2026-12-01): - **1. Mouse: confirmed on our merge build.** In F1, hovering over a row does nothing, and neither left-click nor right-click on a setting does anything. The wheel was not tried. - **4. RESET:** it shows `RESET. PLAY DEFAULTS AT THE NEXT START`. We did not make the delete fail (read-only or held file), so the failure case is still untested. - Changing a value with Left/Right works. - 2, 3 and 5 were not tried in game. Build: our fork's merge of `main` at `5fabb46ea`, not clean `main`. Our `menu.rs` adds rows and slider lines (sharpen, vignette, lens flares, depth of field, map key speed, fog cap, light sliders, four look-key binding rows), a hook note and an off-by-default retire switch. Our `menu.rs` adds no mouse, hover or click code (it does change what Left/Right does on the new light-slider rows), and `main`'s `menu.rs` has no hover or click code either. But our merge differs from `main` in about 75 files (a large bundle of our own changes), including the input code in `mnk.rs` and `gameinput.rs`, so we cannot rule our build out; we have not tried clean `main`. RTX 2070 SUPER 8 GB, driver 621.40, Ryzen 7 5800X, 32 GB, Windows 11 Pro Insider 10.0.26320, Series S. Logs: no crash, and `crashes.log` has no entry from this session (its last entry is from around 2026-11-28). The play log is not attached: it has the user name and game paths, and no RESET line was logged (only four `settings menu: saved` lines). Happy to paste specific lines. This note is in place of the logs the bot asked for. Drafted with AI assistance (Claude Code).
eipastel commented 2026-12-01 15:50:34 +00:00 (Migrated from github.com)
Author
Contributor

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by eipastel on 2026-12-01T15:50:34Z.


Point 2 (binding wait and window focus): #4968 brings back #2245's check on the new menu, with its test.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7316600284 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/4939#issuecomment-7316600284). Originally posted by [eipastel](https://github.com/eipastel) on 2026-12-01T15:50:34Z. --- Point 2 (binding wait and window focus): #4968 brings back #2245's check on the new menu, with its test.
Sign in to join this conversation.
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#4939
No description provided.