Skip to main content
GameDev.net gamedev.net
🔒 Locked

Faking keyboard input do DirectInput will see it

Started by nickwinters Dec 7, 2005 at 9:15 PM 3 replies 2.4k views
Original Post
nickwinters
nickwinters
I'm attempting to map my XBOX 360 controller to my keyboard so I can use it for games. I'm using C# and Windows XP, but if C++ is the only choice, I'll use that. So far I've tried SendKeys and keybd_event in both C++ and C#, but neither are low level enough for DirectInput to pick up on it. They work fine for general windows apps, but not DirectInput. Anyone know how to do this? Thanks. -Nick
Flimflam
Flimflam
I'm afraid to tell you that you can't do what you want to do (easily, anyway). DirectInput directly interfaces with the hardware (which is why it's called DirectX.)

The only real way to do this is to write your own directinput dll that acts as a proxy to the real directinput, and plop that into what ever game directory you're using that uses Directinput. Then you catch everything that the game queries, and feed it your custom info you query (for instance, if the 360 controller goes up, tell the game that DIK_UP/DIK_W or whatnot was pressed by modifying the data that it polled).

That's really the only way to do what you want to do. DirectInput bypasses all Winapi when communicatring with input devices.
Phillip Martin
Phillip Martin
Another alternative to the only way of creating a proxy DirectInput, is to grab a utility like this one:

Total Game Control
http://www.digitaltransforms.com/

I perosnally haven't tried it, but it looks convincing.

- Phil
nickwinters
nickwinters
Well, I was unable to get keybd_event to work with Direct Input. I've also tried digital transform's.... It works with DirectInput, but doesn't work with the game I'm specifically working with. The game is Maple Story, and it seems to have the most paranoid security measures ever (I can't even start a new process after I start running Maple).

However, I know it is possible, as my friend uses the EMS Converter with his PS2 controller.

Topic Locked

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

Sign in to reply to this topic.