src/haptic/win32/SDL_syshaptic.c
branchgsoc2008_force_feedback
changeset 2561 3696b9ce8a37
parent 2551 f010e1d4e431
child 2566 94ff09afa478
equal deleted inserted replaced
2560:2274406ba792 2561:3696b9ce8a37
   359          sizeof(struct haptic_effect) * haptic->neffects);
   359          sizeof(struct haptic_effect) * haptic->neffects);
   360    
   360    
   361    return 0;
   361    return 0;
   362    
   362    
   363    /* Error handling */
   363    /* Error handling */
   364 open_err:
       
   365    IDirectInputDevice_Release(device);
       
   366    goto creat_err;
       
   367 acquire_err:
   364 acquire_err:
   368    IDirectInputDevice2_Unacquire(haptic->hwdata->device);
   365    IDirectInputDevice2_Unacquire(haptic->hwdata->device);
   369 query_err:
   366 query_err:
   370    IDirectInputDevice2_Release(haptic->hwdata->device);   
   367    IDirectInputDevice2_Release(haptic->hwdata->device);   
   371 creat_err:
   368 creat_err:
   433  * Closes the haptic device.
   430  * Closes the haptic device.
   434  */
   431  */
   435 void
   432 void
   436 SDL_SYS_HapticClose(SDL_Haptic * haptic)
   433 SDL_SYS_HapticClose(SDL_Haptic * haptic)
   437 {
   434 {
   438    int i;
       
   439 
       
   440    if (haptic->hwdata) {
   435    if (haptic->hwdata) {
   441 
   436 
   442       /* Free the effects. */
   437       /* Free effects. */
   443       for (i=0; i<haptic->neffects; i++) {        
       
   444          if (haptic->effects[i].hweffect != NULL) {
       
   445             SDL_SYS_HapticFreeFFEFFECT( &haptic->effects[i].hweffect->effect,
       
   446                                         haptic->effects[i].effect.type );
       
   447             SDL_free(haptic->effects[i].hweffect);
       
   448          } 
       
   449       }    
       
   450       SDL_free(haptic->effects);
   438       SDL_free(haptic->effects);
       
   439       haptic->effects = NULL;
   451       haptic->neffects = 0;
   440       haptic->neffects = 0;
   452 
   441 
   453       /* Clean up */
   442       /* Clean up */
   454       IDirectInputDevice2_Unacquire(haptic->hwdata->device);
   443       IDirectInputDevice2_Unacquire(haptic->hwdata->device);
   455       IDirectInputDevice2_Release(haptic->hwdata->device);   
   444       IDirectInputDevice2_Release(haptic->hwdata->device);