Repository navigation
Fix keymapping stutter and lag - #83
Merged
Merged
Conversation
XuYicong
marked this pull request as ready for review
February 11, 2023 19:40
1 task done
Contributor
|
Been testing these changes for the past few days, everything works great so far, but there's a few noteworthy things:
|
Member
IMO before we switch to using NSEvents and fragment our input code between 2 different frameworks we should try moving GC to macOS layer |
Member
Author
Member
|
Alr thanks for looking into it 👍 |
IsaacMarovitz
approved these changes
Feb 23, 2023
Depal1
approved these changes
Feb 23, 2023
XuYicong
pushed a commit
to XuYicong/PlayTools
that referenced
this pull request
Mar 4, 2023
feat: Add SwiftLint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


Depends on #79
Fixes PlayCover/PlayCover#765
Keymapping used to stutter and lag in performance-intensive games, especially with low power mode or external mouse. This is because the event handler rountines are not given enough priority by the game. Although it's in the main thread which is the highest priority thread, games still have a preference on some jobs over others. It turns out that the way the events were delivered, which was by dispatch queue, is not treated as a top priority by Genshin Impact. The game thinks that jobs in this queue is not important and can be delayed or ignored in high load circumstances. This is the behaviour of the GameController API used. The reason it does so may be that it works in the iOS layer instead of native MacOS layer.
In this fix, keyboard and mouse event handling methods are switched from GC API to native NSEvents, which somehow is polled at a much higher frequency and priority.
By the way, I also make the cursor move to center whenever cursor is hidden. This somehow may fix some weird mouse behaviours especially in windowed mode.
Also fixed a problem where devices with low precision scroll wheel scroll too little distance.
Also turned up WASD panel sensitivity a bit so that people no longer need giant WASD in keymap.