Logitech Dynamic Lock Plugin

Noel Hibbard

I am writing an rFactor plugin which will dynamically set the steering lock on Logitech wheels based on which car you are driving. It has an INI file called DynaLock.ini that looks something like this:
Code:
[Defaults]
Lock=900
[RS Spyder]
Lock=540

So given you are using the INI file above and you drive the RS Spyder it will change the lock to 540. If you drive a car that isn't in the INI file it will create a new entry for that car using the default value.

I am running into problems. Maybe there is another dev out there that can help. I have two ways to accomplish this. One way is hacky and involves setting some values in the registry and then closing the Logitech profiler and then launching it again forcing it to pick up the registry changes. This works perfect the only problem is it will cause rFactor to minimize. I added code to just minimize rF, then do the reg hacking, then maximize rF. But it is still annoying and some mods hang if you minimize rF.

The alternative is to use Logitech's SDK. Everyone has this SDK, it ships with driver version 5.08 and above and can be found here:
C:\Program Files\Logitech\Gaming Software\Logitech_SDK_For_PC_1.00.002.zip

I attempted to use the SDK without luck. I know TechAde tried to add dynamic lock support to RealFeel and ran into the same problems and even Logitech wasn't able to help him although I don't think they every responded to him. There are some devs that tried to implement dynamic lock with a plugin for LFS without luck and resorted to the hacky registry method I ended up using. So I am not alone in trying to implement this through the SDK.

As of right now the plugin is complete and works perfect if you don't mind seeing rF minimize for 500ms and then restore. I personally hate it. So I am going to hold off on releasing it in hopes of figuring out this stupid SDK. If I don't figure it out and no one else has any clues I will just release it as is.
 
Dunno. I was even more hacky and simulated the mouse buttons when I wrote this that sets the lock before running rF. Your solution is better than mine.

I notice that the demo program in the SDK doesn't read the lock correctly or write it successfully. Real time reading of the axes and buttons is OK. If Logitech themselves can't get it to work you're on a hiding to nothing!
 
Last edited:
Dunno. I was even more hacky and simulated the mouse buttons when I wrote this that sets the lock before running rF. Your solution is better than mine.

I notice that the demo program in the SDK doesn't read the lock correctly or write it successfully. Real time reading of the axes and buttons is OK. If Logitech themselves can't get it to work you're on a hiding to nothing!

Hahaha.. I noticed that too. Well for me the demo app always reads 200 for the lock but I can then manually type in 900 and it will successfully set it to 900. I basically duplicated the code from that sample app but it refuses to set it from my plugin. I don't know what the hell I am missing.

I made some changes to my hacky registry method so that you can set the lock to 0 to disable the lock plugin for mods that have problems when minimizing rF. So at least I can release this ugly version and have the ability to disable for some mods. I need to add a little more logic to handle all Logi wheels. Right now it is hard coded for my G27 but other Logi wheels store the reg settings in another place.
 
I will just guessing, but it is possible that you cannot change steering lock since rF take control over controller.
Again, it is just guess. I don't know how Logi drivers work.

however it is wonderful idea to build such feature.
 
I will just guessing, but it is possible that you cannot change steering lock since rF take control over controller.
Again, it is just guess. I don't know how Logi drivers work.

however it is wonderful idea to build such feature.

Looking at the SDK some more it looks like some stuff in the SDK happen via DirectInput. For example the LED shiftlight is done through DirectInput. To get the shift lights to work people have had to build a proxy dll. The steering lock doesn't go through DirectInput though. The way it works is you send the Logitech Profiler a windows message containing a struct with the new wheel settings. The profiler then takes care of it. The SDK comes with a sample program that will set the lock and it works just fine. I minimize rF, run the sample program to set the lock and when I maximize rF the new lock is set. So I don't think having rF running is a problem.

I haven't worked on this in a few days because the hacky method is working well and I haven't had time. I am going to give the SDK another shot when I get some time.
 
Does FF still work after changing wheel lock that way?
Because when I simply minimize rF and change wheel lock in a standard way (manually, in Controller settings), then I loose FF when I bring back FF (I only have centering spring effect, nothing else). I have to turn off rF completly and turn on again.
 
I don't loose FFB. Try using the sample app that comes in the SDK and see if you get different results.
 

Back
Top