Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Override For fun

This thread is locked; no one can reply to it. rss feed Print
Override For fun
Albin Engström
Member #8,110
December 2006
avatar

Is there a way to "override" any type of input? for example, a program that handles keyboard input for you. would be awesome :).

ReyBrujo
Moderator
January 2001
avatar

Not that I know of. You need to program every interface, and some libraries can "hide" technical implementation (like Allegro itself), but you will have to tell the interface that pressing W is the same as pressing up, moving the mouse up or pushing the joystick up.

By the way, I am moving this post.

--
RB
光子「あたしただ…奪う側に回ろうと思っただけよ」
Mitsuko's last words, Battle Royale

Albin Engström
Member #8,110
December 2006
avatar

I'm not sure why, but i get the feeling i'm misunderstood...
i meant, instead of me pressing a key, how about making the computer do it and make it look like i did it. -.-?

Elverion
Member #6,239
September 2005
avatar

Albin: You might be interested in a project that I have been working on for quite awhile (well, right now it is stalled. Not because I'm sick of working on it--but rather, I don't know what more to add). You can find more information on my macro program here: http://solarimpact.servegame.com/micromacro/index.php

You might use the program itself (Windows only at the moment, but if anyone has any suggestions for Linux alternative functions to use, let me know), or use the macro.cpp and macro.h in your own project. Check the online manual for a list of all the cool things my macro program can do.

Edit: attaching source.

--
SolarStrike Software - MicroMacro home - Automation software.

Rampage
Member #3,035
December 2002
avatar

Tobias Dammers
Member #2,604
August 2002
avatar

Windows has a function that simulates a keypress (system-wide), IIRC it's called keyb_event.

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Albin Engström
Member #8,110
December 2006
avatar

Elverion said:

You might be interested in a project that I have been working on for quite awhile (well, right now it is stalled. Not because I'm sick of working on it--but rather, I don't know what more to add).

I'll take a look at it :).

Rampage said:

simulate_keypress(), simulate_ukeypress().

I'll test them.

Elverion
Member #6,239
September 2005
avatar

I believe the simulate_keypress() related functions only work within the allegro program. That is, it jams the information into its own key buffer and will not effect any other program in any way. From what I can tell, it would be nearly useless for what you intent to use it for.

--
SolarStrike Software - MicroMacro home - Automation software.

ReyBrujo
Moderator
January 2001
avatar

ungetc

By the way, back to programming forum, since it is obvious now it is programming oriented ;)

--
RB
光子「あたしただ…奪う側に回ろうと思っただけよ」
Mitsuko's last words, Battle Royale

Albin Engström
Member #8,110
December 2006
avatar

Elverion said:

I believe the simulate_keypress() related functions only work within the allegro program. That is, it jams the information into its own key buffer and will not effect any other program in any way. From what I can tell, it would be nearly useless for what you intent to use it for.

I was afraid so.
anyway, i still haven't tested your program, but i will when i get the time :). and learn lua..

ReyBrujo said:

By the way, back to programming forum, since it is obvious now it is programming oriented

:P

Elverion
Member #6,239
September 2005
avatar

Quote:

anyway, i still haven't tested your program, but i will when i get the time :). and learn lua..

No hurry. When/if you do, please let me know what you think. As I've said before, it is not yet finished, so there are still bugs to work out. Lua is also quite simple and I expect you'll pick it up in no time. I've done most of the Lua-side work for you as well. It's just a mater of creating your own function, implementing a main loop within it, and calling your function from the startMacro() function. If you need help figuring it out, let me know and I will be happy to help.

Note that the program might not work for everything. In fact, right now I'm working on a system to work around those pesky GameGuard and nProtect systems. And it'll have the added benefit of repairing any other rootkits you're running ;) Until that is done, check the help file included with the package for a few work-arounds that have not failed me yet.

--
SolarStrike Software - MicroMacro home - Automation software.

Albin Engström
Member #8,110
December 2006
avatar

Elverion said:

No hurry. When/if you do, please let me know what you think. As I've said before, it is not yet finished, so there are still bugs to work out. Lua is also quite simple and I expect you'll pick it up in no time. I've done most of the Lua-side work for you as well. It's just a mater of creating your own function, implementing a main loop within it, and calling your function from the startMacro() function. If you need help figuring it out, let me know and I will be happy to help.

Note that the program might not work for everything. In fact, right now I'm working on a system to work around those pesky GameGuard and nProtect systems. And it'll have the added benefit of repairing any other rootkits you're running ;) Until that is done, check the help file included with the package for a few work-arounds that have not failed me yet.

Nice, can't wait to test it. :)

Go to: