# Exchanging data between custom-built hardware and games

I have a built my own steering wheel and motion platform that I would like to connect to popular car racing games (e.g. iRacing, Dirt Rally). I need to read data such as the car's acceleration (to send to the motion platform) from these games and send information such as steering wheel's angle to the game. I have written an SDK in C++ to communicate with my steering will and motion platform. Now I need to interface different games with to that SDK.

I searched quite a bit but could not find much information about how this is generally done. Do game developers provide some sort of extension which allows third party hardware developers to communicate with their game?

Any guidance from the community is much appreciated.

Kam

• Tbh, I would have tackled that problem first. That being said, have you tried to impersonate your device as a compatible steering wheel such as a G27? – Vaillancourt Jun 17 '19 at 1:20
• I thought about it and I may try it for testing purposes. Though I would like to commercial these devices at some point. So I'd need to develop my own interface anyway. – user129365 Jun 17 '19 at 15:44

An option, on Windows, as far as I have been able to find, is to implement a Force Feedback Device Driver. You need to implement a register to the system a dll with a COM object that implements IDirectInputEffectDriver, and writ the CLSID in:

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

Then you would configure Force Feedback with your device in the game.

I find the documentation lacking, and I didn't find any code examples.

• Thanks Theraot. I am digging in to the force-feedback Device Driver Interface. I need to understand all its capabilities to see to what extent it can help my case. Though, it is unlikely that it can provide the whole solution, as my hardware has non-standard features and also needs to read pretty detailed information from the games that are unlikely handled by the FFDD interface. The discussion is to be continued. – user129365 Jun 17 '19 at 15:27

send information such as steering wheel's angle to the game

That's the easy part. Just create a device driver for your platform which reports it as a standard game controller and represents its various input functions as axis and buttons. Any game with controller support will then allow the player to bind those to various game functions.

read data such as the car's acceleration (to send to the motion platform)

That's the difficult part. The game might not expose that information in a way which is easy to read. What you could try (ordered from easiest to hardest):

• As the answer by Theraot suggests, see if the game sends Force Feedback data to your game controller driver which is sufficient for your purpose.
• Contact the developers of the game and ask them if they would like to collaborate with you to add support for your platform to their game.
• Read the memory of the game executable. Find out the locations in memory where it stores the relevant data and extract it at runtime. Depending on how the game is programmed, this might be a quite frustrating process. And if you eventually find a solution, that solution can easily break with every patch or even on different language versions of the game.
• Hack the game executable. Reverse-engineer it and create a patch/mod which adds support for the platform to the game. If it's an online game with good anti-cheat protection or Digital Restrictions Management, then this might also get in your way.
• Thanks Philipp. – user129365 Jun 17 '19 at 15:29
• I'd thought about using the standard game controller, but I thought using only the generic input information can limit the functionality of my device. Also, I thought whatever solution that I can find for retrieving data from the games would probably help sending more detailed information to the games as well. As you mentioned, contacting the game developers might be the ultimate option. I just want to make sure that I have explored all the available options before doing so. Thanks again. That was a comprehensive post. – user129365 Jun 17 '19 at 15:39
• @user129365 Can you be more specific about what input information your device provides which can not be properly represented as axis values and button states? – Philipp Jun 17 '19 at 16:03
• @user129365 In the end there is no universally applicable interface technology which is going to work on any game out there. But when you go through the standard controller interfaces, you have something which is (sort of) supported by many games. If you need more, you need to convince the developers to add that functionality to their game. – Philipp Jun 17 '19 at 16:10