Kimplul / hid-tmff2

Linux kernel module for Thrustmaster T300RS, T248 and (experimental) TX, T128 and TS-XW wheels
GNU General Public License v3.0
192 stars 20 forks source link

Race Room Racing Experience #39

Open Kimplul opened 2 years ago

Kimplul commented 2 years ago

Report in #21 about FFB in RRRE existing but being 'inverted'.

I couldn't get RRRE to launch, as it kept spewing SteamAPI_Init() failed at me with newest Proton GE, 7.0 and 6.3-8. I'll try to get the game to run, but for now this issue is mostly just an acknowledgement of the report.

ddb1024 commented 2 years ago

I tried RRRE also with the T300. And see the behavior mentioned by tperka (https://github.com/Kimplul/hid-tmff2/issues/21#issuecomment-1082474483)

after car starts it get pulled to the right and wants to stay there

Tried different Proton Versions, Settings... With ge-6.19-2 there isn't this problem but also no FFB at all.

Kimplul commented 2 years ago

Okay, I got the game to run and seems like the issue seems to be that the game uploads a periodic effect with magnitude 0, i.e. essentially just a fancy constant effect. The direction of the force is handled with the offset parameter, although curiously I can only see negative values. I'm not sure but this seems like a Proton bug to me, as I can replicate this behaviour on Windows by applying effects with the same parameters as Proton tries to feed my driver. This coupled with some autocentering probably explains the 'sticking to the right', although I'm not entirely sure what is meant by 'inverted FFB' as all FFB just sort of stops after a couple seconds for me.

tperka commented 2 years ago

Thanks for providing useful info @Kimplul. Will try to create an issue on proton-ge mentioning issues you found. You can find some details about 'inverted FFB' here: https://forum.sector3studios.com/index.php?threads/cant-drive-in-a-straight-line.7674/

Generally, it seems like it could work if instead of pulling to one side it would pull to the center as expected

Raboebie commented 2 years ago

Perhaps #46 could help you out here? Would be curious

fuzunspm commented 1 year ago

Okay, I got the game to run and seems like the issue seems to be that the game uploads a periodic effect with magnitude 0, i.e. essentially just a fancy constant effect. The direction of the force is handled with the offset parameter, although curiously I can only see negative values. I'm not sure but this seems like a Proton bug to me, as I can replicate this behaviour on Windows by applying effects with the same parameters as Proton tries to feed my driver. This coupled with some autocentering probably explains the 'sticking to the right', although I'm not entirely sure what is meant by 'inverted FFB' as all FFB just sort of stops after a couple seconds for me.

I have the same sticking to the right issue

Kimplul commented 1 year ago

Partial update: https://github.com/Kimplul/hid-tmff2/issues/47 led me to find out I had a bug in how I handled durations of effects. I've patched the issue and

all FFB just sort of stops after a couple seconds for me.

seems to also have been fixed by the patch. The game still pulls heavily to the right, but my previous observation doesn't really seem to apply anymore, as testing RRRE again today it looks like the offset is kept at a constant -1. More research is needed.

Kimplul commented 1 year ago

Also, does anyone know how you're supposed to interpret the in-game FFB meter? While driving it shows just a constant red line at the top of the graph, but while stopped it drops down to midlevel with some noise added to it, guessing engine rumble.

If the line show how much force should be applied left/right, then it seems like the game itself is calculating the constant pull to the right, but that doesn't really make sense. Haven't tried the game on Windows, so I don't really know how the graph should look like.

Kimplul commented 1 year ago

For reference, here's what happens when I try to drive, keeping the wheel more or less straight: EDIT: Correction, in the picture I'm not even moving yet, just keeping the wheel straight to prepare to start moving.

straight

Here's what happens when I stop and let go of the wheel:

not_straight

And here's a video from someone presumably running the game on Windows where you can see a normal FFB meter: https://www.youtube.com/watch?v=s3tuw4OdOo8

The FFB seems to be at least partially determined by the wheel's position, but of course I don't know the internals of the game. Could be that there's a bug in the Proton subsystem that the game tries to use, leading to nonsensical FFB calculations that are then passed on to the driver.

tperka commented 1 year ago

As mentioned here by @berarma, the game seems to be working with Logitech wheels. Could you please provide me with some tutorial on how to set up debug environment? I'm a programmer and I think I could try to help in my free time, I'm really keen to make it work in RRRE as it's my goto sim besides rFactor 2. @Kimplul

Kimplul commented 1 year ago

Debugging effects that are sent to the driver can be done through ffbwrap from here. Just add something like this in the Steam launch options:

$PATH_TO_FFBWRAP/ffbwrap --logger=/tmp/rrre /dev/input/by-id/usb-Thrustmaster_Thrustmaster_T300RS_Racing_wheel-event-joystick  -- %command%

You should see a file with all effects sent to the driver in a file starting with /tmp/rrre, followed by a timestamp.

Debugging the driver is probably best done through hid_info or pr_info or similar calls, you can run the kernel under gdb but it's a pretty complicated process and I didn't find it to be of much use when doing module-level debugging. Then you just open up dmesg -w and read whatever output shows up.

Debugging Proton is new to me as well, I know there are a number of debug flags you can give through WINEDBG, and apparently there's a winedbg program.

I'm not sure what a good starting point would be, as the effects that are sent to the device seem to make sense to me (as in, values that are sent create the effects that they should). The in-game representation of the FFB seems to go haywire, so there might be some functionality that tm_api_lib provides that the driver doesn't implement correctly or at all, or whose implementation runs into some unimplemented/buggy part of Wine, don't know. EDIT: Need to double check if RRRE uses tm_api_lib, I think it did but I can't find any proof for it. Will check later on, maybe today.

What was sort of curious last time I had a look at ffbwrap logs was that the effects weren't at a 90 degree angle, rather something like 90.3 (approximately, uint16_t: 16384 would be 90 but I read something like 16589, need to double check at some point) which I don't really understand. Could be related.

If you want to try to upload effects to the wheel yourself, try https://github.com/Kimplul/ffbsdl. It uses the SDL wrapper around Linux's native ioctl mechanism so it might not be 100% accurate, but probably a good starting point. I haven't actually looked at the source so I don't know where or if there are any discrepancies between the SDL and native interpretetation of effects.

fuzunspm commented 1 year ago

any progress about this, it's still sticking to the right

Kimplul commented 1 year ago

@fuzunspm

Not really, at least as far as I'm aware. I tried double checking my previous findings but wasn't able to launch a race, regardless of which proton version I used. Might be a temporary server issue. I'll maybe try again later, but from your comment it seems that https://github.com/Kimplul/hid-tmff2/issues/39#issuecomment-1242765056 is still about as much as I know about the issue.

Vivien-lelouette commented 10 months ago

I can confirm that the issue is still here :cry:. Does anybody managed to make the T300RS work with RRE ?

MicHaeL-MonStaR commented 2 months ago

Unfortunately the same seems to happen with the T248, in the middle of June with the current latest Proton, as well as ProtonGE (not that it needs to be Proton causing it, but just clarifying). - When I started the game initially, when in-game (on-track or in-race), the wheel would just turn in a weird pattern, but also it would not even respond to turning the wheel and the car would be steering to the right constantly. - Then I decided to just restart the game and see what happens. And while the behavior changed, it seemed to be like what is described here, that it would just pull to the right constantly and also do a short pattern, though it WOULD respond to turning the wheel. Using the "reversed" setting also didn't do anything. - I could however simply use the wheel and pedals without FFB at all, but of course that doesn't help much. So it's very much the FFB being the issue, not the inputs.

Someone's FFB-guide, who probably used it through Windows, describes that this game recognizes the T248 as the TS-PC base and that supposedly this is intentional for this wheel to have compatibility with older games. - And while it does show up that way, it doesn't really seem to help.

Not sure if this adds anything, but there's also a weird behavior where, even if you choose/activate one of the controller-profiles/presets in the settings, and then change bindings, for some reason it will just make yet another profile without choosing to make a duplicate yourself. - I'm not sure if that would happen with using any other controller (like keyboard or gamepad), but it's just weird, almost as if it sees it as a new instance of the same controller every time you re-bind anything.

I didn't think it would be such an issue with this game, as most of them seem to work in the end. - I wanted to give RR a try today, but I guess back to rFactor for now.