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 


Get Asynckeystate in ASM

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
shakib187
Expert Cheater
Reputation: 0

Joined: 24 May 2007
Posts: 215

PostPosted: Mon Apr 27, 2015 9:26 am    Post subject: Get Asynckeystate in ASM Reply with quote

Code:

pushad
pushfd
push 'x'
call GetAsyncKeyState
shr ax,#15
cmp ax,1
popfd
popad
jne originalcode
mov [eax+000000AC],(float)10
mov eax,[eax+000000AC]
jmp returnhere

originalcode:
mov [eax+000000AC],(float)85
mov eax,[eax+000000AC]

exit:
jmp returnhere

"game.exe"+297E0C:
jmp newmem
nop
returnhere:


ax always = 1 for some reason my key is not pressed!!!
Back to top
View user's profile Send private message
Fresco
Grandmaster Cheater
Reputation: 4

Joined: 07 Nov 2010
Posts: 600

PostPosted: Mon Apr 27, 2015 9:53 am    Post subject: Reply with quote

You're calling the function the wrong way.

Code:
push 0x58
call GetAsyncKeyState
shr ax,#15
cmp ax,1
jne originalcode


Do it either by by explicitly specifying the Virtual-Key Codes or by pushing the letters in uppercase like "push 'X'" not "push 'x'"

https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731%28v=vs.85%29.aspx

_________________
... Fresco
Back to top
View user's profile Send private message
shakib187
Expert Cheater
Reputation: 0

Joined: 24 May 2007
Posts: 215

PostPosted: Mon Apr 27, 2015 10:16 am    Post subject: Reply with quote

Fresco wrote:
You're calling the function the wrong way.

Code:
push 0x58
call GetAsyncKeyState
shr ax,#15
cmp ax,1
jne originalcode


Do it either by by explicitly specifying the Virtual-Key Codes or by pushing the letters in uppercase like "push 'X'" not "push 'x'"

https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731%28v=vs.85%29.aspx


still not working ax is always 1
Back to top
View user's profile Send private message
Fresco
Grandmaster Cheater
Reputation: 4

Joined: 07 Nov 2010
Posts: 600

PostPosted: Mon Apr 27, 2015 10:22 am    Post subject: Reply with quote

While you debug keep x pressed at all times.

Otherwise find some other code to test the function.

Try the CE Trainer.

First step, make a code that increases health with 1 whenever you press x, keep in mind that the place where you inject the code has to be constantly in execution, so find a code that accesses not writes, it also have to access the address no matter if the game is paused...

_________________
... Fresco
Back to top
View user's profile Send private message
shakib187
Expert Cheater
Reputation: 0

Joined: 24 May 2007
Posts: 215

PostPosted: Mon Apr 27, 2015 10:24 am    Post subject: Reply with quote

Fresco wrote:
While you debug keep x pressed at all times.

Otherwise find some other code to test the function.

Try the CE Trainer.

First step, make a code that increases health with 1 whenever you press x, keep in mind that the place where you inject the code has to be constantly in execution, so find a code that accesses not writes, it also have to access the address no matter if the game is paused...


While I debug? what do you mean by this??

and okay I'll go try and make a script that will increase by 1

and its in constant execution.

edit: nvm I got it, apparently you couldnt have pushfd


Last edited by shakib187 on Mon Apr 27, 2015 10:26 am; edited 1 time in total
Back to top
View user's profile Send private message
Geri
Moderator
Reputation: 111

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Mon Apr 27, 2015 10:25 am    Post subject: Reply with quote

First of all, you have used popfd before the jne instruction, which means that you have made the compare and then deleted the result of the compare. popfd has to come after the jump.

Here is my template:

pushfd
pushad
push '1'
call GetAsyncKeyState
shr ax,#15
cmp ax,1
popad
jne originalcode

...
popfd



If that won't fix it, then replace #15 with (int)15.

_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.


Last edited by Geri on Mon Apr 27, 2015 10:26 am; edited 1 time in total
Back to top
View user's profile Send private message
Fresco
Grandmaster Cheater
Reputation: 4

Joined: 07 Nov 2010
Posts: 600

PostPosted: Mon Apr 27, 2015 10:25 am    Post subject: Reply with quote

the fact that CE tells you the value of ax is called "debugging"

By snooping around the code of a program it is said that you "debug" said program.

_________________
... Fresco
Back to top
View user's profile Send private message
shakib187
Expert Cheater
Reputation: 0

Joined: 24 May 2007
Posts: 215

PostPosted: Mon Apr 27, 2015 10:28 am    Post subject: Reply with quote

Thanks Geri, that was it.

Thanks Fresco also
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 Gamehacking 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