equal
deleted
inserted
replaced
906 int |
906 int |
907 SDL_SYS_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect * effect, |
907 SDL_SYS_HapticNewEffect(SDL_Haptic * haptic, struct haptic_effect * effect, |
908 SDL_HapticEffect * base) |
908 SDL_HapticEffect * base) |
909 { |
909 { |
910 HRESULT ret; |
910 HRESULT ret; |
911 REFGUID type; |
911 |
|
912 /* Get the type. */ |
|
913 REFGUID type = SDL_SYS_HapticEffectType(effect); |
|
914 if (type == NULL) { |
|
915 goto err_hweffect; |
|
916 } |
912 |
917 |
913 /* Alloc the effect. */ |
918 /* Alloc the effect. */ |
914 effect->hweffect = (struct haptic_hweffect *) |
919 effect->hweffect = (struct haptic_hweffect *) |
915 SDL_malloc(sizeof(struct haptic_hweffect)); |
920 SDL_malloc(sizeof(struct haptic_hweffect)); |
916 if (effect->hweffect == NULL) { |
921 if (effect->hweffect == NULL) { |
917 SDL_OutOfMemory(); |
922 SDL_OutOfMemory(); |
918 goto err_hweffect; |
|
919 } |
|
920 |
|
921 /* Get the type. */ |
|
922 type = SDL_SYS_HapticEffectType(effect); |
|
923 if (type == NULL) { |
|
924 goto err_hweffect; |
923 goto err_hweffect; |
925 } |
924 } |
926 |
925 |
927 /* Get the effect. */ |
926 /* Get the effect. */ |
928 if (SDL_SYS_ToDIEFFECT(haptic, &effect->hweffect->effect, base) < 0) { |
927 if (SDL_SYS_ToDIEFFECT(haptic, &effect->hweffect->effect, base) < 0) { |
976 DIEP_TRIGGERBUTTON | |
975 DIEP_TRIGGERBUTTON | |
977 DIEP_TRIGGERREPEATINTERVAL | |
976 DIEP_TRIGGERREPEATINTERVAL | |
978 DIEP_TYPESPECIFICPARAMS; |
977 DIEP_TYPESPECIFICPARAMS; |
979 |
978 |
980 /* Create the actual effect. */ |
979 /* Create the actual effect. */ |
981 ret = IDirectInputDevice2_SetParameters(effect->hweffect->ref, &temp, flags); |
980 ret = IDirectInputEffect_SetParameters(effect->hweffect->ref, &temp, flags); |
982 if (FAILED(ret)) { |
981 if (FAILED(ret)) { |
983 DI_SetError("Unable to update effect",ret); |
982 DI_SetError("Unable to update effect",ret); |
984 goto err_update; |
983 goto err_update; |
985 } |
984 } |
986 |
985 |