Skip to main content
gamedev.net
🔒 Locked

Simulate Joystick Button Press ?

Started by ghostve Sep 25, 2005 at 9:58 AM 2 replies 2.1k views
Original Post
ghostve
ghostve
Hi to all, is there a way I can simulate from my program that a joystick button has been pressed ? Thanks in advance, ghostve
Evil Steve
Evil Steve
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.
ghostve
ghostve
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 ?
ghostve
ghostve
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.