Prompts: show the keys of the active keyboard profile #4588

Open
tyr0nsur wants to merge 1 commit from upstream-pr/4588 into main
tyr0nsur commented 2026-11-30 23:20:43 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by tyr0nsur on 2026-11-30T23:20:43Z.


Fixes #4536.

What it changes

With the shipped bindings.ini, the native keyboard path handles Tab for LB and F for Y. The keyboard pictures still show Q and Y on current main. The profile lookup from #2545 was left disconnected from the prompt hook, and the native input path began using the profile's buttons in ffe92c57.

  • Pass the loaded profile to the existing icon renderer before the hook is installed. Native input uses profile buttons with its remaining stock keyboard keys. Legacy input uses the profile's separate axis bindings. Controller modes keep the title's controller prompts.
  • Draw Backspace as a solid erase-left outline with a cut-out cross. It uses the same in-memory vector pipeline as the other keycaps.
  • Show F1–F24 by name in keycaps and the binding editor and accept their names in bindings.ini. Existing host shortcuts still apply. The test uses F5 to avoid the host's F1–F3 shortcuts.

The pictures reflect the profile loaded at launch. A restart is required to refresh them after editing a binding in the menu. Animated hold prompts keep their original art.

This can work with the layout proposed in #4586. This PR reads whichever profile is active and leaves the shipped key assignments in place. It also leaves the movie-load timing from #3442 outside this change.

How it was tested

Windows validation on e23347a0, based on current main f5c3d243 after the F1 menu update in #4634.

  • All 45 victory-game library tests passed. The synthetic movie verifies that only the controls bound to Tab and F5 are redrawn in that case.
  • 96 native keyboard and GameInput tests passed (2 ignored). The focused test for F1, F5, and F24 in the redesigned binding editor also passed.
  • cargo check --locked -p victory and the staged asset-policy check passed for nine files.
  • I inspected the new outline at 64, 32, and 20 pixels using generated geometry. In-game verification is still pending. No game assets are included.

The CI check on this head stops at the same five Clippy findings as main f5c3d243. The fixes are tracked in #4679. The CI test step did not run.

Checked for overlap

Related: #4541, #4586, #3442 and #4634.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5575586376 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4588). Originally posted by [tyr0nsur](https://github.com/tyr0nsur) on 2026-11-30T23:20:43Z. --- Fixes #4536. ## What it changes With the shipped `bindings.ini`, the native keyboard path handles Tab for LB and F for Y. The keyboard pictures still show Q and Y on current main. The profile lookup from #2545 was left disconnected from the prompt hook, and the native input path began using the profile's buttons in ffe92c57. - Pass the loaded profile to the existing icon renderer before the hook is installed. Native input uses profile buttons with its remaining stock keyboard keys. Legacy input uses the profile's separate axis bindings. Controller modes keep the title's controller prompts. - Draw Backspace as a solid erase-left outline with a cut-out cross. It uses the same in-memory vector pipeline as the other keycaps. - Show F1–F24 by name in keycaps and the binding editor and accept their names in `bindings.ini`. Existing host shortcuts still apply. The test uses F5 to avoid the host's F1–F3 shortcuts. The pictures reflect the profile loaded at launch. A restart is required to refresh them after editing a binding in the menu. Animated hold prompts keep their original art. This can work with the layout proposed in #4586. This PR reads whichever profile is active and leaves the shipped key assignments in place. It also leaves the movie-load timing from #3442 outside this change. ## How it was tested Windows validation on `e23347a0`, based on current main `f5c3d243` after the F1 menu update in #4634. - All 45 `victory-game` library tests passed. The synthetic movie verifies that only the controls bound to Tab and F5 are redrawn in that case. - 96 native keyboard and GameInput tests passed (2 ignored). The focused test for F1, F5, and F24 in the redesigned binding editor also passed. - `cargo check --locked -p victory` and the staged asset-policy check passed for nine files. - I inspected the new outline at 64, 32, and 20 pixels using generated geometry. In-game verification is still pending. No game assets are included. The CI check on this head stops at the same five Clippy findings as main f5c3d243. The fixes are tracked in #4679. The CI test step did not run. ## Checked for overlap Related: #4541, #4586, #3442 and #4634.
F0RLE commented 2026-11-30 23:40:16 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by F0RLE on 2026-11-30T23:40:16Z.

Code review location: crates/victory-hle/src/modules/mnk.rs; line 299

@@ -291,11 +293,27 @@ fn bound_controls(b: &Bindings) -> Vec<(PadControl, Vec<u8>)> {
         PadControl::LeftStickUp,
     ];
     let buttons = BUTTON_CONTROLS.iter().map(|&(bit, control)| {
-        let keys = b.buttons.iter().filter(|&&(_, on)| on == bit).map(|&(key, _)| key);
-        (control, keys.collect())
+        let bound = b.buttons.iter().filter(|&&(key, on)| {
+            // The native keyboard sampler sees left/right modifiers and
+            // keyboard input. Mouse buttons and wheel pulses come another way.
+            on == bit && (!native_mouse || !matches!(key, 0x01..=0x07 | WHEEL_UP | WHEEL_DOWN | 0x10..=0x12))

Thanks for wiring the active bindings into the prompts. One small native-mouse case worth covering: bindings.ini accepts Shift, Ctrl and Alt, but the Windows sampler reports the left/right VKs, so this filter leaves those generic bindings unsupported in native mode. For example, A = Shift should let either Shift drive A, without also firing the stock L3 binding.

A small fix is to share a binding matcher between the stand-in button resolver and the prompt builder: exact match, plus VK_SHIFT → VK_LSHIFT/VK_RSHIFT (likewise Ctrl and Alt). Use it both when evaluating custom bindings and when suppressing covered stock bindings/prompts, then allow the generic VKs through this filter. An explicitly left/right binding should still cover only that side.

I tested this approach locally in the stand-in button resolver: all six side-specific inputs produced only the custom button, and remapping just Left Shift left Right Shift's stock mapping intact. The GameInput/MnK unit tests passed (97 passed, 2 ignored).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:review-comment:4747079466 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4588#discussion_r4747079466). Originally posted by [F0RLE](https://github.com/F0RLE) on 2026-11-30T23:40:16Z. **Code review location:** `crates/victory-hle/src/modules/mnk.rs`; line 299 ~~~~diff @@ -291,11 +293,27 @@ fn bound_controls(b: &Bindings) -> Vec<(PadControl, Vec<u8>)> { PadControl::LeftStickUp, ]; let buttons = BUTTON_CONTROLS.iter().map(|&(bit, control)| { - let keys = b.buttons.iter().filter(|&&(_, on)| on == bit).map(|&(key, _)| key); - (control, keys.collect()) + let bound = b.buttons.iter().filter(|&&(key, on)| { + // The native keyboard sampler sees left/right modifiers and + // keyboard input. Mouse buttons and wheel pulses come another way. + on == bit && (!native_mouse || !matches!(key, 0x01..=0x07 | WHEEL_UP | WHEEL_DOWN | 0x10..=0x12)) ~~~~ --- Thanks for wiring the active bindings into the prompts. One small native-mouse case worth covering: `bindings.ini` accepts `Shift`, `Ctrl` and `Alt`, but the Windows sampler reports the left/right VKs, so this filter leaves those generic bindings unsupported in native mode. For example, `A = Shift` should let either Shift drive A, without also firing the stock L3 binding. A small fix is to share a binding matcher between the stand-in button resolver and the prompt builder: exact match, plus `VK_SHIFT` → `VK_LSHIFT`/`VK_RSHIFT` (likewise Ctrl and Alt). Use it both when evaluating custom bindings and when suppressing covered stock bindings/prompts, then allow the generic VKs through this filter. An explicitly left/right binding should still cover only that side. I tested this approach locally in the stand-in button resolver: all six side-specific inputs produced only the custom button, and remapping just Left Shift left Right Shift's stock mapping intact. The GameInput/MnK unit tests passed (97 passed, 2 ignored).
F0RLE commented 2026-12-01 09:59:42 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by F0RLE on 2026-12-01T09:59:42Z.

Code review location: crates/victory-hle/src/modules/mnk.rs; line 299

@@ -291,11 +293,27 @@ fn bound_controls(b: &Bindings) -> Vec<(PadControl, Vec<u8>)> {
         PadControl::LeftStickUp,
     ];
     let buttons = BUTTON_CONTROLS.iter().map(|&(bit, control)| {
-        let keys = b.buttons.iter().filter(|&&(_, on)| on == bit).map(|&(key, _)| key);
-        (control, keys.collect())
+        let bound = b.buttons.iter().filter(|&&(key, on)| {
+            // The native keyboard sampler sees left/right modifiers and
+            // keyboard input. Mouse buttons and wheel pulses come another way.
+            on == bit && (!native_mouse || !matches!(key, 0x01..=0x07 | WHEEL_UP | WHEEL_DOWN | 0x10..=0x12))

Follow-up: I opened #4627 for the input-side fix discussed here. With a binding like A = Shift, either physical Shift key triggers A without also firing the stock button. The same applies to generic Ctrl and Alt bindings. #4627 leaves the on-screen prompts unchanged.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:review-comment:4752256588 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4588#discussion_r4752256588). Originally posted by [F0RLE](https://github.com/F0RLE) on 2026-12-01T09:59:42Z. **Code review location:** `crates/victory-hle/src/modules/mnk.rs`; line 299 ~~~~diff @@ -291,11 +293,27 @@ fn bound_controls(b: &Bindings) -> Vec<(PadControl, Vec<u8>)> { PadControl::LeftStickUp, ]; let buttons = BUTTON_CONTROLS.iter().map(|&(bit, control)| { - let keys = b.buttons.iter().filter(|&&(_, on)| on == bit).map(|&(key, _)| key); - (control, keys.collect()) + let bound = b.buttons.iter().filter(|&&(key, on)| { + // The native keyboard sampler sees left/right modifiers and + // keyboard input. Mouse buttons and wheel pulses come another way. + on == bit && (!native_mouse || !matches!(key, 0x01..=0x07 | WHEEL_UP | WHEEL_DOWN | 0x10..=0x12)) ~~~~ --- Follow-up: I opened #4627 for the input-side fix discussed here. With a binding like `A = Shift`, either physical Shift key triggers A without also firing the stock button. The same applies to generic Ctrl and Alt bindings. #4627 leaves the on-screen prompts unchanged.
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/4588:upstream-pr/4588'
git switch 'upstream-pr/4588'

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/4588'
git switch 'upstream-pr/4588'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/4588'
git switch 'upstream-pr/4588'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/4588'
git switch 'main'
git merge --squash 'upstream-pr/4588'
git switch 'main'
git merge --ff-only 'upstream-pr/4588'
git switch 'main'
git merge 'upstream-pr/4588'
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!4588
No description provided.