src/joystick/windows/SDL_windowsjoystick.c
changeset 9433 bd062398b648
parent 9380 07b7c1005a23
child 9619 b94b6d0bff0f
     1.1 --- a/src/joystick/windows/SDL_windowsjoystick.c	Tue Mar 24 03:24:57 2015 -0400
     1.2 +++ b/src/joystick/windows/SDL_windowsjoystick.c	Tue Mar 24 13:52:01 2015 -0400
     1.3 @@ -460,7 +460,6 @@
     1.4  
     1.5      /* allocate memory for system specific hardware data */
     1.6      joystick->instance_id = joystickdevice->nInstanceID;
     1.7 -    joystick->closed = SDL_FALSE;
     1.8      joystick->hwdata =
     1.9          (struct joystick_hwdata *) SDL_malloc(sizeof(struct joystick_hwdata));
    1.10      if (joystick->hwdata == NULL) {
    1.11 @@ -480,13 +479,13 @@
    1.12  SDL_bool 
    1.13  SDL_SYS_JoystickAttached(SDL_Joystick * joystick)
    1.14  {
    1.15 -    return !joystick->closed && !joystick->hwdata->removed;
    1.16 +    return joystick->hwdata && !joystick->hwdata->removed;
    1.17  }
    1.18  
    1.19  void
    1.20  SDL_SYS_JoystickUpdate(SDL_Joystick * joystick)
    1.21  {
    1.22 -    if (joystick->closed || !joystick->hwdata) {
    1.23 +    if (!joystick->hwdata || joystick->hwdata->removed) {
    1.24          return;
    1.25      }
    1.26  
    1.27 @@ -497,8 +496,7 @@
    1.28      }
    1.29  
    1.30      if (joystick->hwdata->removed) {
    1.31 -        joystick->closed = SDL_TRUE;
    1.32 -        joystick->uncentered = SDL_TRUE;
    1.33 +        joystick->force_recentering = SDL_TRUE;
    1.34      }
    1.35  }
    1.36  
    1.37 @@ -512,10 +510,7 @@
    1.38          SDL_DINPUT_JoystickClose(joystick);
    1.39      }
    1.40  
    1.41 -    /* free system specific hardware data */
    1.42      SDL_free(joystick->hwdata);
    1.43 -
    1.44 -    joystick->closed = SDL_TRUE;
    1.45  }
    1.46  
    1.47  /* Function to perform any system-specific joystick related cleanup */