diff src/haptic/win32/SDL_syshaptic.c @ 2568:5ad98a77bacb gsoc2008_force_feedback

First attempt to fix compilation on windows.
author Edgar Simo <bobbens@gmail.com>
date Thu, 31 Jul 2008 15:57:49 +0000
parents 94ff09afa478
children 806919b319d4
line wrap: on
line diff
--- a/src/haptic/win32/SDL_syshaptic.c	Thu Jul 31 11:10:52 2008 +0000
+++ b/src/haptic/win32/SDL_syshaptic.c	Thu Jul 31 15:57:49 2008 +0000
@@ -84,6 +84,13 @@
 
 
 /*
+ * External stuff.
+ */
+extern HINSTANCE SDL_Instance;
+extern HWND SDL_Window;
+
+
+/*
  * Prototypes.
  */
 static BOOL CALLBACK EnumHapticsCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext);
@@ -141,8 +148,8 @@
 
    /* Look for haptic devices. */
    ret = IDirectInput_EnumDevices( dinput,
-                                   DIDEVTYPE_ALL,
-                                   EnumJoysticksCallback,
+                                   DIDEVTYPE_DEVICE,
+                                   EnumHapticsCallback,
                                    NULL, DIEDFL_FORCEFEEDBACK | DIEDFL_ATTACHEDONLY);
    if (FAILED(ret)) {
       DI_SetError("Enumerating DirectInput devices",ret);
@@ -183,7 +190,7 @@
  * Callback to get all supported effects.
  */
 #define EFFECT_TEST(e,s)   \
-if (pei->guid == (e))   \
+if (pei->guid == (e))      \
    haptic->supported |= (s)
 static BOOL CALLBACK
 DI_EffectCallback(LPCDIEffectInfo pei, LPVOID pv)
@@ -240,7 +247,7 @@
   
    /* Open the device */
    ret = IDirectInput_CreateDevice( dinput, &instance,
-                                    guidInstance, &device, NULL);
+                                    guidInstance, &device );
    if (FAILED(ret)) {
       DI_SetError("Creating DirectInput device",ret);
       goto creat_err;
@@ -249,7 +256,7 @@
    /* Now get the IDirectInputDevice2 interface, instead. */
    ret = IDirectInputDevice_QueryInterface( device,
                                             &IID_IDirectInputDevice2,
-                                            haptic->hwdata->device );
+                                            (LPVOID *) &haptic->hwdata->device );
    /* Done with the temporary one now. */
    IDirectInputDevice_Release(device);
    if (FAILED(ret)) {
@@ -301,7 +308,8 @@
 
 
    /* Get supported effects. */
-   ret = IDirectInput_EnumEffects( DI_EffectCallback, haptic, DIEFT_ALL);
+   ret = IDirectInputDevice2_EnumEffects( haptic->hwdata->device, 
+                                          DI_EffectCallback, haptic, DIEFT_ALL );
    if (FAILED(ret)) {
       DI_SetError("Enumerating supported effects",ret);
       goto acquire_err;