-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Android: Fix joypad trigger value range #81322
Merged
akien-mga
merged 1 commit into
godotengine:master
from
johnnyw:android_fix_joypad_trigger_range
Oct 20, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the switch below on
axis.range
meant to handle this exact issue already? I'm not deeply familiar with that code but I wonder why this normalisation is handled in two different locations.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also not super familiar with what's going on here, but my impression is that the private method is converting to match the
gamecontrollerdb.txt
entry, andjoy_axis
is normalizing consistently for 0.0 to 1.0. On Android and iOS we should be able to bypass this entirely for the triggers. I wasn't sure about the private method conversion so I didn't want to mess with it, so I figured using the binding as the source of truth for the trigger-specific normalization was a reliable way to get it working.Maybe the private method can branch on if it's an L/R trigger inside the switch and do the proper conversion for those specific axes only once? Because it seems like the switch in
joy_axis
is correcting an error introduced by the switch in_get_mapped_axis_event
not being specific enough.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested this and it works well and makes some sense, but I'm not sure I entirely get what you mean by this comment. Are you trying to say that you're avoiding updating
gamecontrollerdb.txt
and that it isn't configured to the right axis range? Or are you trying to say that the range is correct ingamecontrollerdb.txt
and that this PR is making sure that Godot converts from those values appropriately (which it wasn't before?)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that the
gamecontrollerdb.txt
entry is correct (I recall cross-checking across some other repos), but Godot wasn't correctly converting them specifically in the case of the triggers.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In which case then it all looks correct to me. I see that @RandomShaper has already marked it for 4.3 milestone but let's focus on getting this into 4.3/master ASAP (after 4.2 release) as it can be understandably annoying if certain controllers don't work correctly on Android. We could then introduce it as a hotfix if it checks out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, we decided to lie on the (maybe too) safe side. If you have tested it and think the changes are good, let's reschedule for 4.2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems ok for 4.2 if we merge it now so we get at least a couple betas/RCs of testing.