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

Second gamepad stops working after first is disconnected #84737

Open
yhwhey opened this issue Nov 11, 2023 · 4 comments
Open

Second gamepad stops working after first is disconnected #84737

yhwhey opened this issue Nov 11, 2023 · 4 comments

Comments

@yhwhey
Copy link

yhwhey commented Nov 11, 2023

Godot version

4.1.3.stable

System information

Windows 10, Dualsense Controllers

Issue description

If the first gamepad (deviceId 0) connected to the machine is disconnected, the second controller (deviceId 1) stops registering input. However if the second controller disconnects, the first will continue to work.

Reconnecting the first controller causes only this controller to work and have the ID 1. The second controller still does not register

Steps to reproduce

  1. Connect a gamepad
  2. Connect a second gamepad
  3. Disconnect first gamepad
  4. Test second gamepad and note that it is no longer registering input

Also note that device ID for second gamepad has changed from 1 to 0 which I don't believe is or should be the intended behavior

Minimal reproduction project

test_controller_issue.zip

@Deozaan
Copy link

Deozaan commented Nov 15, 2023

I can't reproduce using the MRP on 4.1.3 on Windows 10 with an Xbox 360 and Xbox One controller connected via USB. I've annotated the output from the MRP to explain what I'm doing to produce the output:

# no devices connected
[]
# connect the first device (device 0)
[0]
# press a button
d0
# connect a second device (device 1)
[0, 1]
# press buttons on each device
d1
d0
# disconnect device 0
[1] # only device 1 remains
# press a button on device 1
d1
# reconnect device 0
[0, 1]
# press buttons on each device
d0
d1
# disconnect device 1
[0] # only device 0 remains
# press a button on device 0
d0
# reconnect device 1
[0, 1]
# press a button on both devices
d1
d0

Everything appears to be working as it should.

@Red-dog95
Copy link

I've noted similar behaviour as @yhwhey when disconnecting gamepads, I had the same issue with DualShock 4 controllers. Seems like disconnecting causes all the other gamepads to reassign a new device ID, which in my local multiplayer game then causes players 2 and 3 to control the characters for player 1 and 2 instead.

I'll see if I can test this out using Xinput gamepads instead to get the same result as @Deozaan.

@Kiveo
Copy link

Kiveo commented Oct 26, 2024

I have also run into this issue a couple times now. I specifically use PS4 controllers on my windows machine with Godot 4.3. I begin a game with only 2 controllers connected.
I have an Input.connect("joy_connected_changed", _custom_function) signal function that prints out the id and connected status of a controller. So, what I see is that device 0 gets disconnected but the print confirms that it is being specifically detected as device 1 when it is disconnected.

As @Red-dog95 commented, the device id's are being re-calculated (apparently before the device change signals get captured). Naturally, that makes persistent couch coop controls tough to work with.

@MJacred
Copy link
Contributor

MJacred commented Jan 5, 2025

@yhwhey, @Red-dog95, @Kiveo: some extra handling in that area has been added to master recently, could you please test there? I believe 4.4 dev 7 also has it

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