Simulate Joystick Button Press ?

Started by
2 comments, last by ghostve 18 years, 6 months ago
Hi to all, is there a way I can simulate from my program that a joystick button has been pressed ? Thanks in advance, ghostve
Advertisement
Do you mean that you want to make another program think that a joystick button has been pressed? Does the other app use DirectInput?
If so, the easiest way is to provide a DI proxy dll. When the app tries to create a device, you instantiate your own subclass of IDirectInputDevice9, and pass that back to the program. Then faking a button press is easy.
Yes, I have writen a freeware utility called FFShifter, which users that play racing games, can use their forcefeedback joystick as a gear shifter (http://forum.rscnet.org/showthread.php?t=214673&page=1).
Currently my program simulates key presses, which are defined within the game as direct gear changes, but users have requested as well the ability to simulate joystick button presses (to be picked up by the game).
Steve, my guess is you are reffering to a DirectInput hook dll. I wanted to avoid to get into DI hooking and I was wondering whether there was an easier workaround. I tried to use the SendDeviceData to alter the joystick's button state, but with no success (as probably the joystick does not expect any input).
Any other suggestions ?
OK for the time being I have found a solution to my problem. There is a donationware utility called PPJoy which install a virtual joystick driver. Then it has a small program PPJoyKey which maps keyboard presses to joystick buttons.
If anyone finds or has a good resource link as an example of programming a virtual joystick driver, I would be really interested.

Thanks,
GhostVE

This topic is closed to new replies.

Advertisement