Disconnecting then reconnecting a controller twice will break the controller support.
On handled devices it mean that PICO-8 will effectively lock the device if you put it it sleep mode twice in the same session.
I reproduced this behavior successfully on the windows, linux and raspberry pi versions.
Fixed for 0.2.2, thanks.
This was caused by a simple gotcha in SDL2 that is documented but easy to miss -- for anyone googling:
The SDL_ControllerDeviceEvent "which" field has a different meaning depending on the event:
SDL_CONTROLLERDEVICEADDED .which is the joystick index (always 0..SDL_NumJoysticks()-1)
SDL_CONTROLLERDEVICEREMOVED .which is the instance_id. Grab via SDL_JoystickInstanceID(joystick) or SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(controller)) while still plugged in.
[Please log in to post a comment]