Adding an unsupported controller to WRC7 (hopefully)

Sep
19
2017

Upon getting the latest installment in the WRC game series, I quickly found out a very serious downside with the game – despite supposedly having this issue solved in one of the patches for WRC 6, WRC 7 seems to have a lot of issues with input devices, especially with some of the more custom setups simracers tend to have. In my case, I’m currently using the Thrustmaster T300 wheel, the G25 pedals connected via the USB Bodnar adapter and the G25 shifter, again connected as USB device using a Bodnar adapter. When trying to bind my pedals and shifter (in sequential mode to be used as a handbrake), I’ve found out the game doesn’t seem to detect my pedals at all and I’m not able to bind them. As for the shifter, there didn’t really seem to be an issue – binding the sequential as a handbrake button worked more or less fine out of the box. But the pedals were the main issue – obviously I want to be able to use my customized modded pedals in the game.

With some experimentation, I managed to come up with a very awkward and bizzare way to at least make the game see the pedals and be able to bind them, but there were still several issues. One of them was I had go through a very specific and awkward process every single time I started the game, and also the game only responded to the second half of the pedal travel. So I tried to poke a bit more – and seems like I have found a way to add a previously unsupported controller to the game so you don’t have to do any weird things to make the game see the controller and can bind it without any problems.

DISCLAIMER: IF YOU DECIDE TO TRY THIS, I’M NOT RESPONSIBLE FOR ANY PROBLEMS OR ISSUES YOU MIGHT ENCOUNTER. I CAN NOT GUARANTEE IT WORKING WITH YOUR SPECIFIC CONTROLLER. THE PROCESS ALSO INCLUDES MODIFYING THE GAME FILE(S), WHICH MEANS IT MAY OR MAY NOT TRIGGER SOME KIND OF ANTI-CHEAT OR ANTI-PIRACY PROTECTION, POSSIBLY EVEN REMOVING YOUR ACCESS TO THE GAME. THE FACT THAT IT DIDN’T HAPPEN TO ME SO FAR DURING MY TESTING DOESN’T REALLY MEAN ANYTHING, SO PLEASE, BEAR THAT IN MIND AND BE SURE YOU ARE AWARE OF THE RISKS.

ALSO, YOU HAVE TO BE FAMILIAR WITH THINGS LIKE USING A REGISTRY EDITOR, EDITING CODE AND SIMILAR “POWER USER” KIND OF STUFF. IF YOU’RE JUST A REGULAR PC USER NOT COMFORTABLE WITH STUFF LIKE THAT, PLEASE CONSIDER LEAVING IT TO SOMEONE ELSE OR EDUCATING YOURSELF BEFORE PROCEEDING.

OK, with this out of the way, let’s get to what I actually did.

There are two files of interest included with the game:

..\WRC 7\Common\Settings\InputBindings.lua

and

..\WRC 7\Common\Settings\InputDeviceConfig.lua

The “WRC 7” folder is found withing your Steam folder in the /SteamApps/common/ folder – as usual with most Steam games.

As far as I can tell, the second one (InputDeviceConfig.lua) is the important one here. The first file seems to only (well, “only”) contain default keybindings for a given controller – this, I guess, could be useful if someone was trying to add a complete support for say an unsupported wheel, button box or something like that as I believe this file would make it possible for you to define controls to use to navigate menus and do other things in the game with said controller. It is however not needed to edit this file if all you want is for the game to know about your device and to be able to bind it’s axis to game controls. I could give you some pointers about the first file, but I’m guessing anyone who decides to go for the fairly big task of actually trying to add a whole controller here will be able to get his bearings on his own anyway.

So if you’re just adding an unsupported device like pedals or handbrake like me, the second file is what you’re interested in. It contains the controller IDs and definitions of the axis the controller uses (only the axis, no button definitions here). If you look into the file, you’ll probably understand its structure fairly easily.

This is what I’ve added to the file to make my G25 pedals with a Bodnar adapter recognized by the game to be available for binding as throttle or brake:

--G25 Bodnar Pedals
{
    GUID ={ 269229522 },
    Axis =
    {
        --Acceleration
        {
        ControlId = GenericDeviceControlId.I_ICI_GENERICDEVICE_AXIS2_X,
        DIAxis = DirectInputState.AxislRx,
        Filter = FilterType.InvertMaxDefaultStick,
        },

        --Brake
        {
        ControlId = GenericDeviceControlId.I_ICI_GENERICDEVICE_AXIS2_Y,
        DIAxis = DirectInputState.AxislRy,
        Filter = FilterType.InvertMaxDefaultStick,
        },

        --Clutch
        {
        ControlId = GenericDeviceControlId.I_ICI_GENERICDEVICE_AXIS3_X,
        DIAxis = DirectInputState.AxislRz,
        Filter = FilterType.InvertMaxDefaultStick,
        },
    },
},

Here’s the code on Pastebin to make copy and paste easier.

So, let’s look more into what each of the lines seem to do.

First off, obviously all of the lines starting with double dashes, like the very first line, are just comments in the code. You can put whatever you like there, the game doesn’t use it – it’s just for you or anyone else reading the file.

Second line starts the definition of the controller with a curly bracket. As always when writing code, be careful about the opening and closing brackets pairing up.

Third line is where it gets interesting. This is the ID of the controller – it’s how the game knows what controller we are trying to add. Finding out the controller ID is easier than it might look. Just fire up regedit and go to:

\HKEY_CURRENT_USER\System\CurrentControlSet\Control\
MediaProperties\PrivateProperties\Joystick\OEM\

Here you’ll see a bunch of registry keys named something like VIDxxxx&PIDxxxx (where instead of the x’s there are various numbers or letters). If you click on one of those keys, in the right pane, you’ll see a bunch of values. You’re interested in the “OEMName” value – go through the keys until you find the one with OEMName that matches the device you want to add support for. In my case, the OEMName was “Logitech G25 Pedals” and the key was named “VID_1DD2&PID_100C”. This is the GUID we’re looking for. We just have to convert it. Use a calculator that allows you to convert between hexadecimal and decimal (even the one in Windows can do this if you switch it to programmer mode). In hexadecimal mode, enter the as one number the PID identifier, followed by the VID identifier. So in my case, I enter 100C1DD2 (as one hexadecimal number). Now convert this hexadecimal number to decimal…and bingo, we have our GUID! So in my case, 269229522.

Now to define the individual axis of the controller.

The “ControlId” parameter is where things get kinda confusing. It seems to me that it’s mostly there to just tell the game what the intended purpose of this axis is supposed to be by default. Most of the controller definitions (but note that not all of them – there’s couple of exceptions for some reason) already contained in the file seem to follow a pretty simple logic:

GenericDeviceControlId.I_ICI_GENERICDEVICE_AXIS1_X – steering
GenericDeviceControlId.I_ICI_GENERICDEVICE_AXIS2_X – accelerator
GenericDeviceControlId.I_ICI_GENERICDEVICE_AXIS2_Y – brake
GenericDeviceControlId.I_ICI_GENERICDEVICE_AXIS3_X – clutch
GenericDeviceControlId.I_ICI_GENERICDEVICE_AXIS3_Y – handbrake

And indeed, if I followed this logic as well and went to the “Axis detection” screen, my pedals matched what was shown on-screen – accelerator pedal movement was shown on the accelerator axis in-game, brake on the brake axis and clutch on the clutch axis. If I shuffled the ControlId values around, the pedal response in the axis detection screen followed as well. So most likely this is what you want to do as well, or at leas this is where you likely want to start. And to be perfectly honest, it doesn’t really matter if your accelerator shows up in the game as accelerator or as a clutch – as long as the axis works and you can bind it in the button bindings menu to the intended function, you’re fine.

BTW, talking about binding the pedals, there are two things of note. First one is, even if you follow this and your pedals/handbrake/whatever is recognized by the game, it will still show up as “Key” in the button binding screen, not as “Axis”. I don’t know why that is, but don’t worry about it too much – even with “Key” being shown, the pedal is still properly analog, not digital. And in fact, as I’ve just found out while taking the screenshot, if you press the Shift key while in the button binding menu, the affected “Key” items will magically turn into “Axis”…until you leave the menu :O

And the second thing is – you don’t have to worry too much about your clutch pedal. Although the game does detect clutch pedals in the axis detection screen, it doesn’t really matter. For some reason, the game doesn’t really have any clutch functionality (and it was confirmed by the devs). You can’t use clutch in the game and there’s no way to bind it. Don’t think I’ve seen or heard a review mentioning this, interestingly enough.

Anyway, let’s continue.

The second parameter, DIAxis, is where you define what axis on your controller do you want to map to the action in question. This is something you’re gonna have to figure out on your own here. The common values are:

DirectInputState.AxislX – often used for steering
DirectInputState.AxislY – often used for brake or throttle
DirectInputState.AxislZ
DirectInputState.AxislRx – used for throttle on my pedals
DirectInputState.AxislRy – used for brake on my pedals
DirectInputState.AxislRz – used for clutch on my pedals
DirectInputState.rglSlider0
DirectInputState.rglSlider1

Please note the capitalization difference between normal axis and rotational axis – it might be important (I admit I haven’t even tested it, I simply went with what was used in the file).

An easy way to figure out which pedal is which axis on your controller is to open up the gaming devices properties and look at the appropriate controller. On Windows 10, you open up the Control Panel, go to Devices and Printers, find the device you’re interested in, right click it, select Game controller settings. In the window that pops up, you once again select the device you’re interested in and then click the Properties button. You should then see something like this:

I’m guessing it’s pretty self-explanatory. You step on the pedal or pull the handbrake and watch which axis changes value and that’s the axis you’re looking for.

Alternatively, some (well, most sims, I’d say) games tell you what axis you have mapped to what function, so that’s also the way to find out the axis you’re looking for.

Finally, there’s the third parameter, Filter. This parameter tells the game how the given axis works as there’s several possibilities. Specifically, I’m aware of four the game recognizes:

FilterType.Stick
FilterType.InvertStick
FilterType.MaxDefaultStick
FilterType.InvertMaxDefaultStick

When it comes to pedals or analog handbrakes, this is probably one you’ll have to test for yourself with a bit of trial and error (at least I’m not aware of an easy way to determine this). The difference here is whether a whole axis is used for a single control option on your controller, or if only half of said axis is used, and obviously also if the axis has inverted minimum and maximum values or not. The “Stick” and “InvertedStick” parameters are used with half-axis controls, while the “MaxDefaultStick” and “InvertMaxDefaultStick” parameters are used with the full-axis controls. Steering axis are pretty much always of the “Stick” type for obvious reasons, but as for the pedals or handbrakes, there really doesn’t seem to be any standard – some use only half of the axis, some use full axis. If you use the wrong filtertype for your axis, you should only have half of the usable travel available in the game – meaning basically a 50 % upper or lower deadzone (you should be able to check the axis detection screen to help you with this). And if you say have full throttle in-game with your foot off the pedal and as you apply throttle, the revs of the in-game car engine start to drop, then you obviously need to invert that axis.

And this is basically all I can tell you about this. Hopefully, I wasn’t just lucky and this might help others to get their devices working in the game as well.

Oh, but one final, very important note – once you get your controller working (hopefully), be sure to back up your controller definitions somewhere. It’s quite likely the files might get overwritten if/when the game is updated.

(P.S. If any of the devs is reading this by any chance, please do at least confirm for us if there might be any consequences in doing this. I think it might be highly beneficial for you if you allowed the community to make their own controller definitions, though, perhaps even offering some kind of basic documentation to the parameters so we could be sure what the parameters really do instead of just guessing? After all, we’re only trying to be able to play and enjoy your game using our own gear, nothing more…thank you.)

1 person likes this post.

Napsal(a) dne 19. 9. 2017 v 08:45
Kategorie: Guide,Software

2 Comments »

  • Trevor says:

    jeese I wish I could understand half of what I just read. I have downloaded a code reader that lets me find these files, I want to try to add my handbrake it’s on an Arduino interface box, just all this hexadecimal conversion stuff loses me and I start to go blurry and can’t focus lol. Just gotta hope the devs sort it out.

  • trevor says:

    hi, I think I have an idea of what you are saying here. I have worked out the GUID of my UnoJoy USB device controller for my handbrake.

    Now what I wasn’t sure of is if I could add that number (219362584 to the Thrustmaster list of GUID. SO, looking down the list of controllers I saw a stand alone Fanatec Handbrake with its own unique GUID. So out of curiosity I changed it to the UnoJoy GUID. It is listed as an AXIS4. Now on checking in my controllers the handbrake(UnoJoy) comes up as Z axis and Z Rotation with 2 bars moving.

    Interestingly in Dirt Rally it is detected as Y Axis, but in Dirt 4 it is detected as X Axis. So I have been through the whole trial and error process of changing either Stick or MaxDefaultStick and as Axislx/lY.

    I figured as it doesn’t come up in the other games as an inverse I could leave those out of the equation. Unfortunately after more than 2 hours of altering the file to as many variations of the above I can I still haven’t detected the handbrake. Possibly changing the fanatic handbrake GUID was the wrong way to go about it. Only unknown now really is the AXIS# do I start again with #1, and go through 2,3,4 etc? It’s been an interesting evening if nothing else. I don’t often mess about with files. Thanks for your blog tho . If you have any suggestion as o Axis# or anything else it would be very much appreciated. Regards Trevor

RSS komentářů k tomuto příspěvku. Zpětné URL


Napište komentář

Používá systém WordPress | Styl: Aeros 2.0 z TheBuckmaker.com