JoyShockLibrary
JoyShockLibrary copied to clipboard
How To Check If Controller Is Disconnected?
Hey again,
I've got everything working great except one thing: how do we check if a controller is disconnected? Right now I'm calling JslConnectDevices() and JslGetConnectedDeviceHandles() every frame to see if there have been any changes to the device. However, this seems to cause problems with the DS4 lightbar, as each time I call those functions the color gets turned off.
Basically I'm looking for a way to call something like JslIsControllerActive(int deviceID), and if that returns false I'll call JslConnectDevices and JslGetConnectedDeviceHandles to find a new device.
Thanks, this library is super awesome!!
Michael
Hi Michael! Thanks for checking it out. It's best not to be reconnecting every frame, but you could have a time-out on your end. If the call-back for a particular device hasn't been called for too long, then do the reconnecting.