Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
First attempt to fix compilation on windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbens committed Jul 31, 2008
1 parent 8e7c775 commit 96a0d42
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/haptic/win32/SDL_syshaptic.c
Expand Up @@ -83,6 +83,13 @@ struct haptic_hweffect
static LPDIRECTINPUT dinput = NULL;


/*
* External stuff.
*/
extern HINSTANCE SDL_Instance;
extern HWND SDL_Window;


/*
* Prototypes.
*/
Expand Down Expand Up @@ -141,8 +148,8 @@ SDL_SYS_HapticInit(void)

/* 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);
Expand Down Expand Up @@ -183,7 +190,7 @@ SDL_SYS_HapticName(int index)
* 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)
Expand Down Expand Up @@ -240,7 +247,7 @@ SDL_SYS_HapticOpenFromInstance(SDL_Haptic * haptic, DIDEVICEINSTANCE instance)

/* 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;
Expand All @@ -249,7 +256,7 @@ SDL_SYS_HapticOpenFromInstance(SDL_Haptic * haptic, DIDEVICEINSTANCE instance)
/* 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)) {
Expand Down Expand Up @@ -301,7 +308,8 @@ SDL_SYS_HapticOpenFromInstance(SDL_Haptic * haptic, DIDEVICEINSTANCE instance)


/* 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;
Expand Down

0 comments on commit 96a0d42

Please sign in to comment.