SDL/src
Sam Lantinga a21a227a87 Fixed bug 3021 - HapticOpenFromJoystick() problems
Joe Thompson

With Direct Input device (MOMO Steering Wheel w/FF)
with SDL 2.0.3,
SDL_HapticOpenFromJoystick() would fail. (Can't set exclusive mode)
Now with 2.0.4 rc1,
SDL_HapticOpenFromJoystick() succeeds but the the returned SDL_Haptic* cannot be used. Calls to SDL_HapticNewEffect() fail with "Haptic error Unable to create effect"

If SDL_HapticOpen() is used instead of HapticOpenFromJoystick(), the device is usable. Calls to HapticNewEffect() succeed with the exact same parameters as the previous failing call.

I have attached a proposed patch for this issue.

When using SDL_HapticOpenFromJoystick(), the original code did not (re)enumerate the axes. This returned a new haptic device with 0 axes. Later, when a new effect is created, SDL_SYS_SetDirection() would set the flags to include DIEFF_SPHERICAL, regardless of what the caller actually set. (see Line 566 in SDL_dinputhaptic.c). This would cause the SDL_HapticNewEffect() to fail (or interpret the coordinates incorreclty.)

The patch moves the call to IDirectInputDevice8_EnumObjects() outside of the if() block so that the axes are (re)enumerated for the new haptic device.

Note: For steering wheels it is common for the joystick to have multiple axes (ie steering, throttle, brake), but the haptic portion of the joystick usually only applies to steering.
2016-10-04 03:50:28 -07:00
..
atomic Updated copyright to 2016 2016-01-02 10:10:34 -08:00
audio Mac: Fixed whitespace around function return type. 2016-09-21 23:06:49 +02:00
core Fixed compiler warning about missing field initializers 2016-10-04 03:42:42 -07:00
cpuinfo Updated copyright to 2016 2016-01-02 10:10:34 -08:00
dynapi Added SDL_SetWindowResizable(). (thanks, Ethan!) 2016-09-29 22:52:41 -04:00
events Fixed bug 3161 - SDL_WINDOWEVENT_EXPOSED event possible queue overflow 2016-10-01 13:38:30 -07:00
file Updated copyright to 2016 2016-01-02 10:10:34 -08:00
filesystem Fixed compiling if filesystem is disabled (thanks, Elias!). 2016-08-30 21:14:13 +02:00
haptic Fixed bug 3021 - HapticOpenFromJoystick() problems 2016-10-04 03:50:28 -07:00
joystick WinRT: build fix in joystick code 2016-10-01 18:10:50 -04:00
libm Updated copyright to 2016 2016-01-02 10:10:34 -08:00
loadso Enable SDL_LoadObject on iOS 8+ and tvOS. 2016-09-25 15:02:06 -03:00
main Fixed bug 3320 - SDL_windows_main.c defines both console application entry points 2016-10-01 12:31:31 -07:00
power Initial Apple TV / tvOS support. 2016-09-13 22:18:06 -03:00
render Fixed wrong pixel format if reading pixels from OpenGL renderer. 2016-10-02 22:32:35 +02:00
stdlib Fixed potential buffer overflow in SDL_vsnprintf() (thanks, Taylor!). 2016-10-04 14:25:31 -04:00
test We should be using a string constant for the strftime format string 2016-10-01 10:38:15 -07:00
thread Fixed bug 3388 - Fail to build src/thread/windows/SDL_systhread.c on MinGW 4.9.3 2016-10-01 10:08:34 -07:00
timer threads: Move SDL's own thread creation to a new internal API. 2016-04-12 16:45:10 -04:00
video Fixed compiler warning - this should have been a const char pointer 2016-10-04 03:38:39 -07:00
SDL.c Initial Apple TV / tvOS support. 2016-09-13 22:18:06 -03:00
SDL_assert.c Updated copyright to 2016 2016-01-02 10:10:34 -08:00
SDL_assert_c.h Updated copyright to 2016 2016-01-02 10:10:34 -08:00
SDL_error.c Only use GCC pragmas when we're building with GCC 2016-10-01 11:22:39 -07:00
SDL_error_c.h Updated copyright to 2016 2016-01-02 10:10:34 -08:00
SDL_hints.c Updated copyright to 2016 2016-01-02 10:10:34 -08:00
SDL_internal.h Updated copyright to 2016 2016-01-02 10:10:34 -08:00
SDL_log.c Fixed bug 3323 - SDL_LogOutput prints message twice on Windows when linked with libc 2016-10-01 12:28:05 -07:00