- Notifications
You must be signed in to change notification settings - Fork2.5k
DirectInput FFB: Calculate appropriate update flags#14570
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Draft
dwillbarron wants to merge1 commit intolibsdl-org:mainChoose a base branch fromdwillbarron:calculate-dinput-update-flags
base:main
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Anecodtally, some force-feedback wheels have been reported to experience areduced "definition", "texture", "precision", or "je ne sais quoi", whichappears to be caused by sending more update flags than necessary toDirectInput.This may be related to the fact that there are two USB PID packets that aresent when updating a device: One contains the "general" force data, and theother contains the "type-specific" data. My speculation is that many wheelsexpect to only receive the latter, and misbehave when receiving both.This has been tested and validated anecdotally by others who have receiveda hacked-together version of PCSX2 that corrects the flags sent to DirectInput,who noted a significant improvement in the "feeling" of the FFB effects.The only way to validate this at a technical level is to grab a wheel that usesthe "generic" DirectInput FFB drivers (which map nearly 1:1 with the USB PIDspecification), and inspect the USB packets (e.g. with USBPcap) to check whetherredundant data is being sent.
Collaborator
slouken commentedDec 3, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Welcome back! Offhand the code looks good. |
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi there. Same guy, different account--It's been a while, but I finally got the time to write the PR for this.
Currently in draft
Since FFB is a famously treacherous territory (hence how we got here), I'm going to try and round up some folks to test and make sure there are no unforeseen consequences to these changes.
In the meantime, if you have the time to look, please let me know if you have any feedback on the code itself.
Context
Anecodtally, some force-feedback wheels have been reported to experience a reduced "definition", "texture", "precision", or "je ne sais quoi", which appears to be caused by sending more update flags than necessary to DirectInput.
This may be related to the fact that there are two USB PID packets that are sent when updating a device: One contains the "general" force data, and the other contains the "type-specific" data. My speculation is that many wheels expect to only receive the latter, and misbehave when receiving both.
This has been tested and validated anecdotally by others who have received a hacked-together version of PCSX2 that corrects the flags sent to DirectInput, who noted a significant improvement in the "feeling" of the FFB effects.
The only way to validate this at a technical level is to grab a wheel that uses the "generic" DirectInput FFB drivers (which map nearly 1:1 with the USB PID specification), and inspect the USB packets (e.g. with USBPcap) to check whether redundant data is being sent.
Description
This PR adjusts the DirectInput Haptic implementation to compare the requested haptic update to the previous state of the haptic effect. Using this, it calculates which update flags to pass on to DirectInput, which prevents redundant flags from being sent. This appears to fix subjective FFB quality problems on certain specific FFB wheels.
Existing Issue(s)
Issue #12511: SDL_DINPUT_HapticUpdateEffect sends unnecessary flags to IDirectInputEffect_SetParameters, which harms FFB quality in certain devices/usecases