Here is my patch for the problem
----- Urspr?ngliche Message -----Von: Franz Schrober <@Franz_Schrober>
An: “sdl at lists.libsdl.org”
CC:
Gesendet: 22:15 Mittwoch, 26.Juni 2013
Betreff: Re: SDL_HapticOpenFromJoystick doesn’t initialize correctly on Win32
I’ve just looking through the code and found following things:
SDL_HapticOpenFromJoystick is missing:
?* haptic->index = device_index; (don’t ask me how to do it)
?* SDL_HapticSetGain
?* SDL_HapticSetAutoCenter
Windows SDL_SYS_HapticOpenFromJoystick doesn’t go through SDL_SYS_HapticOpenFromXInput. This is the reason why it cannot correctly initialize the haptic->supported and similar things done in this function (this is the only place for XInput were the supported stuff is touched)
----- Urspr?ngliche Message -----
Von: Franz Schrober <@Franz_Schrober>
An: “sdl at lists.libsdl.org”
CC:
Gesendet: 21:46 Mittwoch, 26.Juni 2013
Betreff: Re: SDL_HapticOpenFromJoystick doesn’t initialize correctly on Win32
HI,
I’ve attached an easy example program. Check out the XXX lines and try it under windows
----- Urspr?ngliche Message -----
Von: Franz Schrober <@Franz_Schrober>
An: “sdl at lists.libsdl.org”
CC:
Gesendet: 19:56 Mittwoch, 26.Juni 2013
Betreff: SDL_HapticOpenFromJoystick doesn’t initialize correctly on Win32
Hi,
I’ve detected a weird behaviour of the new haptic interface of SDL (post SDL 2.0rc1 version). I’ve tried to open the haptic interface for a joystick using SDL_HapticOpenFromJoystick and queried the capabilities using SDL_HapticQuery. I was really wondered when it returned 0. It is a Sixaxxis 3 controller running under Windows with MotionInJoy as driver in XInput mode (looks like a Xbox360 wireless controller to the OS) and I am really sure that the rumble effect works extreme well.
Then I’ve tested testrumble and noticed that also works extreme well in this program. So what is the difference? Yes, it is the call to SDL_HapticOpen. I’ve just added an SDL_HapticOpen(0) before my SDL_HapticOpenFromJoystick because I have only one haptic controller and this is also the only device (thus this call should make no difference). But funny enough, now the Query using the haptic device I got from SDL_HapticOpenFromJoystick works.
I would guess that some initialization done in SDL_HapticOpen isn’t done when calling SDL_HapticOpenFromJoystick.
Here in short from my first version:
h = SDL_HapticOpenFromJoystick(x)
SDL_Query(h) -> 0 (br0ken)
Here in short form my second version
SDL_HapticOpen(0)
h = SDL_HapticOpenFromJoystick(x)
SDL_Query(h) -> 2
And this also works but I also cannot do this im my program:
h = SDL_HapticOpen(0)
SDL_Query(h) -> 2
-------------- next part --------------
A non-text attachment was scrubbed…
Name: sdl2-1-xinput_init.patch
Type: text/x-patch
Size: 727 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130626/8a2b0002/attachment-0001.bin