Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HapticOpenFromJoystick() problems in 2.0.4 #1892

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

HapticOpenFromJoystick() problems in 2.0.4 #1892

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.1
Reported for operating system, platform: Windows 7, x86_64

Comments on the original bug report:

On 2015-06-16 04:07:37 +0000, Joe Thompson wrote:

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.

On 2015-06-16 05:04:10 +0000, Ryan C. Gordon wrote:

Assigning Edgar's bugs to me.

--ryan.

On 2016-05-28 14:59:42 +0000, Joe Thompson wrote:

Created attachment 2470
Proposed patch for 3021

On 2016-05-28 15:15:05 +0000, Joe Thompson wrote:

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.

Joe

On 2016-07-30 21:21:15 +0000, Joe Thompson wrote:

I edited the title of this bug to reflect the fact that the issue is not isolated to the Release Candidate.
Cheers,
Joe

On 2016-08-10 06:50:39 +0000, Mathieu Laurendeau wrote:

I ran into the same issue with a Logitech Driving Force GT wheel.
The proposed patch fixes it.

On 2016-10-04 18:42:20 +0000, Sam Lantinga wrote:

Fixed, thanks!
https://hg.libsdl.org/SDL/rev/ac6a748250f4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant