-
Notifications
You must be signed in to change notification settings - Fork 329
FIX: Xbox Controllers on macOS don't detect up-left DPAD presses (ISXB-810) #2140
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
FIX: Xbox Controllers on macOS don't detect up-left DPAD presses (ISXB-810) #2140
Conversation
ekcoh
left a comment
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.
Changes look good to me, I wonder though if this changed with some Xbox firmware update or if the backend changed behavior or if this has always been broken?
Pauliusd01
left a comment
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.
LGTM, all controls worked fine in play mode and player. Although I only had 1 controller that I checked with (1914) and only on bluetooth as wired isn't supported there natively
| [InputControl(name = "rightTrigger", format = "USHT", parameters = "normalize,normalizeMin=0,normalizeMax=0.01560998")] | ||
| [FieldOffset(11)] public ushort rightTrigger; | ||
|
|
||
| [InputControl(name = "dpad", format = "BIT", layout = "Dpad", sizeInBits = 4, defaultState = 8)] |
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.
Is there a history of this (defaultState = 8)? Why was this implemented like this in the first place? I think the change makes totally sense if this is just derived from another control.
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 didn't find any history in this.
I'm not sure this was a copy paste issue from controls such as the DualShock controllers who actualkly have default state = 8. I guess we need to wait and see if there are any Xbox controllers with such default state...
22dd02a to
f8d8270
Compare
I cannot answer if it was a firmware update and didn't find any history regarding this. But there's a chance that have might been the case. Let's monitor this. |
The default state for zero value of sticks was not being set through default state. We only set a defaultState if there's at least a control with defaultState set. Otherwise, we seem to be bypassing it. For some reason, it seems we were deriving the default state of the sticks through the parameters control have but I cannot say for sure without spending much more time on this.
This test was previously enabled for 2021 LTS only due to a bug. But the bug was already fixed so I decided to make sure this runs on all Unity versions.
cfd7623 to
f290685
Compare
Description
Fixes https://jira.unity3d.com/browse/ISXB-810.
Dpad presses for up-left were not being detected with
IsPressed()function because we always compare it against their default state first to avoid calling theEvaluateMagnitude()virtual method.On Xbox Controllers that I tested with (Xbox One Conteoller, Model 1708, Bluetooth), their default state is 0 for Dpad values. And byte value 8 was being considered as such before, which in fact corresponds to Dpad up-left presses. This PR fixes that.
Testing status & QA
@stefanunity and @Pauliusd01 could you test this issue all the Xbox controllers you can find, with both Wired and Wireless connections? Just to make sure there are no devices with a different default state for DPAD presses.
Overall Product Risks
Please rate the potential complexity and halo effect from low to high for the reviewers. Note down potential risks to specific Editor branches if any.
Comments to reviewers
There's a chance that at some point the default DPAD state was 8 but I can't really tell as I haven't used that much Xbox controllers on macOS.
I did validate that Dualshock 4 uses value 8 as the default state for DPAD.
Checklist
Before review:
Changed,Fixed,Addedsections.Area_CanDoX,Area_CanDoX_EvenIfYIsTheCase,Area_WhenIDoX_AndYHappens_ThisIsTheResult.During merge:
NEW: ___.FIX: ___.DOCS: ___.CHANGE: ___.RELEASE: 1.1.0-preview.3.After merge: