Fix GameCube controller power level being reset to unknown
authorZack Middleton <zack@cloemail.com>
Wed, 19 Jun 2019 06:43:04 -0700
changeset 12893a600274d78f4
parent 12892 d171cb5b389d
child 12894 e0980413763c
Fix GameCube controller power level being reset to unknown
HIDAPI_DriverGameCube_OpenJoystick() set power level to wired and then
it was set to unknown in SDL_JoystickOpen().
src/joystick/SDL_joystick.c
     1.1 --- a/src/joystick/SDL_joystick.c	Wed Jun 19 06:40:50 2019 -0700
     1.2 +++ b/src/joystick/SDL_joystick.c	Wed Jun 19 06:43:04 2019 -0700
     1.3 @@ -323,6 +323,7 @@
     1.4      joystick->instance_id = instance_id;
     1.5      joystick->attached = SDL_TRUE;
     1.6      joystick->player_index = -1;
     1.7 +    joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN;
     1.8  
     1.9      if (driver->Open(joystick, device_index) < 0) {
    1.10          SDL_free(joystick);
    1.11 @@ -360,7 +361,6 @@
    1.12          SDL_UnlockJoysticks();
    1.13          return NULL;
    1.14      }
    1.15 -    joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN;
    1.16  
    1.17      /* If this joystick is known to have all zero centered axes, skip the auto-centering code */
    1.18      if (SDL_JoystickAxesCenteredAtZero(joystick)) {