Skip to content
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

Firefox Does Not Recognize D-pad Inputs From Switch or PlayStation Joypads #50553

Closed
CritCorsac opened this issue Jul 17, 2021 · 13 comments · Fixed by #50567
Closed

Firefox Does Not Recognize D-pad Inputs From Switch or PlayStation Joypads #50553

CritCorsac opened this issue Jul 17, 2021 · 13 comments · Fixed by #50567

Comments

@CritCorsac
Copy link

CritCorsac commented Jul 17, 2021

Godot version

3.3.2

System information

Firefox 90.0

Issue description

Firefox is not recognizing any inputs made on the d-pad when exporting the game through HTML5. It can recognize other inputs fine except for inputs from the d-pad. This issue is present on Xbox, PlayStation and Switch joypads. This issue does not occur in Chromium. This issue does not occur in Chromium for the PlayStation joypad but it does occur for the Switch joypad. This issue does not occur in Godot 3.2.3 but is present in Godot 3.3.0 when tested in Firefox.

Upon further testing, the issue does not seem wholly exclusive to Firefox.
To sum things up...

  • Switch d-pad does not work in either Chromium or Firefox.
  • PlayStation d-pad works in Chromium but not Firefox.
  • Xbox d-pad works fine in both.

Steps to reproduce

Simply create a project that uses a joypads d-pad buttons as an input and run it in Firefox.

@CritCorsac CritCorsac changed the title Firefox Does Not Recognize D-pad Inputs From Joypads Firefox Does Not Recognize D-pad Inputs From Switch or PlayStation Joypads Jul 17, 2021
@Calinou
Copy link
Member

Calinou commented Jul 17, 2021

Can you reproduce this issue in the gamepad tester?

@CritCorsac
Copy link
Author

That website seems to detect my Switch joypad and the d-pad inputs just fine on Firefox.

I went through the versions of Godot and the issue pops up in version 3.3.0. Prior to that they work correctly. This was all tested on the latest version of Firefox.

@Faless
Copy link
Collaborator

Faless commented Jul 17, 2021

@CritCorsac Please specify what OS are you on?

See #45078 .

Might need a new mapping, or the current remap for the given OS/browser is bogus.

In any case, following instructions there you can redo the mapping, and post the generated string here so I can compare with what we have in our database.

Would also need to know if the controllers are official controller (and if not, what brand they are if possible).

@CritCorsac
Copy link
Author

I should note that the mapping for my Switch joypad has always been off, regardless of if being played in a HTML5 build or not, but even so, the d-pad would always work. I've just always worked around the incorrect mapping.

My PlayStation and Xbox are official joypads. My Switch joypad is officially licensed by Nintendo, but is not made by them.

This is the string from using my Switch joypad. The d-pad worked fine in your project (perhaps because it was exported on a version of Godot prior to 3.3.0?), but the mapping was still off (but like I said, that's always been an issue for me).

Linux20d6a713,20d6-a713-Bensussen Deutsch & Associates,Inc.(BDA) NSW Wired controller,a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:-a5,dpleft:-a4,dpdown:+a5,dpright:+a4,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Javascript

@CritCorsac
Copy link
Author

I have made a discovery!

It seems that the d-pad inputs are not being ignored, but are instead being incorrectly registered as a InputEventJoypadMotion event when certain joypads are being run in certain browsers when they should be an InputEventJoypadButton event. This seems to be causing any d-pad input setup in the input map to simply not work.

This everything I've tested so far, all done in Godot 3.3.2. I have wrote the working scenarios in bold.

Non-HTML5

  • All controllers joypad d-pad inputs are correctly being registered as an InputEventJoypadButton event and thus work as intended.

Firefox

  • PlayStation joypad d-pad inputs are incorrectly being registered as an InputEventJoypadMotion event.
  • Switch joypad d-pad inputs are incorrectly being registered as an InputEventJoypadMotion event.
  • Xbox joypad d-pad inputs are correctly being registered as an InputEventJoypadButton event.

Chromium

  • PlayStation joypad d-pad inputs are correctly being registered as an InputEventJoypadButton event.
  • Switch joypad d-pad inputs are incorrectly being registered as an InputEventJoypadMotion event.
  • Xbox joypad d-pad inputs are correctly being registered as an InputEventJoypadButton event.

I have attached a very basic minimal reproduction project, if it at all helps.
HTML5 Joypad Issue.zip

@Faless
Copy link
Collaborator

Faless commented Jul 17, 2021

The d-pad worked fine in your project (perhaps because it was exported on a version of Godot prior to 3.3.0?)

That is weird (it was exported earlier, but it already had the new system).

I've re-export both in 3.2: https://no-war.fales.me/joy_3.2/
and 3.3: https://no-war.fales.me/joy_3.3/

About the PS(which?) controller, I would likely need the mapping for that too (that could be one of the mappings we lost).

About the SNES controller, are you sure the 2 versions differs? Can you confirm it with the above links?
I know it's a tedious operation, but could you also remap with the newly exported 3.3 version (just to confirm)?.

@CritCorsac
Copy link
Author

CritCorsac commented Jul 17, 2021

Sorry. I was mistaken. With the Switch joypad, the d-pad is incorrectly being considered an InputEventJoypadMotion event in both 3.2 and 3.3 HTML5 builds.
My initial reaction was that it was working in your project simply because it recognized the d-pad input in some way, but as mentioned in my last post, I discovered it was not so much that the d-pad was being ignored, but that it was being recognized as a InputEventJoypadMotion event (which displays on the axis in your project).

The PlayStation joypad is correctly considered to be an InputEventJoypadButton event in 3.2, but not in 3.3, when exported into Firefox. Your project confirms this as it correctly maps the d-pad buttons in 3.2, but believes the d-pad to be an axis input in 3.3. However, in Chromium, the PlayStation d-pad is correctly mapped in the 3.3 version of your project.

@Faless
Copy link
Collaborator

Faless commented Jul 17, 2021

The PlayStation controller is correctly considered to be an InputEventJoypadButton event in 3.2, but not in 3.3, when exported into Firefox. Your project confirms this as it correctly maps the d-pad buttons in 3.2, but believes the d-pad to be an axis input in 3.3.

Great, then this confirms that's one of the mappings we lost in the change, if you could provide that mapping too (PlayStation Controller, 3.3 Firefox) it would be awesome.
I'll then open a PR to add them both to the database for future godot releases.

@Faless
Copy link
Collaborator

Faless commented Jul 17, 2021

(PlayStation Controller, 3.3 Firefox)

Make sure to do the mapping on Firefox (i.e. the browser where the mapping is incorrect) ;)

@CritCorsac
Copy link
Author

Here's the mapping for the PlayStation (Official DualShock 4) joypad done in Firefox from your 3.3 project.

Linux054c05c4,054c-05c4-Sony Computer Entertainment Wireless Controller,a:b0,b:b1,y:b2,x:b3,start:b9,back:b8,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Javascript

@CritCorsac
Copy link
Author

I don't know if this is worth noting or even related, but I ran your 3.3 project in Chromium with my PlayStation joypad and the label would sometimes read "Standard Gamepad Mapping standard" and sometimes read "Sony" something each time I replugged the joypad in, seemingly at random.
Whenever it read "Sony" the input mapping for the "options" button and the R3 button were incorrectly swapped, and the same for the "share" button and the L3 button. The R2 and L2 buttons were also considered an axis input and never seemed to trigger the lighting up of the R2 and L2 buttons on the image. However, when it read "Standard Gamepad Mapping standard" all inputs were accurate.

@Faless
Copy link
Collaborator

Faless commented Jul 17, 2021

I don't know if this is worth noting or even related, but I ran your 3.3 project in Chromium with my PlayStation joypad and the label would sometimes read "Standard Gamepad Mapping standard" and sometimes read "Sony" something each time I replugged the joypad in, seemingly at random.

That sounds like a chromium bug, not correctly mapping the controller sometimes.

I've opened #50567 with the new mapping, you can also test them here: https://no-war.fales.me/joy_3.x/ (where both controller should work out of the box on firefox and chrome).

@CritCorsac
Copy link
Author

I can confirm that both the PlayStation joypad and Switch joypad are correctly mapped in both Firefox and Chromium. Thank you for your effort!

@akien-mga akien-mga added this to the 3.4 milestone Jul 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants