View previous topic :: View next topic |
Author |
Message |
Bizarro I post too much
Reputation: 0
Joined: 01 May 2007 Posts: 2648
|
Posted: Sun Nov 23, 2008 3:15 am Post subject: [c++]reflection ability |
|
|
do u guys know a good way to utilize reflection in c++
as in directly converting userinput string to c++ code function.
since c++ program converts everything to native asm code. it seems hard for me to accomplish such task without hardcode everything string with if statement
i know its much easier with languages such as c#, VB
ie
user input:
SendKey VK_CONTROL//ctrl key
SendKey 0x56 //some letter
code problem
can't directly convert string "VK_CONTROL" "0x56" to c++ code
i need to hardcode every string with IF statement to cover all the possibilities
do u guys have a better method in mind?
_________________
w8 baby.com Banner contest, Come join NOW!!
Check us out for Prize deatils |
|
Back to top |
|
 |
nog_lorp Grandmaster Cheater
Reputation: 0
Joined: 26 Feb 2006 Posts: 743
|
Posted: Sun Nov 23, 2008 5:22 am Post subject: |
|
|
You need to write a parser. Easiest way would be to find a scripting engine for C++ to run javascript or lua script or some other garbage.
_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish |
|
Back to top |
|
 |
GMZorita Grandmaster Cheater Supreme
Reputation: 0
Joined: 21 Mar 2007 Posts: 1361
|
Posted: Sun Nov 23, 2008 6:47 am Post subject: Re: [c++]reflection ability |
|
|
Bizarro wrote: | do u guys know a good way to utilize reflection in c++
as in directly converting userinput string to c++ code function.
since c++ program converts everything to native asm code. it seems hard for me to accomplish such task without hardcode everything string with if statement
i know its much easier with languages such as c#, VB
ie
user input:
SendKey VK_CONTROL//ctrl key
SendKey 0x56 //some letter
code problem
can't directly convert string "VK_CONTROL" "0x56" to c++ code
i need to hardcode every string with IF statement to cover all the possibilities :?
do u guys have a better method in mind? |
Got the same problem as you :s
I'm using this code for now =/
Code: |
UINT SelectedKey(String KeyName) {
UINT key = 0xFF;
if(KeyName == "'")
key = 0xDE;
else if (KeyName == "-")
key = 0xBD;
else if (KeyName == ",")
key = 0xBC;
else if (KeyName == ".")
key = 0xBE;
else if (KeyName == "/")
key = 0xBF;
else if (KeyName == ";")
key = 0xBA;
else if (KeyName == "[")
key = 0xBD;
else if (KeyName == "\\")
key = 0xDC;
else if (KeyName == "]")
key = 0xDD;
else if (KeyName == "=")
key = 0xBB;
else if (KeyName == "0")
key = 0x30;
else if (KeyName == "1")
key = 0x31;
else if (KeyName == "2")
key = 0x32;
else if (KeyName == "3")
key = 0x33;
else if (KeyName == "4")
key = 0x34;
else if (KeyName == "5")
key = 0x35;
else if (KeyName == "6")
key = 0x36;
else if (KeyName == "7")
key = 0x37;
else if (KeyName == "8")
key = 0x38;
else if (KeyName == "9")
key = 0x39;
else if (KeyName == "A")
key = 0x41;
else if (KeyName == "B")
key = 0x42;
else if (KeyName == "C")
key = 0x43;
else if (KeyName == "CTRL")
key = 0x11;
else if (KeyName == "D")
key = 0x44;
else if (KeyName == "DELETE")
key = 0x2E;
else if (KeyName == "E")
key = 0x45;
else if (KeyName == "END")
key = 0x23;
else if (KeyName == "F")
key = 0x46;
else if (KeyName == "G")
key = 0x47;
else if (KeyName == "H")
key = 0x48;
else if (KeyName == "HOME")
key = 0x24;
else if (KeyName == "I")
key = 0x49;
else if (KeyName == "INSERT")
key = 0x2D;
else if (KeyName == "J")
key = 0x4A;
else if (KeyName == "K")
key = 0x4B;
else if (KeyName == "L")
key = 0x4C;
else if (KeyName == "M")
key = 0x4D;
else if (KeyName == "N")
key = 0x4E;
else if (KeyName == "O")
key = 0x4F;
else if (KeyName == "P")
key = 0x50;
else if (KeyName == "PGDOWN")
key = 0x22;
else if (KeyName == "PGUP")
key = 0x21;
else if (KeyName == "Q")
key = 0x51;
else if (KeyName == "R")
key = 0x52;
else if (KeyName == "S")
key = 0x53;
else if (KeyName == "SHIFT")
key = 0x10;
else if (KeyName == "SPACE")
key = 0x20;
else if (KeyName == "T")
key = 0x54;
else if (KeyName == "U")
key = 0x55;
else if (KeyName == "V")
key = 0x56;
else if (KeyName == "W")
key = 0x57;
else if (KeyName == "X")
key = 0x58;
else if (KeyName == "Y")
key = 0x59;
else if (KeyName == "Z")
key = 0x5A;
if(key == 0xFF)
MessageBoxA(0,"Key not found","Error",0);
return key;
} |
_________________
Gone |
|
Back to top |
|
 |
DoomsDay Grandmaster Cheater
Reputation: 0
Joined: 06 Jan 2007 Posts: 768 Location: %HomePath%
|
Posted: Sun Nov 23, 2008 6:53 am Post subject: |
|
|
CE 5.4 has such support (needless to say what you could do ).
Also: you might want to use header files.
|
|
Back to top |
|
 |
Bizarro I post too much
Reputation: 0
Joined: 01 May 2007 Posts: 2648
|
Posted: Sun Nov 23, 2008 7:04 am Post subject: |
|
|
@ GMZorita
as i mentioned in the first post, i prefer not to do this for many reasons...
sendkey is only the simplest one to start with. it becomes much more troublesome with loops and functions/api call.
@DoomsDay
i thought CE5.4 was coded in delhi. i can use their header?
do u mind give me an example?
@nog_lorp
ty i will try to search some engines
_________________
w8 baby.com Banner contest, Come join NOW!!
Check us out for Prize deatils |
|
Back to top |
|
 |
GMZorita Grandmaster Cheater Supreme
Reputation: 0
Joined: 21 Mar 2007 Posts: 1361
|
Posted: Sun Nov 23, 2008 7:36 am Post subject: |
|
|
Bizarro wrote: | @ GMZorita
as i mentioned in the first post, i prefer not to do this for many reasons...
sendkey is only the simplest one to start with. it becomes much more troublesome with loops and functions/api call. |
I know just wanted to share
_________________
Gone |
|
Back to top |
|
 |
Bizarro I post too much
Reputation: 0
Joined: 01 May 2007 Posts: 2648
|
Posted: Sun Nov 23, 2008 7:38 am Post subject: |
|
|
GMZorita wrote: | Bizarro wrote: | @ GMZorita
as i mentioned in the first post, i prefer not to do this for many reasons...
sendkey is only the simplest one to start with. it becomes much more troublesome with loops and functions/api call. |
I know just wanted to share |
ok thanks
_________________
w8 baby.com Banner contest, Come join NOW!!
Check us out for Prize deatils |
|
Back to top |
|
 |
DoomsDay Grandmaster Cheater
Reputation: 0
Joined: 06 Jan 2007 Posts: 768 Location: %HomePath%
|
|
Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sun Nov 23, 2008 8:38 am Post subject: |
|
|
Use an array of keywords and functions to use. Then you can just loop through the structs, check the keyword, then call/CreateThread the function pointer in the struct.
_________________
|
|
Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Sun Nov 23, 2008 9:44 am Post subject: |
|
|
Bizarro wrote: | @DoomsDay
i thought CE5.4 was coded in delhi. i can use their header?
do u mind give me an example?
|
the important parts of CE are in C/++. You should check it out
_________________
|
|
Back to top |
|
 |
samuri25404 Grandmaster Cheater
Reputation: 7
Joined: 04 May 2007 Posts: 955 Location: Why do you care?
|
Posted: Sun Nov 23, 2008 11:59 am Post subject: |
|
|
blankrider wrote: | Bizarro wrote: | @DoomsDay
i thought CE5.4 was coded in delhi. i can use their header? :o
do u mind give me an example?
|
the important parts of CE are in C/++. You should check it out |
The scripting is in Delphi, though, I believe.
_________________
|
|
Back to top |
|
 |
Zand Master Cheater
Reputation: 0
Joined: 21 Jul 2006 Posts: 424
|
Posted: Tue Nov 25, 2008 6:22 am Post subject: |
|
|
You will probably need to hardcode in the ones such as SHIFT, ALT, F1, F2 etc. Normal letters can be dealt with.
|
|
Back to top |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Tue Nov 25, 2008 3:09 pm Post subject: |
|
|
DoomsDay wrote: | http://en.wikipedia.org/wiki/Cheat_Engine#Scripting |
He could be talking about the C Scripting that had recently been added to CE. It's using the UnderC project. Google it.
|
|
Back to top |
|
 |
nog_lorp Grandmaster Cheater
Reputation: 0
Joined: 26 Feb 2006 Posts: 743
|
Posted: Wed Nov 26, 2008 5:35 am Post subject: |
|
|
Zand wrote: | You will probably need to hardcode in the ones such as SHIFT, ALT, F1, F2 etc. Normal letters can be dealt with. |
Check out GMZorita's code - convert from 'A' to 0x41! Amazing! You totally can't just cast to char for any one possible one digit input... totally can not! (wink)
_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish |
|
Back to top |
|
 |
Zand Master Cheater
Reputation: 0
Joined: 21 Jul 2006 Posts: 424
|
Posted: Wed Nov 26, 2008 6:39 am Post subject: |
|
|
nog_lorp wrote: | Zand wrote: | You will probably need to hardcode in the ones such as SHIFT, ALT, F1, F2 etc. Normal letters can be dealt with. |
Check out GMZorita's code - convert from 'A' to 0x41! Amazing! You totally can't just cast to char for any one possible one digit input... totally can not! (wink) |
Harhar.
I lol'd at this too.
Code: |
if(key == 0xFF)
MessageBoxA(0,"Key not found","Error",0);
|
He could have just used one last "else".
|
|
Back to top |
|
 |
|