Controlify icon indicating copy to clipboard operation
Controlify copied to clipboard

[Bug] Controller Reconnection Issue

Open Dan12Aqua opened this issue 2 years ago • 2 comments

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

  • [X] Yes

Operating System

Windows

ARM

  • [ ] Yes

Additional Information

Modpack: Fabulously Optimized 5.3.3+1.20.1 (Fabric)

Just to make sure...

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

Dan12Aqua avatar Oct 09 '23 11:10 Dan12Aqua

Send logs of controlify after repeating those steps.

isXander avatar Oct 25 '23 17:10 isXander

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.

isXander avatar Nov 02 '23 23:11 isXander