Controlify

Controlify

609k Downloads

[Bug] Controller Reconnection Issue

Dan12Aqua opened this issue ยท 2 comments

commented

Current Behaviour

Whenever I tried to reconnect my controller after turning it back on again while the game is running, it refused to do anything. It did recognize, but the controller refused to work.

Expected Behaviour

Usually, my controller is supposed to show a purple light on the indicator, all of the inputs does respond. But whenever I tried to reconnect it, it turned cyan(?), it did recognize it and the toast showed up, but none of the inputs does anything.

Screenshots

No response

Reproduction Steps

  1. Turn on Minecraft with the PS4 controller already recognized, the controller needs to be closed first
  2. After it loads, turn on the controller.
  3. Wait until the controller toast to show up
  4. Tap any keys, if it didn't respond, then it's not working

Logs

No response

Mod Version

1.6.0+1.20.1

Controller

PS4 Controller

Bluetooth

  • Yes

Operating System

Windows

ARM

  • Yes

Additional Information

Modpack: Fabulously Optimized 5.3.3+1.20.1 (Fabric)

Just to make sure...

  • I have made sure I am using the latest version of Controlify for the latest version of Minecraft.
  • I have made sure there are no other issues describing the same problem on the issue tracker.
commented

Send logs of controlify after repeating those steps.

commented

I have repeated and will put the solution here for future-me:

Cause
Currently, Controlify completely relies on GLFW callbacks for controller hotplugging/disconnecting. There is a race condition between GLFW and SDL for this. If GLFW gets there first, the SDL gamecontroller is immediately opened with the joystick index, and fails because SDL has not yet recognised the device.

Solution
Implement hotplug events with SDL if SDL is loaded. Abstract GLFW/SDL callback system.