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

Mayflash adapter and gamecube controller not working on MacOS Catalina #56475

Closed
ConnorWhalen opened this issue Jan 4, 2022 · 5 comments
Closed

Comments

@ConnorWhalen
Copy link

Godot version

3.4

System information

MacOS Catalina 10.15.7

Issue description

When connecting a gamecube controller via mayflash adapter, I am watching all joypad buttons and axes and getting this reponse:
A: button 6
B: button 8
X: button 1
Y: button 13
L: button 18 (not axis)
R: none
Z: none
Start: none
D-Pad up/down/left/right: none
Control stick up/down: axis 7
Control stick left/right: axis 2
c-stick up/down: axis 9

I also get this error constantly streaming in the console:

 main/input_default.cpp:810 - Index p_axis = 10 is out of bounds (JOY_AXIS_MAX = 10).
 main/input_default.cpp:810 - Index p_axis = 11 is out of bounds (JOY_AXIS_MAX = 10).
 main/input_default.cpp:810 - Index p_axis = 12 is out of bounds (JOY_AXIS_MAX = 10).
 main/input_default.cpp:810 - Index p_axis = 13 is out of bounds (JOY_AXIS_MAX = 10).
 main/input_default.cpp:810 - Index p_axis = 14 is out of bounds (JOY_AXIS_MAX = 10).
 main/input_default.cpp:810 - Index p_axis = 15 is out of bounds (JOY_AXIS_MAX = 10).
 main/input_default.cpp:810 - Index p_axis = 16 is out of bounds (JOY_AXIS_MAX = 10).
 main/input_default.cpp:810 - Index p_axis = 17 is out of bounds (JOY_AXIS_MAX = 10).
 main/input_default.cpp:810 - Index p_axis = 18 is out of bounds (JOY_AXIS_MAX = 10).
 main/input_default.cpp:810 - Index p_axis = 19 is out of bounds (JOY_AXIS_MAX = 10).
 main/input_default.cpp:810 - Index p_axis = 20 is out of bounds (JOY_AXIS_MAX = 10).
 main/input_default.cpp:810 - Index p_axis = 21 is out of bounds (JOY_AXIS_MAX = 10).
 main/input_default.cpp:810 - Index p_axis = 22 is out of bounds (JOY_AXIS_MAX = 10).
 main/input_default.cpp:810 - Index p_axis = 23 is out of bounds (JOY_AXIS_MAX = 10).

When i compare with Dolphin, dolphin is able to map all buttons and axes and has more expected indices (XABY are buttons 1234 respectively). I have GCAdapterDriver installed though i'm not sure how exactly it plays into dolphin and/or godot. I get this response with the adapter in PC mode and no response with it in Wii u/NS mode (for both Dolphin and Godot). I also did a quick check with a PS4 controller and it seems to work normally with the expected button and axis indices.

Any help on how to get gamecube controllers working would be much appreciated!

Steps to reproduce

This is the code i've been using to debug the issue:

# Create inputs for each controller/button/axis
func _ready():
	var input_name
	var input_event
	for controller_index in range(8):
		for button_index in range(JOY_BUTTON_MAX):
			input_name = (
				"controller_" + str(controller_index) +
				"_button_" + str(button_index)
			)
			input_event = InputEventJoypadButton.new()
			input_event.device = controller_index
			input_event.button_index = button_index
			input_event.pressed = true
			InputMap.add_action(input_name)
			InputMap.action_add_event(input_name, input_event)
		
		for axis_index in range(JOY_AXIS_MAX):
			input_name = (
				"controller_" + str(controller_index) +
				"_axis_" + str(axis_index)
			)
			input_event = InputEventJoypadMotion.new()
			input_event.device = controller_index
			input_event.axis = axis_index
			input_event.axis_value = 1.0
			InputMap.add_action(input_name + "+")
			InputMap.action_add_event(input_name + "+", input_event)
			input_event = InputEventJoypadMotion.new()
			input_event.device = controller_index
			input_event.axis = axis_index
			input_event.axis_value = -1.0
			InputMap.add_action(input_name + "-")
			InputMap.action_add_event(input_name + "-", input_event)


# Print buttons and axes being pressed
func _process(_delta):
	for controller_index in range(8):
		for button_index in range(JOY_BUTTON_MAX):
			if Input.is_action_pressed(
				"controller_" + str(controller_index) +
				"_button_" + str(button_index)
			):
				print("PRESSED " + str(controller_index) + " BUTTON " + str(button_index))
				
		for axis_index in range(JOY_AXIS_MAX):
			for sign_ in ["+", "-"]:
				if Input.is_action_pressed(
					"controller_" + str(controller_index) +
					"_axis_" + str(axis_index) + sign_
				):
					print("PRESSED " + str(controller_index) + " AXIS " + str(axis_index) + sign_)

Minimal reproduction project

No response

@Calinou
Copy link
Member

Calinou commented Jan 4, 2022

Related to #21550.

@ConnorWhalen
Copy link
Author

I did a little more work on this, if i take the _process block in my example and move it to _input i'm now picking up the d-pad at the expected indices 12-15. That said, holding them down seems to constantly fire press events so for example is_action_just_pressed("ui_up") constantly fires while the up button is held down. So they're pressing and un-pressing at a speed that causes them to appear never pressed in the _process loop.

For what it's worth i tried the test program in #21550 and got the same results i'm seeing in mine. So gc controllers are behaving different for me than they are for that user.

@ConnorWhalen
Copy link
Author

ConnorWhalen commented Jan 5, 2022

I have a little bit more figured out:

If i plug the controller into the 4 controller slots, it reports different buttons and axes for everything but the d-pad, which uses the same 12-15. That combined with the "out of range" axes and some buttons not showing at all makes me think godot is interpreting the adapter as one big controller where buttons on all 4 controllers control inputs on "controller 0".

I'm also noticing that the GCAdapterDriver specifically says to operate in Wii u/NS mode, but i don't get any response in dolphin or godot when on that setting. When i set it to PC mode dolphin (and openemu) works fine but godot behaves like this. Not sure if it's a godot issue or a driver issue honestly

@ConnorWhalen
Copy link
Author

I've figured it out! I fixed it by downloading the latest firmware from mayflash (https://www.mayflash.com/Support/showdownload.php?id=91). I was on version 5 but there's a version 6. My controller is now in the state described in #21550 which makes me think it's an issue with the mayflash firmware rather than godot

@akien-mga
Copy link
Member

Thanks, closing as duplicate of #21550 then for the remaining issue.

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

4 participants