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

Nintendo Switch Pro Controller doesn't work #81191

Open
miv391 opened this issue Aug 31, 2023 · 10 comments
Open

Nintendo Switch Pro Controller doesn't work #81191

miv391 opened this issue Aug 31, 2023 · 10 comments

Comments

@miv391
Copy link
Contributor

miv391 commented Aug 31, 2023

Godot version

v4.2.dev3.official [013e8e3]

System information

Godot v4.2.dev3 - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 6GB (NVIDIA; 31.0.15.3640) - Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz (4 Threads)

Issue description

Nintendo Switch Pro Controller doesn't work

Problems:

  • Input from Nintendo Switch Pro Controller is totally chaotic
  • Unplugging Nintendo Switch Pro Controller at runtime is not noticed
    • Plugging in at runtime is noticed
    • If Godot app is restarted, unplugged controlled is no more seen
    • Noticing unplugging at runtime works with other controllers, eg. Xbox360 controller (XInput controller)
Video.mp4

Nintendo Switch Pro Controller doesn't work with Godot v3.5.2.stable.official [170ba33] either.

Steps to reproduce

Connect Nintendo Switch Pro Controller and run the attached project.

Minimal reproduction project

g42_joypad.zip

@AThousandShips
Copy link
Member

@miv391
Copy link
Contributor Author

miv391 commented Aug 31, 2023

Related?

Could be very likely related. Input seems to be similarly chaotic.

My first though was that maybe Nintendo Switch Pro Controller just isn't supported by Windows (as some Bluetooth controlles are not), but as the controller works with other applications (Steam and web browsers), I guess this has something to do with Godot.

I tested controller initially wired, but it doesn't work wireless (with Bluetooth) either. I just just works differently. If wireless, controlled is detected, but no input is detected at all, compared to the chaotic input when wired. Also my PS4 controller works fine with Bluetooth.

@mieldepoche
Copy link
Contributor

your mrp works okay on my end (ubuntu, wired switch pro controller). Pluging the controller only after starting the app works too.
I do remember having problems with the pro controller on windows with bluetooth though, in other games. Though no chaotic input, so maybe unrelated.

@miv391
Copy link
Contributor Author

miv391 commented Sep 3, 2023

I'm starting to think that this a Windows issue with non-Microsoft wireless controllers. I have tested Nintendo Switch Pro Controller with both Windows 10 and 11. Yesterday on Windows 11 Nintendo Switch Pro Controller worked initially just fine. Then I started Steam and the controlled stopped working altogether. Rebooting Windows didn't help. Today the controller works fine both on Win 10 and 11. But I have also seen a situation where buttons worked but axises didn't.

So if this is not reproducible, I'll say this is a Windows issue or maybe controller's battery level was low or something.

@inhalt120g
Copy link

inhalt120g commented Sep 11, 2023

Godot on Mac OS also can't recognize Nintendo Switch controller (using the project from the first post for testing, but also if I try to remap any inputs in the IDE and the "Listening" appears, nothing is registered no matter what I press). Here is a video showing the same controller immediately after switching to the site from the first post, where it can be see that the controller is both properly recognized (in the first few seconds of the video, sorry about not managing to catch a few more seconds of that but you can still see it I hope) and that the commands are registered on screen:

2023-09-11.15.45.46.mov

Edit: forgot to mention, Godot V4.1 and controller connected via Bluetooth (but same thing when it's connected via cable too).

@mrhebisan
Copy link

I experience the same issue on MacOS M1 as described here, down to the weird interactions with Steam.

For slightly more information, I observe the following in comparison to other engines.

Wired controllers:
Godot - Chaotic values while steam is running / no values when steam isn't running
Unreal - No values
Unity - New Input System perfect input / old input system Chaotic values

Wireless controllers:
Godot - Same as wired
Unreal - Perfect input
Unity - New input system perfect input / old input system no values at all

Perhaps the Unity and Unreal have special drivers for MacOS and Pro Controllers, in the listed configurations? If so, they too are in finicky situations.

@Wolve-3DTech
Copy link

As an ex-Unity user, when i plugged my pro controller, unity printed a message in the console. The same thing occured when i unpluged it.

@jmrain
Copy link

jmrain commented Nov 25, 2023

Same issue here, figured it can't hurt to add my test results.
M1 Pro MacBook Pro with Godot 4.1.2

Switch Pro Controller wired: (videos below show this connection method)

Switch Pro Controller Bluetooth:

https://github.com/godotengine/godot/assets/140655316/656e8474-778d-40af-b915-1dacfd33fd8d
https://github.com/godotengine/godot/assets/140655316/f8c13700-249d-4dc7-ba8f-88a5600e6f64

@miv391
Copy link
Contributor Author

miv391 commented Nov 26, 2023

This is the best information what I found about the Nintendo Switch Pro Controller and Windows: https://www.pcgamingwiki.com/wiki/Controller:Nintendo_Switch_Pro_Controller

The controller is connected through DirectInput (old Microsoft API) instead of XInput (new Microsoft API), but it still doesn't work as a DirectInput controller. It can be get to work, but it needs quite lot a work. SDL has about 2300 lines of code for that: https://github.com/libsdl-org/SDL/blob/main/src/joystick/hidapi/SDL_hidapi_switch.c. Steam and web browsers probably have their own implementation for this.

I guess Godot will not get a Switch Pro Controller support unless Godot starts using SDL for game controllers.

(Disclaimer: I haven't actually tested that Pro Controller works with SDL.)

@Meorge
Copy link
Contributor

Meorge commented Dec 13, 2023

On the topic of the chaotic/random values people have noticed when plugging in the Pro Controller: I experienced this same issue with Unity's new Input System a few years back, and eventually figured it out.

https://forum.unity.com/threads/using-nintendo-switch-pro-controller.617857/#post-7714327

This repository was invaluable, and specifically this section for the input format. One of the values the controller in its report is a "timer" value which increments each time, and causes that chaotic input.

Using this information, I attempted to implement better support for the Pro Controller in Unity's Input System. Last I remember, there were some strange issues I ran into with it, and those (along with other life stuff) caused me to drop the project. These days I'm more interested in Godot, and as a result want to take a stab at seeing if I could implement these things in Godot (unless there are others who would be better suited to do it, or think there is a reason to not do it). I'd personally love to have support for things like HD Rumble and gyro controls 😉

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

9 participants