Sign in to follow this  

Direct Input hook ?

This topic is 3849 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

Hello, Here is my issue: In some game that I play (Command and Conquer 3: Tiberium Wars) there is a function (displaying lifebar of all units) that needs you to keep one touch pressed to be active. Since this is something you would rather want to keep activated the whole game, I've looked around for a way to hook direct input key state function, detect if the key was pressed, if yes toggle my OWN internal flag to true or false and if the flag is true, then editing the key string to make the game believe the corresponding key is pressed as long as the user didn't really re-press it. Hope you understand. I have near to no knowledge of direct x/direct input, but I know my stuff at coding, so I went looking for firect input hook samples. I found two sample: http://www.gamedev.net/community/forums/topic.asp?topic_id=371104 This one here at gamedev seems working when you try the sample, but it NEVER works with a real game using direct input. Connection to the server always fails. http://www.codeguru.com/cpp/w-p/system/misc/article.php/c11899/ This one, which looked like a better implementation to me (you replace the direct input function for you own implementation, which does what the original did, plus your own stuff), did work perfectly with the keyboard sample too (I have the string giving keys representation, and can read/write to it as I want). BUT when trying it with real games, I've got two king of issues: - With some games (hitman blood money for instance), it crashed when trying to create the device ... - With some other games (cnc3: tiberium wars), everything went fine, my own create device and stuff are called, but the GetDeviceState is *never* called. Which prevents me from doing what I want. As I don't know direct input that well, I wanted to know if you either have a real world working direct input hook sample, or if you understand why getdevicestate is never called in the second sample (newer directX use another function ?) ?

Share this post


Link to post
Share on other sites

This topic is 3849 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this