hid-tmff2 icon indicating copy to clipboard operation
hid-tmff2 copied to clipboard

Windows drivers inside prefix

Open Raboebie opened this issue 1 year ago • 50 comments

I know this will sounds a bit strange but I have been able to reproduce this on multiple occasions.

I recently acquired F1 22 and it did not recognize my wheel no matter what I did. Eventually I gave up assuming it was a game issue.

A few days later I noticed a post on vales proton bug tracker about someone who installed the windows drivers inside the prefix and then the wheel was detected and mapped correctly on startup. I was pretty sure it won’t do anything, knowing wine has massive limitation when it comes to driver support, but it did. The wheel is detected and works perfectly.

I then decided to test other titles such as ams2 and acc. With both titles the games did not recognize my previous configuration and I had to recalibrate everything. What really surprised me is that the feel of the wheel and especially the pedals changed a lot after installing the drivers. I race daily and I have very fine settings I always keep, but this changed it quite significantly. Can’t really say if it’s for better or worse but the pedals do provide more depth or range of motion for sure.

Could you shed some light on this perhaps? I honestly feel like this should not have done anything yet it made a big difference.

Raboebie avatar Jul 28 '22 17:07 Raboebie

I wouldn't be surprised if the driver also installs some registry keys or something along those lines at the same time, and the games check for their existence and change their behaviour based on it. This is actually something that was brought up earlier this summer and I'm intending to take a look at it, but haven't managed to do so yet.

Interesting that the driver even installs under Wine though, but pretty cool. I might add a note about it in the README.

EDIT: Just to clarify, I don't think the Windows driver itself works under Wine, rather that games detect a device that might be a T300 RS, but there's no registry key for it so its ignored. After the driver is installed, the registry key exists, and the game starts working. The Linux driver is most likely still needed.

Maybe, as I said I haven't looked into it but this is my working theory.

Kimplul avatar Jul 28 '22 17:07 Kimplul

t looked into it but this is my working theory.

Thanks for the inputs. That is what I thought may be happening but it's cool that it works non the less.

Raboebie avatar Jul 29 '22 06:07 Raboebie

Did some quick digging and found these reg keys that the driver creates. Interesting that it says T500RS there. I obviously have a T300RS. I don't know what that binary data means but I think the directory ones it creates may be what makes it tick.

1 2

Raboebie avatar Jul 29 '22 06:07 Raboebie

Could be worth trying to write a script that automatically inserts those keys into a prefix and checking if that has an effect on games?

Kimplul avatar Jul 29 '22 06:07 Kimplul

That's a good idea. I'll give that a go a bit later.

On Fri, Jul 29, 2022 at 8:48 AM Kimplul @.***> wrote:

Could be worth trying to write a script that automatically inserts those keys into a prefix and checking if that has an effect on games?

— Reply to this email directly, view it on GitHub https://github.com/Kimplul/hid-tmff2/issues/46#issuecomment-1198938559, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGCYYWPZYEE2DN4QHG4XJDVWN5ELANCNFSM546ANIZQ . You are receiving this because you authored the thread.Message ID: @.***>

Raboebie avatar Jul 29 '22 06:07 Raboebie

@Kimplul So before I tried scripting anything I figured I needed to figure out if it actually uses the files in the Thrustmaster folder and turns out, if I remove/move the drivers folder inside Thrustmaster (in Program Files) the wheel is no longer detected. So it's actually using something in the drivers folder to make the wheel work. This is the contents of the folder. I have no idea how to check what files wine is using when running.

image

Raboebie avatar Jul 29 '22 09:07 Raboebie

Good thinking. I'm guessing .inf could be the main point of interest here, but try removing stuff individually until something breaks. The binary data in the regkey could also be a hash of some kind of the folder, and anything missing could trigger an error state.

Kimplul avatar Jul 29 '22 09:07 Kimplul

I see, I'll give that a go. I did find this in the logs

11041.496:0150:01c4:trace:unwind:RtlCaptureStackBackTrace captured 1 frames 11041.505:0150:0384:fixme:dinput:dinput_device_Escape iface 0000000013AD0050, escape 000000004BA4EB60 stub! 11041.516:0150:01c4:trace:loaddll:free_modref Unloaded module L"C:\windows\system32\XInput9_1_0.dll" : builtin 11041.516:0150:01c4:trace:loaddll:free_modref Unloaded module L"C:\Program Files\Thrustmaster\FFB Racing wheel\tmsdk\tm_api_lib_x64.dll" : native 11041.517:0150:01c4:trace:seh:sigsys_handler SIGSYS, rax 0x8d, rip 0x1459a0e66. 11041.517:0150:01c4:trace:seh:sigsys_handler SIGSYS, rax 0x8d, rip 0x14bd6c90c. 11041.517:0150:01c4:err:ole:CoUninitialize Mismatched CoUninitialize 11041.517:0150:01c4:trace:loaddll:free_modref Unloaded module L"Z:\home\dihank\RAID\SteamLibrary\steamapps\common\F1 22\CM.Windows.Gaming.Input.dll" : native

Seems like it's directly loading tm_api_lib_x64.dll

trace:loaddll:build_module Loaded L"C:\Program Files\Thrustmaster\FFB Racing wheel\drivers\amd64\tmInstall.EXE" at 0000000100000000: native

UPDATE: It loads both the libraries every time the game is started. Switching the wheel to PS4 mode it's not detected by oversteer or Linux in general but when I start the game it detects it as a Xbox controller. Very odd

Raboebie avatar Jul 29 '22 09:07 Raboebie

Interesting, we ran into tm_api_lib_x64.dll before as well: https://github.com/Kimplul/hid-tmff2/issues/37

I didn't know it was a generic library, I thought it was just related to Automobilista but if several games use it then it might be best to just add a note to the README about installing the Thrustmaster drivers in prefixes. I'm not a lawyer, but I'm fairly certain redistributing a binary is a no-no.

Or just reverse-engineer it and add in stub functions, but I suspect that might be a bit excessive.

Kimplul avatar Jul 29 '22 09:07 Kimplul

UPDATE: It loads both the libraries every time the game is started. Switching the wheel to PS4 mode it's not detected by oversteer or Linux in general but when I start the game it detects it as a Xbox controller. Very odd

I suspect that's because the Linux driver supports PS4 mode, and Proton just passes it through to the games. Windows has no support for PS4 mode at all, from what I can remember, so I suspect the games/libraries don't really know what to do with it. PS4 is detected under a separate USB ID from the PS3 version, so it's essentially a completely 'different' product.

EDIT: Missed the parts about Linux and Oversteer. PS4 mode seems to be missing from wheel_ids.py in Oversteer so it isn't detected, but the Linux bit is weird.

Kimplul avatar Jul 29 '22 09:07 Kimplul

Yeah agreed.

So as a final test I decided to remove your driver completely so its detected by the built in driver with no FFB. When running the game the weel is still detected correctly and all my mappings are still present but there is no FFB. So this confirms that it's looking for something to load which identifies the wheel rather than using the windows driver itself.

tm_api_lib_x64.dll can be found in the root directory of F1 22 as well. Plenty of games seem to ship this as default.

Raboebie avatar Jul 29 '22 09:07 Raboebie

d add in stub functions, but I suspect that might be a bit excessive.

I think it could be fair to add something in the readme that some games require you to have to Windows drivers install in the prefix for it to be detected I guess. Yeah I don't think we need a lawyer for that one.

Raboebie avatar Jul 29 '22 09:07 Raboebie

Added a note about it in the README. I might add some instructions for the driver installation later.

Really glad you brought this up, but sort of unfortunate that people will potentially have to run a driver installer in each prefix separately. I wonder if there's some way to automate the setup?

Kimplul avatar Jul 29 '22 09:07 Kimplul

I'm not a copy write expert but the driver can be silently installed and pulled with wget perhaps but since every stream game gets it's own prefix this may be a bit tricky. Perhaps a proton fix for a custom version of proton could be the answer for steam titles at least.

Or perhaps it can be added to protontricks as a select-able option. Not perfect but could be a lot easier

Raboebie avatar Jul 29 '22 10:07 Raboebie

Adding on here. I've had time to test all my sims now and in all of them installing the driver in the prefix makes noticeable changes to the calibration of the wheel. It really does feel like I'm playing on windows after installing windows driver.

AMS2 AC ACC rFactor 2 PC2 Dirt Rally 4 WRC9 F1 22 and 2021 BeamNG

So I think it's worth installing them even if it works out of the box. Allows the game to correctly calibrate everything. Most notable are the pedals with some improvements to FFB.

Raboebie avatar Aug 02 '22 13:08 Raboebie

could you please guide me on how to install windows driver in the prefix?

fuzunspm avatar Sep 05 '22 08:09 fuzunspm

Added a wiki section about it: https://github.com/Kimplul/hid-tmff2/wiki

Feel free to request clarifications etc. if it's not clear enough.

Kimplul avatar Sep 05 '22 08:09 Kimplul

I missed that sorry and thank you

fuzunspm avatar Sep 05 '22 08:09 fuzunspm

out of context but I saw your old message on github about you don't own AC. I can't code for hardwares or in C (only in python and nodejs) but I want to contribute this project so please let me know your missing games and I will gift them.

fuzunspm avatar Sep 05 '22 09:09 fuzunspm

Thank you, that's very kind. I somewhat recently actually bought AC and ACC on Humble Bundle, so that's not an issue anymore. I'll keep your offer in mind for the future, though :)

Kimplul avatar Sep 05 '22 09:09 Kimplul

yes please do it, thank you

fuzunspm avatar Sep 05 '22 09:09 fuzunspm

Hi Peter,

You should use something like protontricks to set the windows version to 10. Proton experimental may have problems so I recommend using something a bit older.

On Tue, Oct 4, 2022 at 8:37 PM peterlopen @.***> wrote:

@Raboebie https://github.com/Raboebie hi, pls, how did you manage to install drivers? I am getting:

[image: image] https://user-images.githubusercontent.com/19715361/193896681-ea6eb7c9-10a2-425b-aad9-e860963f9882.png

and there is nothing pointing to a problem in wine log :( I have set Proton experimental in properties for F1 2019. [image: image] https://user-images.githubusercontent.com/19715361/193898416-a1827299-fda2-4a63-9107-bc39f8a10c06.png

thank you.

peter

— Reply to this email directly, view it on GitHub https://github.com/Kimplul/hid-tmff2/issues/46#issuecomment-1267428266, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGCYYQWBPLET7PE6QOIRZTWBR2QDANCNFSM546ANIZQ . You are receiving this because you were mentioned.Message ID: @.***>

Raboebie avatar Oct 05 '22 05:10 Raboebie

@Raboebie it was proton version. I tried Proton 7 and it worked. thanks a lot for this information about drivers installation in wine prefix, I tested F1 2019 and now it feels (almost) the same as in Windows.

thank you all, finally I can play with wheel in linux :)

peterlopen avatar Oct 05 '22 05:10 peterlopen

I'm glad my nerdiness helped you out!

On Wed, Oct 5, 2022 at 7:58 AM peterlopen @.***> wrote:

@Raboebie https://github.com/Raboebie it was proton version. I tried Proton 7 and it worked. thanks a lot for this information about drivers installation in wine prefix, I tested F1 2019 and now it feels (almost) the same as in Windows.

thank you all, finally I can play with wheel in linux :)

— Reply to this email directly, view it on GitHub https://github.com/Kimplul/hid-tmff2/issues/46#issuecomment-1267977477, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGCYYXFLHLYEJXPQLQC5FTWBUKGZANCNFSM546ANIZQ . You are receiving this because you were mentioned.Message ID: @.***>

Raboebie avatar Oct 05 '22 06:10 Raboebie

I tested installing the windows driver in my Assetto Corsa prefix and, indeed, it works great. I had some doubts about how good it will be on Linux since in Oversteer there's a massive Deadzone on the pedals. With the windows drivers there are no such problems, everything seems to be working fine. (I have also added deadzone settings in /etc/udev/rules.d/99-joydev.rules, though)

I want to tune the wheel settings, has anyone tried starting the Thrustmaster Control Panel? I tried launching it within the prefix, but it does not seem to start.

nkay08 avatar Oct 22 '22 13:10 nkay08

hi @nkay08 , I tried to find exe for TM control panel, but seems like there is just some configuration (.inf file) for "generic" windows control panel and I was not able to run that :( anyway, looking forward to try AC :)

peterlopen avatar Oct 22 '22 18:10 peterlopen

hi @nkay08 , I tried to find exe for TM control panel, but seems like there is just some configuration (.inf file) for "generic" windows control panel and I was not able to run that :( anyway, looking forward to try AC :)

I checked it on windows, and there a custom Thrustmaster menu opens from the gamepad settings for the wheel properties. In wine this obviously doesn't work. We have wine control where we can see connected game devices, but we cannot launch that Thrustmaster menu...

AC is abit tricky to set up. I recommend following this link Asseto Corsa on Linux Updated Gist to prepare the wine prefix. After you are done, you can use a much more recent wine version to launch the game with better performance (I'm using Proton GE 7.37).

nkay08 avatar Oct 22 '22 19:10 nkay08

thanks for info :+1:

peterlopen avatar Oct 23 '22 07:10 peterlopen

so I tried AC with this oversteer settings image and it actually felt pretty good :) thanks once again

peterlopen avatar Oct 23 '22 19:10 peterlopen

I played around a bit and it seems on Windows the settings from the Thrustmaster Control Panel are saved in the Registry.

The keys on my system seem to be saved in HKEY_CURRENT_USER\System\CurrentControlSet\Control\MediaProperties\PrivateProperties\Joystick\OEM\VID_044F&PID_B66E\OEM\JoystickSettings\0x28B3B24F.

Some possible Keys are the following for which hex values are set:

  • DefaultWheelAngle
  • OverallGain
  • DamperGain
  • SpringGain
  • PeriodicGain
  • ConstantForceGain
  • DefaultSpringStiffness
  • DefaultSpringIsPersistent 00 00 00 00 is off, 01 00 00 00 is on

For example, for DefaultWheelAngle a value of 84 03 00 00 is 900, 38 04 00 00 is 1080.

I exported the keys, with Steering Angle set to 900, Gain set to 70% and Damper set to 30%.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\System\CurrentControlSet\Control\MediaProperties\PrivateProperties\Joystick\OEM\VID_044F&PID_B66E\OEM\JoystickSettings\0x28B3B24F]
"DefaultWheelAngle"=hex:84,03,00,00
"OverallGain"=hex:58,1b,00,00
"DamperGain"=hex:b8,0b,00,00

[HKEY_CURRENT_USER\System\CurrentControlSet\Control\MediaProperties\PrivateProperties\Joystick\OEM\VID_044F&PID_B66E\OEM\JoystickSettings\0x28B3B24F\0]

[HKEY_CURRENT_USER\System\CurrentControlSet\Control\MediaProperties\PrivateProperties\Joystick\OEM\VID_044F&PID_B66E\OEM\JoystickSettings\0x28B3B24F\1]

I can successfully import the .reg file using wine regedit.

Does anybody know if the driver installed in the prefix can see these values? (I could maybe test by setting gain very low for example)

What I don't know is what the 0x28B3B24Fkey is? Is it device specific or is it a general key for the T300?

EDIT: Unfortunately, it does not seem to have an effect.

nkay08 avatar Oct 23 '22 19:10 nkay08