Go Back   UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats > Anti-Cheat Software & Programming > Direct3D

- Sponsored Advertisement -
http://www.myfpscheats.com/

Welcome to the UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats.
You have to register before you can post and see and access any of the advanced forum features, please click the register link to proceed to the registration form. To start viewing threads or posts, select a forum that you want to visit from the selection below.
Direct3D
hacking programming reversing
You are Unregistered, please register to gain Full access.    
Reply
 
Thread Tools

My DLL won't stop taking input =(
Old 08-23-2010, 02:17 PM   #1
Senior Member

0rbit's Avatar

Join Date: Jun 2010
Location: Ireland
Posts: 77
Reputation: 2984
Rep Power: 51
0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community
Super Track 2001 Champion
Points: 4,440, Level: 6
Points: 4,440, Level: 6 Points: 4,440, Level: 6 Points: 4,440, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Last Achievements
My DLL won't stop taking input =(

Hey all, I've recently started coding a DLL hack (DirectX hooked), with a menu and a few other bits, one of which being an input box (for text).

This input box has a (currently quite messy) function that checks if a key is pressed. If it is then add it to the text string. I've tried moving around where this is called from, however no matter how its called, it seems to take input whether I want it to or not.

For example if I put it at the end of the render routine (of the input box), and type some stuff with it not visible (ie. the render routine isn't being called), input is still taken.

I originally had my menu reset the index of the selected item to 0 when it was toggled, so that it would be at 0 every time it was displayed, however to test it I have removed that, and surprise surprise, my menu takes input too.
The difference with the menu, however, is that it only takes one bit of input, and only applies it when the menu is shown (which makes even less sense to me )

For example if I highlight the "Crosshair" item, then hide the menu, and press the right arrow key (which would enable it), nothing happens. When I display the menu, the crosshair appears.
Also my menu can move if shift+an arrow key are pressed. This action doesn't take place when the menu is hidden for some reason.

Part of the key watching routine of the menu:
Code:
void KeyWatcher(void)
{
        if (GetAsyncKeyState(VK_INSERT) &1)
            MW2.Spin();

        if(GetAsyncKeyState(VK_F1) &1) 
            menu = !menu; 

        if(!menu)
            return;
        else
        {

            if(GetAsyncKeyState(VK_SHIFT) && GetAsyncKeyState(VK_UP) &1)
            {
                Menu.posY-=15;
            }
            else
            if(GetAsyncKeyState(VK_SHIFT) && GetAsyncKeyState(VK_DOWN) &1)
            {
                Menu.posY+=15;
            }
            ...
            ...
            else
            if(GetAsyncKeyState(VK_UP) &1)
            {
                if(Menu.selectedItem == 0)
                    Menu.selectedItem = (Menu.hackCount());
                else if(Menu.selectedItem >= 1)
                    Menu.selectedItem--;
            }
            ...
            ...
}
And from the input box:
Code:
void MW2_Console::takeInput(bool vis)
{
    if(!vis)
        return;

    if (GetAsyncKeyState(VK_RETURN) &1)
    {
        prevCommands.push_back(command);
        command+='\n';
        SendCommandToConsole(1,1,command.c_str()); 
        command="";
        cmdCount=prevCommands.size();
        currCmd=cmdCount;
    }
    else
    if (GetAsyncKeyState(VK_BACK) &1)
    {
        if(command.length()>0)
            command.erase(command.length()-1);
    }
    ...
    ...
    if (GetAsyncKeyState(VK_SHIFT) && GetAsyncKeyState(VK_OEM_MINUS) &1)
        command+='_';
    else
    if (GetAsyncKeyState(VK_SHIFT) && GetAsyncKeyState(0x32) &1)
        command+='"';
    else
    if (GetAsyncKeyState(0x41) &1)
        command+='a';
    else
    if (GetAsyncKeyState(0x42) &1)
        command+='b';
    else
    if (GetAsyncKeyState(0x43) &1)
        command+='c';
    ...
    ...
I mean, to me the above codes look like they should only take place if menu==true or if vis==true.
Before you ask about the edit input, yes it is just (currently) a big block of if(GetAsyncKeyState(key) &1) command+='key';

I know I could clear everything like I did previously with setting selected index to 0, and setting the command string to "", however the main problem is that enter will call SendCommandToConsole with the random strings picked up from gameplay

Am I missing something really simple here, or what?

(Here, I typed "unknown cheats" with the input box hidden. When I displayed it, it was briefly blank, then filled with this):


(I haven't finished the code for the caret yet, so don't say a word about it )

Now, this post is probably too long and this is probably (hopefully) something really simple that's wrong, so sorry (and congrats) if you read through all that

EDIT: Sorry I just realised that this should probably be in the C++ section rather than here. My bad =/

Cheers,
0rbit.
__________________
If you add me on MSN, PM me here so I know who you are, or I will not accept.

Free Trainer Template: Want this trainer template with your name on it? PM me. (I ain't using it)

Last edited by 0rbit; 08-23-2010 at 03:16 PM.
0rbit is offline

Reply With Quote


Old 08-23-2010, 03:18 PM   #2
SEGnosis
Guest

Posts: n/a
Its put into a queue until the function is called.

edit: use a better form of input or have it call the GetAsyncKeyState function but then do the visibility check.

Last edited by SEGnosis; 08-23-2010 at 03:20 PM.

Reply With Quote

Old 08-23-2010, 03:29 PM   #3
Senior Member

0rbit's Avatar

Threadstarter
Join Date: Jun 2010
Location: Ireland
Posts: 77
Reputation: 2984
Rep Power: 51
0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community
Super Track 2001 Champion
Points: 4,440, Level: 6
Points: 4,440, Level: 6 Points: 4,440, Level: 6 Points: 4,440, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Last Achievements
Quote:
Originally Posted by SEGnosis View Post
Its put into a queue until the function is called.

edit: use a better form of input or have it call the GetAsyncKeyState function but then do the visibility check.
But why would it be put into a queue? I'm not actually hooking the keyboard, just checking if certain keys are pressed at certain times.
(and the function is technically being called all the time)

I've also tried using
Code:
if(visible)
{
//check keys
}
But still the same.
__________________
If you add me on MSN, PM me here so I know who you are, or I will not accept.

Free Trainer Template: Want this trainer template with your name on it? PM me. (I ain't using it)

Last edited by 0rbit; 08-23-2010 at 03:34 PM.
0rbit is offline

Reply With Quote

Old 08-23-2010, 03:52 PM   #4
SEGnosis
Guest

Posts: n/a
if( GetAsyncFoo( VK_FOO )&1 )
if( bVisible )
DoMahThang();

should solve your problem, but isnt practical.

Reply With Quote

Old 08-23-2010, 04:18 PM   #5
Senior Member

0rbit's Avatar

Threadstarter
Join Date: Jun 2010
Location: Ireland
Posts: 77
Reputation: 2984
Rep Power: 51
0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community
Super Track 2001 Champion
Points: 4,440, Level: 6
Points: 4,440, Level: 6 Points: 4,440, Level: 6 Points: 4,440, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Last Achievements
Quote:
Originally Posted by SEGnosis View Post
if( GetAsyncFoo( VK_FOO )&1 )
if( bVisible )
DoMahThang();

should solve your problem, but isnt practical.
It does. Weird
By impractical do you mean code-wise or resources wise? I mean would it be more practical to make an array or something with a list of keys, then do a small for() loop based on that with just one GetAsyncKeyState()?

(Eg.
Code:
for(int i=0;i<keyCount;i++)
{
if(GetAsyncKeyState(keys[i]) &1)
 if(visible)
   add character;
}
)
__________________
If you add me on MSN, PM me here so I know who you are, or I will not accept.

Free Trainer Template: Want this trainer template with your name on it? PM me. (I ain't using it)

Last edited by 0rbit; 08-23-2010 at 04:21 PM.
0rbit is offline

Reply With Quote

Old 08-23-2010, 04:23 PM   #6
SEGnosis
Guest

Posts: n/a
Its impractical to use GetAsyncKeyState over and over running up your cpu.
I added a callback based ( event response, only when the user presses the keys does it receive the messages ) example to the QTS if you know some win32

Reply With Quote

Old 08-23-2010, 04:33 PM   #7
Senior Member

0rbit's Avatar

Threadstarter
Join Date: Jun 2010
Location: Ireland
Posts: 77
Reputation: 2984
Rep Power: 51
0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community0rbit is a legend in the cheating community
Super Track 2001 Champion
Points: 4,440, Level: 6
Points: 4,440, Level: 6 Points: 4,440, Level: 6 Points: 4,440, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Last Achievements
Quote:
Originally Posted by SEGnosis View Post
Its impractical to use GetAsyncKeyState over and over running up your cpu.
I added a callback based ( event response, only when the user presses the keys does it receive the messages ) example to the QTS if you know some win32
Okay thanks
I'll check that out, hadn't seen it had been added.

Cheers.

EDIT: Okies, implemented that callback using WM_KEYDOWN and WM_CHAR. Works an absolute CHARM
Thanks a million SEG, would +rep you but apparently have to spread around my rep first
__________________
If you add me on MSN, PM me here so I know who you are, or I will not accept.

Free Trainer Template: Want this trainer template with your name on it? PM me. (I ain't using it)

Last edited by 0rbit; 08-23-2010 at 06:39 PM.
0rbit is offline

Reply With Quote
Reply  

  • Submit Thread to Digg
  • Submit Thread to del.icio.us
  • Submit Thread to StumbleUpon
  • Submit Thread to Google
  • Submit Thread to Facebook
  • Submit Thread to My Yahoo!
  • Submit Thread to MySpace
  • Submit Thread to Twitter
  • Submit Thread to Reddit



Tags
dll, input, make, points, stop, taking
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT +1. The time now is 03:31 PM.