Separate joystick power state into battery status and percentage
This allows you to see battery percentage while the controller is charging
This commit is contained in:
parent
5e624c2083
commit
8847b35244
42 changed files with 596 additions and 1001 deletions
|
@ -1517,6 +1517,13 @@ static int HIDAPI_JoystickOpen(SDL_Joystick *joystick, int device_index)
|
|||
return SDL_SetError("HIDAPI device disconnected while opening");
|
||||
}
|
||||
|
||||
/* Set the default connection state, can be overridden below */
|
||||
if (device->is_bluetooth) {
|
||||
joystick->connection_state = SDL_JOYSTICK_CONNECTION_WIRELESS;
|
||||
} else {
|
||||
joystick->connection_state = SDL_JOYSTICK_CONNECTION_WIRED;
|
||||
}
|
||||
|
||||
if (!device->driver->OpenJoystick(device, joystick)) {
|
||||
/* The open failed, mark this device as disconnected and update devices */
|
||||
HIDAPI_JoystickDisconnected(device, joystickID);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue