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

DualShock 4 controller not properly supported on macOS / Apple M1 #43653

Open
riley-turben opened this issue Nov 18, 2020 · 13 comments
Open

DualShock 4 controller not properly supported on macOS / Apple M1 #43653

riley-turben opened this issue Nov 18, 2020 · 13 comments

Comments

@riley-turben
Copy link

Godot version:
Godot Engine 3.2.3.stable.official

OS/device including version:
Mac OS Big Sur 11.0.0 & 11.0.1
Apple M1 Chip
PS4 Dualshock controller (wired or wireless)

Issue description:
Controller input is not detected after the first few frames of starting the game in both the editor and the exported Mac OS build.

Steps to reproduce:

  1. Open attached reproduction project on a Mac OS Big Sur device
  2. With controller plugged in, hold down the playstation "X"/"cross" button and play the project
  3. "Hello world" should be printed in the console. If you press "X"/"cross" button again, it will not print
  4. Unplug and re-plug the controller. If you re-plug the controller while holding "X"/"cross", the console will print "Hello world" once again.

Minimal reproduction project:
Controller-bug.zip

@Calinou
Copy link
Member

Calinou commented Nov 18, 2020

Mac OS Big Sur 11.0.0 & 11.0.1
Apple M1 Chip

Unrelated to this issue, but does Godot work as expected when run via x86 emulation (Rosetta)? In this case, I need to update ThatGuySam/doesitarm#203.

@akien-mga akien-mga added this to the 4.0 milestone Nov 18, 2020
@bruvzg
Copy link
Member

bruvzg commented Nov 18, 2020

I have checked it on x86-64 macOS 11.0.1 (20B29) with Dualshock 3 - controller is detected and working normally. It's either DS4 mapping issue or it's M1 macOS issue or Rosetta issue.

Try using official demo to check what's detected - https://github.com/godotengine/godot-demo-projects/tree/master/misc/joypads and https://generalarcade.com/gamepadtool/ to generate correct mapping (and check if it's working with it or not).

Also, if it's Rosetta issue, you can try building native ARM binary or try using my build https://bruvzg.github.io/media/files/Godot_v3.2.4-beta2_osx.arm64.zip, it's ad hoc signed and not tested on real M1 hardware. I'll wait for a week or two (or for the second batch of devices, depending on reviews) before getting one.

@riley-turben
Copy link
Author

riley-turben commented Nov 19, 2020

@bruvzg Looks like it was the Rosetta issue!

I ran the official demo and had no inputs detected. Downloaded your build of godot and ran the same demo, and everything worked perfectly (aside from vibration).

@riley-turben
Copy link
Author

@Calinou It doesn't look like I'm able to force the godot application to run under rosetta emulation.

I tried going to Applications -> Godot -> Get Info and looked for the "Open using Rosetta" option, but it was not there. Do you know of another way I can check for you?

@Calinou
Copy link
Member

Calinou commented Nov 19, 2020

@riley-turben How are you running the application under Rosetta if the option isn't provided? I don't understand.

@bruvzg
Copy link
Member

bruvzg commented Nov 19, 2020

How are you running the application under Rosetta if the option isn't provided? I don't understand.

Option should be there only if it's Universal app, official Godot releases are x86-64 only and will run always run under Rosetta (and my build is ARM only and also shouldn't show any options).

@akien-mga
Copy link
Member

akien-mga commented Nov 20, 2020

@riley-turben Would you be able to test this "universal" (x86_64 + arm64) build of Godot 3.2.4 beta 2? https://downloads.tuxfamily.org/godotengine/3.2.4/beta2/Godot_v3.2.4-beta2_osx.universal.zip

It's not directly related to this issue as you already tested @bruvzg's arm64 build successfully, but this one is made on our official build containers and I'd like to validate that it works OK on Silicon. (And you might also be able to check if the "Open using Rosetta" option is available with that build.)

Note: It's not signed nor notarized, though the arm64 binary should have a dummy signature from osxcross which hopefully makes it usable with Right Click > Open.

@riley-turben
Copy link
Author

Sure thing, I'll make some time to test it tomorrow.

@riley-turben
Copy link
Author

@akien-mga I tried opening straight after unzipping, selected "Open using Rosetta", and also tried Right Click -> Open and all resulted in an error that the application was damaged.

@bruvzg
Copy link
Member

bruvzg commented Nov 21, 2020

though the arm64 binary should have a dummy signature

I have extracted arm binary from the osxcross built universal one, and seems like it's "dummy signing" do not produce valid signature. Neither do ldid, if used on any other executable manually.

Even if signing the whole bundle is not required, it's not going to work.

@bruvzg
Copy link
Member

bruvzg commented Nov 22, 2020

Some tests with simple int main() { return 0; } code:

Xcode build → 16818 bytes executable, valid signature. 16536 after stripping signature.
Xcode build, signature stripped, resigned with ldid -S FILE → 17280 bytes, not signed (invalid signature).
Xcode build, signature stripped, resigned with codesign -s - -f FILE → 34960 bytes, valid signature.

osxcross build → 33386 bytes executable, not signed (invalid signature). 32920 after stripping signature.
osxcross build, signature stripped, resigned with codesign → 51472 bytes, valid signature.

@francoisdlt
Copy link

Can confirm this bug is still present in Godot 3.2.4 RC5 on Big Sur 11.2.2 and a Dualshock 4 controller.

@akien-mga akien-mga changed the title Controller support in Mac OS Big Sur DualShock 4 controller not properly supported on macOS / Apple M1 Dec 16, 2021
@bruvzg bruvzg modified the milestones: 4.0, 4.1 Feb 27, 2023
@YuriSizov
Copy link
Contributor

If this is a Rosetta issue, what should be done on the engine side to resolve this?

@YuriSizov YuriSizov modified the milestones: 4.1, 4.x Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants