Added SDL_HAPTIC_STATUS support to windows haptic port. gsoc2008_force_feedback
authorEdgar Simo <bobbens@gmail.com>
Wed, 06 Aug 2008 10:11:35 +0000
branchgsoc2008_force_feedback
changeset 2626 53dd30491c71
parent 2625 9bad8efcb75e
child 2627 265ced2079bd
Added SDL_HAPTIC_STATUS support to windows haptic port.
src/haptic/win32/SDL_syshaptic.c
--- a/src/haptic/win32/SDL_syshaptic.c	Wed Aug 06 09:55:51 2008 +0000
+++ b/src/haptic/win32/SDL_syshaptic.c	Wed Aug 06 10:11:35 2008 +0000
@@ -465,6 +465,9 @@
       haptic->supported |= SDL_HAPTIC_AUTOCENTER;
    }
 
+   /* Status is always supported. */
+   haptic->supported |= SDL_HAPTIC_STATUS;
+
    /* Check maximum effects. */
    haptic->neffects = 128; /* TODO actually figure this out. */
    haptic->nplaying = 128;
@@ -1231,8 +1234,17 @@
 int
 SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic, struct haptic_effect * effect)
 {
-   SDL_SetError("Haptic: Status not supported.");
-   return -1;
+   HRESULT ret;
+   DWORD status;
+
+   ret = IDirectInputEffect_GetEffectStatus(effect->hweffect->ref, &status);
+   if (FAILED(ret)) {
+      DI_SetError("Getting effect status",ret);
+      return -1;
+   }
+
+   if (status == 0) return SDL_FALSE;
+   return SDL_TRUE;
 }