diff src/haptic/win32/SDL_syshaptic.c @ 2626:53dd30491c71 gsoc2008_force_feedback

Added SDL_HAPTIC_STATUS support to windows haptic port.
author Edgar Simo <bobbens@gmail.com>
date Wed, 06 Aug 2008 10:11:35 +0000
parents 6deba05725ac
children 43a0416b3707
line wrap: on
line diff
--- 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;
 }