Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputHook.cpp: control bypasses not respected #3230

Closed
mninc opened this issue Mar 12, 2025 · 7 comments · Fixed by #3238
Closed

InputHook.cpp: control bypasses not respected #3230

mninc opened this issue Mar 12, 2025 · 7 comments · Fixed by #3238
Labels

Comments

@mninc
Copy link

mninc commented Mar 12, 2025

What happened?

When focus is stolen by NUI all the mouse buttons are reset, even if they shouldn't be. If your push to talk is bound to a mouse key and you are using it when focus is stolen PTT is turned off.

Expected result

PTT should remain enabled until the key is no longer pressed

Reproduction steps

  1. Set PTT to a mouse key (eg M5)
  2. Press it and keep it pressed
  3. Trigger NUI to take focus (SetNuiFocus(true, true))
  4. Observe that PTT was disabled even though the key is still pressed

Importancy

There's a workaround

Area(s)

FiveM

Specific version(s)

FiveM 13301+

Additional information

Control bypasses are used to allow PTT to be pressed while NUI is open.

I believe this bug was introduced in #3076 @tens0rfl0w

@mninc mninc added bug triage Needs a preliminary assessment to determine the urgency and required action labels Mar 12, 2025
@Mycroft-Studios
Copy link
Contributor

I fail to see how this isn't intended logic. If nui has been given focus, the game shouldn't be reciving any of that input at all, since that has been routed to the front end, if the script wanted they game to have game input, they would have set the argument for keyboard input, to false

@mninc
Copy link
Author

mninc commented Mar 12, 2025

I fail to see how this isn't intended logic. If nui has been given focus, the game shouldn't be reciving any of that input at all, since that has been routed to the front end, if the script wanted they game to have game input, they would have set the argument for keyboard input, to false

The push to talk keybind(s) explicitly bypass that logic to allow using it when nui has focus - GameInput.cpp#L1368-L1388

@Mycroft-Studios
Copy link
Contributor

That sounds incredibly stupid and not intended.
So if I'm typing into a UI, I would just be randomly talking? Or with mouse, if its a mini game, I'm just going to be constantly talking while doing it? That sounds terrible

@AvarianKnight
Copy link
Contributor

This was completely intended.

@tens0rfl0w
Copy link
Contributor

Yeah, that's indeed a regression. I already had this on my personal to-do since someone reported it on Discord earlier, but I haven't had the time to check it out yet. Reverting to the original behavior isn't a proper solution either, as stuck buttons on focus loss are also a bug.

@Pixel-Nomad
Copy link

@Pixel-Nomad
Copy link

I believe this bug was introduced in #3076 @tens0rfl0w

i read this this fix was introduced to prevent shooting when nui get focused, maybe by disabling every key we can turn off only shooting button

@github-actions github-actions bot removed the triage Needs a preliminary assessment to determine the urgency and required action label Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants