ikemen-engine / Ikemen-GO

An open-source fighting game engine that supports MUGEN resources.
https://ikemen-engine.github.io
Other
751 stars 127 forks source link

Better controller support for Playstation controllers #2022

Open K4thos opened 2 months ago

K4thos commented 2 months ago

Discussed in https://github.com/ikemen-engine/Ikemen-GO/discussions/2010

Originally posted by **waspennator** September 20, 2024 ### Is your feature request related to a problem? Please describe. My Xbox series X controller seems to work alright with Ikemen GO, so I decided to try out my Dualsense and Dualshock 4 controllers and noticed some weird things. 1: For some reason the Taunt button and pause button are assigned to the right trigger and left trigger respectively. 2: The D-Pad does not move my character around, only the analog stick seems to do it. My Xbox Series X controller exhibits none of these issues, the taunt and pause buttons are assigned to the start and select buttons respectively and the D-pad works fine on there. ### Describe the solution you'd like It'd be cool if the game could know if a Playstation controller was plugged in and adjusted the taunt button, pause button, and the D-pad accordingly to work like my Xbox controller. ### Additional context Products tested: Dualshock 4 Gen 1 Controller Dualsense Controller Xbox Series X Controller ### Search terms Controller Support
waspennator commented 2 months ago

Continuing on from the discussion, tried out latest nightly and nothing seems to have changed, my dualsense (Plugged in through USB) still seems to work albeit with the same issues mentioned in the discussion post. I tested it on the latest nightly build on Windows 11. I also noticed that clicking the left stick on my dualsense makes my character jump, clicking the right stick makes them go right. I tried launching Ikemen GO through the command line and nothing seemed to pop up while going through the controller remapping process, only saw this stuff when I pressed left and right triggers.

[input_glfw.go][checkAxisForTrigger] 2.AXIS joy=0 i=3 s:-8 axes[i]=1 [input_glfw.go][checkAxisForTrigger] 2.AXIS joy=0 i=3 s:-8 axes[i]=1 [input_glfw.go][checkAxisForTrigger] 2.AXIS joy=0 i=3 s:-8 axes[i]=1 [input_glfw.go][checkAxisForTrigger] 2.AXIS joy=0 i=3 s:-8 axes[i]=1 [input_glfw.go][checkAxisForTrigger] 2.AXIS joy=0 i=3 s:-8 axes[i]=1 [input_glfw.go][checkAxisForTrigger] 2.AXIS joy=0 i=3 s:-8 axes[i]=1 [input_glfw.go][checkAxisForTrigger] 2.AXIS joy=0 i=3 s:-8 axes[i]=1 [input_glfw.go][checkAxisForTrigger] 2.AXIS joy=0 i=3 s:-8 axes[i]=1 [input_glfw.go][checkAxisForTrigger] 2.AXIS joy=0 i=4 s:-10 axes[i]=0.7857328 [input_glfw.go][checkAxisForTrigger] 2.AXIS joy=0 i=4 s:-10 axes[i]=1 [input_glfw.go][checkAxisForTrigger] 2.AXIS joy=0 i=4 s:-10 axes[i]=1 [input_glfw.go][checkAxisForTrigger] 2.AXIS joy=0 i=4 s:-10 axes[i]=1 [input_glfw.go][checkAxisForTrigger] 2.AXIS joy=0 i=4 s:-10 axes[i]=1 [input_glfw.go][checkAxisForTrigger] 2.AXIS joy=0 i=4 s:-10 axes[i]=1 [input_glfw.go][checkAxisForTrigger] 2.AXIS joy=0 i=4 s:-10 axes[i]=0.7142901

I also tried out a few other controllers I had, my Nintendo Switch Joycons seemed to pair alright to Ikemen GO (Although I might need to adjust the layout a bit), but my Nintendo Switch Pro controller seemed to outright crash Ikemen GO on launch, should I make a seperate issue for that?

Jesuszilla commented 2 months ago

I don't have Windows 11 for testing so I unfortunately cannot tell if joysticks behave any differently. It works for me on Windows 10 and macOS for both Bluetooth and USB for DualSense. Is it a Gen 1 or Gen 3? The one I have is Gen 1 I believe.

Also I found my DualShock 4 and tested on macOS and I was able to configure it but indeed it seems Windows has an issue, I'll look into it.

I'm not sure why the Pro controller would crash I.K.E.M.E.N-Go at all, does command line give any output with the crash?

waspennator commented 2 months ago

I'm presuming my controller is a gen 4, I bought it from Amazon recently.

Serial Number: V4460099611320382 Fcc id: AK8CFIZCT1B

I tried running the command line with the switch pro controller plugged in and nothing of note seemed to pop up when it crashed. I did notice that if I launched it through steam and used steam input, then I could use my controller without it crashing.

Jesuszilla commented 2 months ago

Hm, then it's possible your DualSense might be this other model I found in the GLFW source that has a space at the end of its name? I'll add smarter checking to handle that case regardless. But no output suggests that it isn't hitting 1 and that it's properly being found. Does Windows 11 still have the USB Game Controller test menu?

When investigating the DualShock 4 issue for Windows I noticed the device wasn't in USB game controllers. Which driver do I need? DS4Windows? Do you have the driver link handy?

waspennator commented 2 months ago

I think I found the option for testing game controllers, is there something you want me to check? I did notice the x rotation meter fills up when I press left trigger and y rotation for right trigger.

I didn't download any driver to get my gen 1 dualshock 4 working on my laptop. I just plugged it in and it showed up as (wireless controller)

How it looks when my Xbox series x controller is plugged in Screenshot 2024-09-24 193626

My Dualsense V4 Screenshot 2024-09-24 193734

My Dualshock 4 V1 Screenshot 2024-09-24 194250

Jesuszilla commented 2 months ago

The axes are stuck on negative for the Sony controllers but exceptions for these are made in the code so as not to interfere with the controller setup process.

Unfortunately, you said you're on Windows 11, which apparently has its own drivers for DualShock 4 controllers whereas Windows 10, my system, does not (at least, all attempts to get it to recognize the DS4 out of the box have failed). I have no plans to upgrade to Windows 11, so it seems I have no way of testing this exact scenario.

EDIT: My other roommate may have an additional DualShock 4 I can use for testing on Windows but I'll have to ask him to get it. Maybe something's wrong with the USB port on this one because even after installing DS4Windows I can't get it to show up? Odd that it worked on Mac with the same cable, though... If not, perhaps I'll ask if I can test on his system when he gets back from work.