Question for a dev

A forum for the general posts relating to MacroQuest. *DEPRECATED: This forum is no longer in public use, but remains here for your reading pleasure. Enjoy

Moderator: MacroQuest Developers

crazyjim
decaying skeleton
decaying skeleton
Posts: 2
Joined: Sat Dec 20, 2003 11:37 am

Question for a dev

Post by crazyjim » Sat Dec 20, 2003 11:41 am

I'm developing a general macro tool for any game.

I need the ability to:

A) Spoof a keypress to directx
B) Spoof the mouse to directx

I've spent over 20 hours browsing the net for information. Many people seem to have the same question, but no answers.

Thank you,
Jim

MQSEQ
Hypocrite fag
Posts: 181
Joined: Fri Sep 19, 2003 5:18 pm

Post by MQSEQ » Sat Dec 20, 2003 11:58 am

Get the code and read it. It's pretty basic to figure out how they are doing it since the majority of the code is doing the same thing but for a different command. But the hard part is to make a generalized macro since each game is done different, for example DixertX vs. non DirextX.

Space-Boy
a hill giant
a hill giant
Posts: 242
Joined: Wed Dec 04, 2002 12:53 pm
Contact:

Post by Space-Boy » Sat Dec 20, 2003 1:34 pm

hate to mention it here, but xylobot.... yep yep it works well for this purpose, download it, rip it apart and figure out how it works to make yer own =) could work
You have gotten better at Carpal Tunnel! (247)

crazyjim
decaying skeleton
decaying skeleton
Posts: 2
Joined: Sat Dec 20, 2003 11:37 am

I have code for non directx

Post by crazyjim » Sat Dec 20, 2003 3:15 pm

keybd_event works, and I have mouse spoofing too.

Its directx that really is giving me issues. If someone could help me out, I could even pay them.

The person I got the keybd_event info from, I paid $25

I figure $40 would be fair if someone got me code that could access directx for mouse and keyboard.

I'm going mad on this, I really spent close to 30 hours just looking through the internet for help.

eq_freak
a ghoul
a ghoul
Posts: 105
Joined: Mon Jun 24, 2002 7:17 am

Post by eq_freak » Sat Dec 20, 2003 4:24 pm

Your answer is in the second post in this thread ;)

If you use C++ you can use microsofts detours library to hook the directx functions. As for how, look at the source for macroquest.

If you dont use C++, good luck on finding an alternative solution :)

A generic no offsets required solution(for DirectX8, but you could add similar for other versions) could go something like this:

Step 1: Hook the Direct3DCreate8 function
Step 2: In the Direct3DCreate8 hook, Install the hook for IDirect3D8::CreateDevice
Step 3: Remove the Direct3DCreate8 hook
Step 4: In the IDirect3D8::CreateDevice hook, install GetDeviceData hook
Step 5: Remove the IDirect3D8::CreateDevice hook

Now you should have a GetDeviceData hook in place where you can manipulate keyboard/mouse buffers MQ-style. You can also do other fun stuff, like hooking EndScene and draw stuff on the screen every frame, or SetRenderState for quake wall-hack style effects.

zedisdeadbaby
a ghoul
a ghoul
Posts: 83
Joined: Sun Nov 03, 2002 4:24 pm

Post by zedisdeadbaby » Sun Dec 21, 2003 3:30 am

detours is a useful thing to learn, but keybd_event is the quickest and easiest way to get a keypress in EQ. maybe check if EQ is in the foreground first though.