-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
[HTML5] Use internal implementation of the Gamepad API. #45078
Conversation
I really need to add the git hook for JS linting :) |
ccf549d
to
66af26d
Compare
@snougo woah, I'm so glad I found someone to make mappings on OSX. Thanks a lot 🥇 ! |
66af26d
to
8e2ad13
Compare
Added |
right now, the default setting works fine in most button on Safari, but back button/DPad button/LT/RT still can't be recognized. on FireFox the default setting still works badly and after remapping these button(select/LT/RT/rightstick pressed) still can't be recognized or will be recognized as the same joystickList int |
Oh, I see, the mapping provided above seem wrong. It's missing dpads, etc. Can you try again remapping on Safari? EDIT: Missing values are:
As mentioned, that's likely a browser issue. "Standard" gamepad are supposed to be remapped according to the specs. If the browser maps it as standard but does not follow the spec, it's a browser bug, and should be reported upstream, we can't do anything to fix that. You can also check here if the standard mapping is working correctly on Firefox, but given it doesn't in godot, it will likely be wrong there too, as other "standard" mapped controllers work fine. |
8e2ad13
to
98da835
Compare
In the core input handling code we have checks to make sure that if axis rapidly change sign we inject mid-points to release any pending inputmap action. The function though, did not correctly insert the mid-point causing dpads mapped to an axis that behaves like tri-state buttons (-1,0,1) to not be released correctly. This commit fixes that by including in the check the case where the axis swtiches from abs(1) to 0.
No longer use emscripten functions for gamepads, implement them as library functions in library_godot_display.js instead. This allows us to do a better job at "guessing" vendorId, productId, OS, etc. thus allowing us to better find the remapping for the controller.
98da835
to
bab20c6
Compare
Ready now. Also added a bunch of controllers for OSX, After a lot of testing, across different OSes and different browsers, I think this is as good as we can get. Known issues
Popular browser issue trackers: |
Thanks! |
Fixed mappings for Razer Wolverine Ultimate (XBox-style gamepad): Firefox Linux 78.7.0esr (64-bit): Chromium Linux 87.0.4280.141 (64-bit): (DOESN'T DETECT CLICKING ON "RT") Fixed mappings for iBuffalo BSGP801 classic USB gamepd (SNES-style gamepad): Firefox Linux 78.7.0esr (64-bit): Safari MacOS 14.0.2: Fixed mappings for HuiJia SNES USB adapter with original SNES gamepad: Firefox Linux 78.7.0esr (64-bit): Chrome Windows 80.0.3987.149 (64-bit): Firefox Windows 85.0 (64-bit): Firefox Mac 85.0: Safari MacOS 14.0.2: |
Firefox But on Chrome is recognized as Standard and works just fine |
MaCOSX, Google Chrome NEXT Snes controller MacOSX00790011,USB Gamepad (Vendor: 0079 Product: 0011),a:b2,b:b1,y:b0,x:b3,start:b9,back:b8,leftshoulder:b4,rightshoulder:b5,dpup:-a1,dpleft:-a1,dpdown:+a1,platform:Javascript |
This is for a PS3 Dualshock (054c:0268). It works just fine on Linux and Chrome-browsers, but has wrong mappings on Firefox. This is the correct mapping for Firefox from the Joypads Demo: This mapping string also matches the one loaded by default by SDL. |
In this PR:
No longer use emscripten functions for gamepads, implement them as library functions in
library_godot_display.js
instead.This allows us to do a better job at "guessing" vendorId, productId, OS, etc. thus allowing us to better identify the remapping needed for the attached controller (when the browser does not apply the standard remapping).
In general, browser are supposed to remap joypads to a default mapping. Browsers do that for famous controllers (official xbox/PS, usually on windows) but most others controllers have unusable mappings.
For this reason, we should start generating unique IDs for them when possible, mapping controllers like done in godotcontrollerdb.txt .
To my research, controller mapping varies per OS but not per browser (with the exception of not all browsers doing the standard remapping).
For this reason I'm asking the community to try the following demo, and if the gamepad is not recognized correctly try to remap it: https://no-war.fales.me/joy/
How to remap:
Standard Gamepad Mapping
and the ID isstandard
, it should work out of the box, if it doesn't, it's likely a browser issue, or a driver issue.Remap
button at the bottom right of the screenxbox
for now), or start theWizard
.wizard
instructions, at the last step you will be prompted with the remap string. Copy it, test that the controller now works fine (don't refresh the page!) and send it to us (e.g. here as a comment, or on IRC).Note
Some controllers will have axes values that are outside the [-1, 1] range. That's a bug in the browser, since that's not conformant with the standard, and you won't be able to remap them correctly See here:
Fixes #39253 .
Will need proper mapping for #32831