panel: any key for the settings menu, and save on close #389
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!389
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-389"
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?
@TuxArchi on GitHub · 2026-12-03 23:43 UTC · original
TuxArchi:menu-key-and-save→main· +135 −9 · 1 files · 3 commits · openWhat
VICTORY_MENU_KEYchooses the key that opens the settings menu. It accepts:A..Zand digits0..9F1..F24Space,Tab,Backspace,Insert,Home,End,PageUp,PageDown-,=,,,.,/,;,',[,],\,`and their namesF1when unset, invalid, or a key the menu itself usesF10 (save+restart).
restarts so the values apply.
a chord such as Ctrl+K reaches another mod instead of also opening this menu.
Why
The key was hardcoded to F1. A launcher can now expose it, and closing the menu
no longer risks losing a change before F10.
Testing
cargo check --release -p victoryand./build.shon the AMD port with thepatch applied.
VICTORY_MENU_KEYdefaults to F1 when absent or invalid.(
run.shexportsrun.conf), so it does not need a new row inrun.conf.defaultand the menu preserves the unknown line.panel: configurable menu key and save on closeto panel: any key for the settings menu, and save on close@Kal0s-design on GitHub · 2026-12-04 03:24 UTC · original
Built and tested this natively on Windows 11 (MSVC). The victory-gpu lib tests pass apart from the same native failures main already has. I also ran a throwaway test of
parse_menu_keyand rendered the panel and menu with the GDI preview. A few things came up.The modifier guard can still open the menu on the chord it is meant to protect. With the menu on K, press Ctrl+K and let go of Ctrl a moment before K. On the next poll Ctrl is up and K is still down, so bit 0 goes from 0 to 1 and that counts as a fresh press. Masking the edge would avoid this. Keep reading K into
heldas usual and only clear bit 0 ofpressedwhile a modifier is down. Then a key that went down under a modifier never produces an edge. Also note that Shift+F1, Ctrl+F1 and Alt+F1 no longer open the menu with the default key, which used to work.The parser rejects the menu's own keys but still accepts
0,-and=. Those are the F3 chords for HUD size (F3+0 reset, F3+- and F3+= resize). Bound to one of them, F3+0 resets the size and toggles the menu at once, sinceHotkeysandMenuKeyspoll independently. Keys the title maps are accepted too, like Space, Tab, Backspace, F2 and the backtick (F2 and backtick also toggle mouse look in gameinput).GetAsyncKeyStatedoesn't consume anything, and the title only stops getting keys oncemenu::is_open()is set. So the press that opens the menu reaches the game, and so does the key still held after the close. Maybe reject F2, the backtick and the F3 chord keys, or at least document it.Save on close looks redundant. Main already saves after every Left/Right/Del (the
if edited && pressed & 0b1100 == 0block), and the menu says changes are saved at once. A close will normally find nothing to write, sinceMenu::savereturns early when the text is unchanged. It's harmless, but the "risks losing a change before F10" reason doesn't really hold on main. "(saves)" in the footer fits fine at 1080p.The hint in the full panel is cut off with longer key names. With
VICTORY_MENU_KEY=CloseBracketit renders as "F3 hide Shift+F3 compact CloseBr..." and "Config" is gone. "F1 Config" just about fits now.Smaller things.
VICTORY_MENU_KEYisn't in docs/SETTINGS.md. The OEM names assume a US layout, and on other layouts-,;and'are different physical keys. Clippy reports two newcollapsible_ifwarnings in the close-save block (panel.rs:490/491). rustfmt also wants changes in the new import list, thematches!and the hintformat!.AI-assisted: yes
@Luxuride on GitHub · 2026-12-04 11:28 UTC · original
The configurable key part I would take:
VK_F1 + number - 1reachingVK_F24is right, single characters map to their ASCII virtual-key codes, the modifier skip is scoped to the menu key's own bit, and the longest footer still fits at 660.Two things:
crates/victory-gpu/src/host/panel.rs:420-424— which is why the footer says "Changes are saved at once"; the new block is a second write on every close, including when nothing changed.VICTORY_MENU_KEYis undocumented, and an unusable value is indistinguishable from unset:Shift,ESCand a typo all fall through toVK_F1silently. One row indocs/SETTINGS.md:144-151next toVICTORY_MENU=0, plus atracing::warn!naming the rejected value.Minor:
menu_key_label()formats aStringon every paint; caching it beside theOnceLockwould read better.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.