Jump to content
  • Advertisement
Sign in to follow this  
ghostve

Simulate Joystick Button Press ?

This topic is 4655 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi to all, is there a way I can simulate from my program that a joystick button has been pressed ? Thanks in advance, ghostve

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 ?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!