Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[c++]reflection ability

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Bizarro
I post too much
Reputation: 0

Joined: 01 May 2007
Posts: 2648

PostPosted: Sun Nov 23, 2008 3:15 am    Post subject: [c++]reflection ability Reply with quote

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 Confused


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
View user's profile Send private message
nog_lorp
Grandmaster Cheater
Reputation: 0

Joined: 26 Feb 2006
Posts: 743

PostPosted: Sun Nov 23, 2008 5:22 am    Post subject: Reply with quote

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
View user's profile Send private message
GMZorita
Grandmaster Cheater Supreme
Reputation: 0

Joined: 21 Mar 2007
Posts: 1361

PostPosted: Sun Nov 23, 2008 6:47 am    Post subject: Re: [c++]reflection ability Reply with quote

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
View user's profile Send private message
DoomsDay
Grandmaster Cheater
Reputation: 0

Joined: 06 Jan 2007
Posts: 768
Location: %HomePath%

PostPosted: Sun Nov 23, 2008 6:53 am    Post subject: Reply with quote

CE 5.4 has such support (needless to say what you could do Razz).
Also: you might want to use header files.
Back to top
View user's profile Send private message
Bizarro
I post too much
Reputation: 0

Joined: 01 May 2007
Posts: 2648

PostPosted: Sun Nov 23, 2008 7:04 am    Post subject: Reply with quote

@ 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? Surprised
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
View user's profile Send private message
GMZorita
Grandmaster Cheater Supreme
Reputation: 0

Joined: 21 Mar 2007
Posts: 1361

PostPosted: Sun Nov 23, 2008 7:36 am    Post subject: Reply with quote

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
View user's profile Send private message
Bizarro
I post too much
Reputation: 0

Joined: 01 May 2007
Posts: 2648

PostPosted: Sun Nov 23, 2008 7:38 am    Post subject: Reply with quote

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
View user's profile Send private message
DoomsDay
Grandmaster Cheater
Reputation: 0

Joined: 06 Jan 2007
Posts: 768
Location: %HomePath%

PostPosted: Sun Nov 23, 2008 8:15 am    Post subject: Reply with quote

http://en.wikipedia.org/wiki/Cheat_Engine#Scripting
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sun Nov 23, 2008 8:38 am    Post subject: Reply with quote

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
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Sun Nov 23, 2008 9:44 am    Post subject: Reply with quote

Bizarro wrote:
@DoomsDay
i thought CE5.4 was coded in delhi. i can use their header? Surprised
do u mind give me an example?


the important parts of CE are in C/++. You should check it out

_________________
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Sun Nov 23, 2008 11:59 am    Post subject: Reply with quote

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.

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
Zand
Master Cheater
Reputation: 0

Joined: 21 Jul 2006
Posts: 424

PostPosted: Tue Nov 25, 2008 6:22 am    Post subject: Reply with quote

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
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Tue Nov 25, 2008 3:09 pm    Post subject: Reply with quote

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
View user's profile Send private message
nog_lorp
Grandmaster Cheater
Reputation: 0

Joined: 26 Feb 2006
Posts: 743

PostPosted: Wed Nov 26, 2008 5:35 am    Post subject: Reply with quote

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
View user's profile Send private message
Zand
Master Cheater
Reputation: 0

Joined: 21 Jul 2006
Posts: 424

PostPosted: Wed Nov 26, 2008 6:39 am    Post subject: Reply with quote

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. Smile
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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites