fix(input/five): DirectInput mouseDev unacquire #3072
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Goal of this PR
Currently, when using DirectInput as the input method for the mouse, mouse inputs are still passed through to the game, even when an overlay such as a NUI or the client console is focused. This results in unintended user interactions with the game.
How is this PR achieving the goal
This PR hooks into the
recaptureLostDevices
function, which re-acquires a DirectInput mouse device that has lost focus, to block execution of the function when the game has no focus. Additionally, it un-acquires the game's DirectInput mouse device by directly accessing its memory address and invokingUnacquire
on the object when a focus switch is invoked.This PR applies to the following area(s)
FiveM
Successfully tested on
Game builds: 2060, 2699, 3258, 3407
Platforms: Windows (Client)
Checklist
Fixes issues
fixes #1010