Skip to content

Conversation

@Rainyan
Copy link
Collaborator

@Rainyan Rainyan commented Jul 27, 2025

Description

Fix #1235, #1236

We still have the problem #1237 here that the user can't assign multiple keybinds for the same command, because the latest bind will always take precedence. But that's outside the scope of this PR.

Toolchain

  • Windows MSVC VS2022

Linked Issues

Rainyan added 2 commits July 27, 2025 15:02
If the user inputs a key that has no mapping in the engine, that key
will result in BUTTON_CODE_NONE. Any UI element which the user has not
associated with a key will also map to BUTTON_CODE_NONE. Therefore,
pressing these kinds of keys (such as multimedia keys like "Volume Up")
can incorrectly trigger UI elements that are un-bound, for example the
mp3 player UI.

This change will early return for any inputs where the key code inputted
was interpreted as BUTTON_CODE_NONE.
The Neo UI elements were only bound once, but if for example the MP3
menu didn't have a bind when that bound logic ran, it would never get
associated with a key.

Instead, refresh the binds every time, so that they're always guaranteed
to be up to date, even if the user re-binds the key after it had been
bound (or was previously unbound).

We still have the problem here that the user can't assign multiple
keybinds for the same command, because the latest bind will always take
precedence.

Possibly(?) related: NeotokyoRebuild#1166
@Rainyan Rainyan added bug UI/HUD Relates to the HUD, NeoUI, menus, etc labels Jul 27, 2025
@Rainyan Rainyan requested a review from a team July 27, 2025 12:27
@Rainyan Rainyan removed bug UI/HUD Relates to the HUD, NeoUI, menus, etc labels Jul 27, 2025
@Rainyan Rainyan requested a review from a team July 27, 2025 19:46
@AdamTadeusz
Copy link
Contributor

Now that these are refreshed every time, and each of them is used in one place only, shouldn't we instead just remove the ButtonCode_t vars from the Keys struct?

@Rainyan
Copy link
Collaborator Author

Rainyan commented Jul 28, 2025

Now that these are refreshed every time, and each of them is used in one place only, shouldn't we instead just remove the ButtonCode_t vars from the Keys struct?

Probably. But this is really just a hotfix and not a refactor.

@Rainyan Rainyan merged commit 123625b into NeotokyoRebuild:master Jul 28, 2025
7 checks passed
@Rainyan Rainyan deleted the bug/none-binds branch July 28, 2025 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rebinding UI elements should work Unbound keys should not activate unbound UI elements

3 participants