Joystick, Haptics and Windows

Hello everyone,

For the past few days I have been working with SDL_Joystick and SDL_Haptics.
For the record, I have (at the moment) 3 devices to test with:

  • XBox360
  • Logitech G27 Steering Wheel
  • Cheap, generic… err… brandless, joypad (It does have haptic support and using “joy.cpl” windows tool it does give me some rumble)

Now, for the summary of what is going on here:

I enumerate the devices and then store their names (SDL_JoystickName()). The first weird thing comes already with the name.
The XBox360 is identified as a generic device (XInput Controller #1).
The steering wheel is correctly named and the brandless one, well… as expected!

Ok, all 3 devices are identified as being Haptic devices (which is correct).
So, then, I query and try to upload the supported effects.
With the 360 controller, only the LeftRight effect is supported and it’s correctly uploaded. The effect also works (at least is seems to).
However, both the Logitech and the brandless ones return that only the LeftRight are not supported and still, none of the effects get uploaded.

Then, just out of curiosity, I added this:

Code:

SDL_SetHint(SDL_HINT_XINPUT_ENABLED, “0”);

Nothing changed for the steering wheel and the cheap controller.
However, for the 360, things are a bit different. It gets identified as a 360 controller however “SDL_JoystickIsHaptic()” returns false.

So, is there something I can do to at least make the haptic work consistently with the devices? The JoystickName() I can get away with it! :slight_smile:

Many thanks in advance

PS: I did run the testhaptic.c and results are somewhat the same as I have already stated.

Did you solve the problem? I cannot unblock my wheel g29…

Frankly, I don’t remember if I fully solved the problem.

What I remember though, is that I started digging into the controller initialization and had some success when I took that code and isolated it into a DirectInput test project.

Unfortunately I don’t have any of that code anymore as in January 2017 I lost all of my work due to HDD failing then the backup disk also failing mere 3 days later, before the replacement of the main one arrived.

Thank you for the answer. I think I have to dig sdl sources or to try to use direct input directly.

Did you try 2.0.18? A lot of work has been done on the game controller side recently that fixes a lot of issues from the past.

Hello, I use 2.0.18. But with my wheel g920 there is an error when I try to run testhaptic.c code (fail to load the sine effect as the first effect in the list)

I have a partial answer to my question. When I installed the Windows 10 SDK (it contains the directx sdk), my wheel started creating forced feedback effects. But I can’t figure out how it works because I know that Directx 12 is already installed in Windows 10. And I do not know why I get an error message after every sdl command, and these commands somehow do their job…

SDL reports existence of 3 devices.
If I set the index of dev: 0, then I get:
ERROR: Unable to create the haptic device: Haptic error Resetting device

if I set the index of dev: 1, then I get:

Uploading effects
INFO:    effect 0: Sine Wave
ERROR: UPLOADING EFFECT ERROR: Haptic error Unable to create effect