SDL_HapticOpen not working on all computers

Hey guys! I am working on a project with a few other people and I am unable to open any haptic devices on my machine (Windows 8.1 64-bit) but others (Mostly Windows 7 64-bit) are able to.

The error I am getting is as follows:

Haptic: There are 0 haptic devices available

The code I am doing to open this is directly from the wiki:

Code:

                    SDL_Haptic *haptic;

		// Open the device
		haptic = SDL_HapticOpen(0);
		if (haptic == NULL)
		{
			printf("%s\n", SDL_GetError());
			return;
		}

		// Initialize simple rumble
		if (SDL_HapticRumbleInit( haptic ) != 0)
			return;

		// Play effect at 50% strength for 2 seconds
		if (SDL_HapticRumblePlay( haptic, 0.5, 2000 ) != 0)
			return;
		SDL_Delay( 2000 );

		// Clean up
		SDL_HapticClose( haptic );

I tried with both wired and wireless Xbox 360 controllers and the issue persists. Any ideas?[/quote]------------------------
Jake Shirley, RTIS

I tried with both wired and wireless Xbox 360 controllers and the issue
persists. Any ideas?[/quote]

(There’s a bug in the haptic code that someone mentioned to me recently
and I’m still tracking down, but…)

  • Make sure you’re on SDL 2.0.1 or later, this had serious problems in
    2.0.0 with XInput devices like these.

  • Make sure you built SDL with XInput support. Should probably Just Work
    if you built with Visual Studio, but it’s possible that Cygwin or MingW
    failed to find the DirectX headers it needs to enable it.

–ryan.