I want to build a "force feedback chair" for Need for Speed: Payback, so I thought about hooking the function responsible for the controller vibration and sending the motor speed parameter to a motor over Serial (to an arduino). I successfully hooked the XInputSetState function (responsible for Controller Vibration) and sent the parameters over usb, and everything worked fine. The problem is, I want to play the game with a Wheel (Logitech g29). The "XInputSetState" function still gets called, but the motor speed parameter is always 0 (makes sense, if you have two controllers connected to your pc, only the one you're driving with vibrates not the other one). My Wheel also has no Vibration feedback (so no function that i can hook there).

So my thought was, that if you for example drive against a wall, the game checks if a Controller is connected, and if it's the case, calls the XInputSetState function with the correct motor speed parameter (so the Controller vibrates).

For now I tried setting a breakpoint on XInputSetState and moving up the Callstack, to see what function still gets called with the correct motor speed parameter (even if no Controller is present), but my knowledge with reveersing is still very limited so no luck there.

So how would you go about looking for such a function? Any tips and hints are welcome.

1 Answer 1


I think your approach of looking up the callstack is generally sound, but might be too time consuming.

As you have no doubt experienced, without debugging information it can be challenging even to piece together what the different frames are, before trying to determine if any of those functions are relevant.

The crucial function deciding whether to call the vibration logic based on the controller type might not even be on the stack if the system is built around an asynchronous event loop.

My suggestion would be to look into the DirectInput APIs to figure out what functions the game would call to query information about the controller. This is likely necessary for the game to decide whether it should run the vibration logic or not.

Keep in mind that the game is likely querying the controller info very early (either at launch or just before entering the game from the menu), and then storing the necessary information somewhere in its memory. If you can find that, you might be able to find where in the callstack leading up to XInputSetState that memory location is being checked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.