ValveSoftware / Proton

Compatibility tool for Steam Play based on Wine and additional components
Other
24.38k stars 1.07k forks source link

Steering Wheel Force Feedback broke in 4.11-7 (blanket issue) #3194

Closed flukejones closed 4 years ago

flukejones commented 4 years ago

It appears there are a number of games where this is confirmed. It may not be specific to the Logitech G29, this is the only wheel I have to confirm with. Examples:

leillo1975 commented 4 years ago

I can confirm it everything

alasky17 commented 4 years ago

Thank you for the tracking issue. As a note for tracking purposes, I was able to narrow down the FF breakage with my wheel (older logitech Driving Force wheel, not G29) to somewhere between 4.11-3 and 4.11-4. I am working on finding the exact cause and getting a fix. I know that 4.11-3 and 4.11-4 are not currently public, so this would be hard for y'all to test, but I'm hoping that I am on the right track.

Also, just wanted you to know that we hear you :) I used Project Cars and F1 2019 to confirm that I am tracking the wider issue, not a game-specific issue.

aeikum commented 4 years ago

I've made a change that fixes this regression for @alasky17's setup. It will be in the next Proton build for you all to test.

leillo1975 commented 4 years ago

I've made a change that fixes this regression for @alasky17's setup. It will be in the next Proton build for you all to test.

Can't wait to test it with the new Logitech Wheel Driver: https://www.reddit.com/r/linux_gaming/comments/dypf2q/newlg4ff_a_much_more_complete_new_driver_for_our/

flukejones commented 4 years ago

Looks like it's fixed @aeikum. Thank you for your work.

leillo1975 commented 4 years ago

@aeikum , I'm sorry to say that FFB is not completely fixed. Using the new-lg4ff with games like rFactor 1 and 2 (this games don't work with the kernel driver, because don't use constant force ), and others, with 4.11-8 don't work, but with 4.11-9 the effects are very weak, like if FFB gain is at 10%. If you use Wine or Proton 4.2 the effects are strong and normal. I could see that using Proton-GE ( @GloriousEggroll ) a few days ago the same thing happens, very weak effects.

aeikum commented 4 years ago

Thanks for reporting and retesting, @flukejones .

Interesting, @leillo1975 . Not a lot has changed with FFB since 4.2. Can you attach a log with 4.11-9 and +dinput,+plugplay,+hid added to the debug channels here? If it's not too much trouble, a similar log with 4.2 would also be helpful. Let me know if you need more instruction than that.

leillo1975 commented 4 years ago

I need more instruction to get this logs.

aeikum commented 4 years ago

Sure thing. The easiest way to do this is to set the Launch Options in Steam to WINEDEBUG=+dinput,+plugplay,+hid,+tid %command% and then run the game. This will create a log file in your Home directory called steam-<a bunch of numbers>.log. You can upload that file here by dragging it into the comment text box.

After you have gathered the log, just empty out the launch options dialog box to go back to normal.

leillo1975 commented 4 years ago

Thanks, I will do it this night, when I get home. If any other user can upload one log before, will be welcomed.

leillo1975 commented 4 years ago

This is the log of rFactor 2 (it feels very weak comparing with Wine):

steam-365960.zip

This one is for the first rFactor (more strong FFB but a lot of missing effects if you compare with Wine, for example, when you crash you don't feel nothing): Mega Link

flukejones commented 4 years ago

So far I've tested:

Great strong FFB

Issues

leillo1975 commented 4 years ago
* Project Cars, centering force in menus works fine and can be adjusted, but no effects in-game. (I'll get logs when I can get some time later)

I can get FFB both Proton 4.2-9 and Proton 4.11-9

leillo1975 commented 4 years ago

Another game, Automobilista, has missing effects when you use Proton 4.11-9. With Wine 4.13 you feel, for example the wall crashes: steam-431600.zip

flukejones commented 4 years ago
* Project Cars, centering force in menus works fine and can be adjusted, but no effects in-game. (I'll get logs when I can get some time later)

I can get FFB both Proton 4.2-9 and Proton 4.11-9

Is there some sort of setting to be toggled? I started with a fresh game from a fresh install. Also tried 4.2-9, 4.11-9, and 4.20GE-1. Seems like I get no FFB at all. Except center force in menus.

berarma commented 4 years ago

I'm attaching a different log from rFactor2 with default FF settings in case it might help give us a hint at what's wrong. I've made this log using https://github.com/berarma/ffbtools. It preloads a library that catches Linux API FF calls and logs them, thus it logs information about what goes to the FF driver at the low level.

I've noticed the FF levels are pretty low and they seem to clip at -10000/10000 while the full range is -32768/32767. I have a Logitech G29. Values below 3000 are too weak to even move the wheel, and values between 3000-4000 move it very slightly.

rf2-20191128233317.log.gz

berarma commented 4 years ago

Being as curious as I am I couldn't help but take a peek at the code.

The games with problems use periodic sine effects to play constant effects by just using the offset parameter of the periodic effect. I've found some parameters aren't correctly calculated from their Windows ranges.

Magnitude has a range -10000:10000 (Windows) vs -32768:32767 (Linux). This one is correct. Offset has a range -10000:10000 (Windows) vs -32768:32767 (Linux). This range is NOT corrected. Phase has a range 0:35999 (Windows) vs 0:65535 (Linux). This range is NOT corrected.

The corresponding Wine code seems to apply the right calculations.

References: https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ee416634(v%3Dvs.85) https://github.com/ValveSoftware/wine/blob/b83f9e037077e84bef04735276596fddaadf51db/dlls/dinput/effect_sdl.c#L569 https://source.winehq.org/git/wine.git/blob/HEAD:/dlls/dinput/effect_linuxinput.c#l641

Edit: The phase range is indeed correct because it's using SDL2 and it uses the same range as Windows.

berarma commented 4 years ago

I think I've found the problem related to the effects getting mutted. It seems the global gain is set incorrectly here:

https://github.com/ValveSoftware/wine/blob/b83f9e037077e84bef04735276596fddaadf51db/dlls/dinput/joystick_sdl.c#L712

The gain is being changed but the value sent to the device is the old gain value. I think it's a confusion when trying to keep all variable definitions at the start of the block while trying to initialize them at the same time.

I think this might be the reason some games loose the FF when going from the menus to the car and back.

berarma commented 4 years ago

The bugs above affect rFactor2 for sure, and I think also rFactor1, Race07, Automobilista and others.

I've tried to debug another problem that affects Project Cars 2 and maybe others where the direction of the effect is sent in the vertical axis and thus it's not played. I can't find the information I need in the logs because the effect is dumped before the flags are modified by the code, thus it doesn't show information about the axis.

Here is the dump call where no axis information is dumped:

https://github.com/ValveSoftware/wine/blob/b83f9e037077e84bef04735276596fddaadf51db/dlls/dinput/effect_sdl.c#L430

And later the flags are changed and the axes information is used:

https://github.com/ValveSoftware/wine/blob/b83f9e037077e84bef04735276596fddaadf51db/dlls/dinput/effect_sdl.c#L455

I see Wine does something differently here when the effect has one axis:

https://source.winehq.org/git/wine.git/blob/HEAD:/dlls/dinput/effect_linuxinput.c#l513

This code seems to use the direction value to change the sign of the force in the X axis when there's only one axis. That makes sense but @leillo1975 tells me PC2 doesn't have FF in wine neither, so this code might still be doing something wrong.

Solving the three issues I've described here would fix FF on most games, expcept perhaps Dirt Rally 2 where there seems to be a highly specific bug where all effects get removed at one point in the game.

berarma commented 4 years ago

As a side note, I'm testing with a Logitech G29 wheel but I'm using a heavily modified Linux module driver that allows Logitech wheels to play most effects, not only constant force (https://github.com/berarma/new-lg4ff).

Anyone testing with a Logitech wheel and the default Linux driver might not get the FF effects playing even when they're correctly sent to the Linux API, unless it's a Logitech G920. This wheel implements the effects in firmware and should play them all.

berarma commented 4 years ago

I've created a PR with all the suggested changes: ValveSoftware/wine#70

aeikum commented 4 years ago

The PR was merged in 4.11-10. Shall we close this?

berarma commented 4 years ago

I think all games mentioned in this ticket now have working FFB, except DR2 which seems to be affected by a very specific problem. At least the ones I've tested (rFactor1, rFactor2). @leillo1975, can you confirm all these games work except DR2?

We may close this ticket and track the DR2 issue in its own ticket.

Thanks @aeikum.

leillo1975 commented 4 years ago

Project Cars , Project Cars 2 and Kartkraft has again FFB with Proton 4.11-10. In this games using new-lg4ff now we have a great FFB: -Automobilista -rFactor -rFactor 2 -RACE 07 -GT Legends

Dirt Rally 2 still needs ffbtools with "--update-fix"

Wreckfest has the same problem that using 4.11-9, If total degrees are a segment, the center is in 80% of this segment instead of 50%. With Proton 4.2 the game works great

kisak-valve commented 4 years ago

Thanks for retesting @berarma, @leillo1975 and mentioning the followup issues on the game's compatibility reports.

Closing as fixed in Proton 4.11-10.