src/haptic/windows/SDL_syshaptic.c
changeset 7719 31b5f9ff36ca
parent 7708 d5aa9910b1f7
child 7845 b92b8c52946c
equal deleted inserted replaced
7718:213b9777e988 7719:31b5f9ff36ca
   749         WIN_UnloadXInputDLL();
   749         WIN_UnloadXInputDLL();
   750         loaded_xinput = SDL_FALSE;
   750         loaded_xinput = SDL_FALSE;
   751     }
   751     }
   752 
   752 
   753     for (i = 0; i < SDL_arraysize(SDL_hapticlist); ++i) {
   753     for (i = 0; i < SDL_arraysize(SDL_hapticlist); ++i) {
   754         if (SDL_hapticlist[i].name) {
   754         SDL_free(SDL_hapticlist[i].name);
   755             SDL_free(SDL_hapticlist[i].name);
   755         SDL_hapticlist[i].name = NULL;
   756             SDL_hapticlist[i].name = NULL;
       
   757         }
       
   758     }
   756     }
   759 
   757 
   760     if (dinput != NULL) {
   758     if (dinput != NULL) {
   761         IDirectInput8_Release(dinput);
   759         IDirectInput8_Release(dinput);
   762         dinput = NULL;
   760         dinput = NULL;
  1125 static void
  1123 static void
  1126 SDL_SYS_HapticFreeDIEFFECT(DIEFFECT * effect, int type)
  1124 SDL_SYS_HapticFreeDIEFFECT(DIEFFECT * effect, int type)
  1127 {
  1125 {
  1128     DICUSTOMFORCE *custom;
  1126     DICUSTOMFORCE *custom;
  1129 
  1127 
  1130     if (effect->lpEnvelope != NULL) {
  1128     SDL_free(effect->lpEnvelope);
  1131         SDL_free(effect->lpEnvelope);
  1129     effect->lpEnvelope = NULL;
  1132         effect->lpEnvelope = NULL;
  1130     SDL_free(effect->rgdwAxes);
  1133     }
  1131     effect->rgdwAxes = NULL;
  1134     if (effect->rgdwAxes != NULL) {
       
  1135         SDL_free(effect->rgdwAxes);
       
  1136         effect->rgdwAxes = NULL;
       
  1137     }
       
  1138     if (effect->lpvTypeSpecificParams != NULL) {
  1132     if (effect->lpvTypeSpecificParams != NULL) {
  1139         if (type == SDL_HAPTIC_CUSTOM) {        /* Must free the custom data. */
  1133         if (type == SDL_HAPTIC_CUSTOM) {        /* Must free the custom data. */
  1140             custom = (DICUSTOMFORCE *) effect->lpvTypeSpecificParams;
  1134             custom = (DICUSTOMFORCE *) effect->lpvTypeSpecificParams;
  1141             SDL_free(custom->rglForceData);
  1135             SDL_free(custom->rglForceData);
  1142             custom->rglForceData = NULL;
  1136             custom->rglForceData = NULL;
  1143         }
  1137         }
  1144         SDL_free(effect->lpvTypeSpecificParams);
  1138         SDL_free(effect->lpvTypeSpecificParams);
  1145         effect->lpvTypeSpecificParams = NULL;
  1139         effect->lpvTypeSpecificParams = NULL;
  1146     }
  1140     }
  1147     if (effect->rglDirection != NULL) {
  1141     SDL_free(effect->rglDirection);
  1148         SDL_free(effect->rglDirection);
  1142     effect->rglDirection = NULL;
  1149         effect->rglDirection = NULL;
       
  1150     }
       
  1151 }
  1143 }
  1152 
  1144 
  1153 
  1145 
  1154 /*
  1146 /*
  1155  * Gets the effect type from the generic SDL haptic effect wrapper.
  1147  * Gets the effect type from the generic SDL haptic effect wrapper.
  1248     return 0;
  1240     return 0;
  1249 
  1241 
  1250   err_effectdone:
  1242   err_effectdone:
  1251     SDL_SYS_HapticFreeDIEFFECT(&effect->hweffect->effect, base->type);
  1243     SDL_SYS_HapticFreeDIEFFECT(&effect->hweffect->effect, base->type);
  1252   err_hweffect:
  1244   err_hweffect:
  1253     if (effect->hweffect != NULL) {
  1245     SDL_free(effect->hweffect);
  1254         SDL_free(effect->hweffect);
  1246     effect->hweffect = NULL;
  1255         effect->hweffect = NULL;
       
  1256     }
       
  1257     return -1;
  1247     return -1;
  1258 }
  1248 }
  1259 
  1249 
  1260 
  1250 
  1261 /*
  1251 /*