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 


How to Use GetAsyncKeyState in 64bit games

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Crashyyy
Newbie cheater
Reputation: 0

Joined: 17 Mar 2022
Posts: 15

PostPosted: Mon Apr 08, 2024 4:54 am    Post subject: How to Use GetAsyncKeyState in 64bit games Reply with quote

hello i never used GetAsyncKeyState before

i wanted to use Pushad & pushfd then i realized its not possible in 64bit

then can someone give me ax example to use this
for eaxmple: when i Pressed "S"

add 21 to [edx+7fffff]

Thanks....

_________________
Every soul will taste death,(كُلُّ نَفْسٍۢ ذَآئِقَةُ ٱلْمَوْتِ ۖ)
Back to top
View user's profile Send private message Send e-mail
apocalypticx
Expert Cheater
Reputation: 4

Joined: 19 Jul 2009
Posts: 117
Location: UK

PostPosted: Wed May 15, 2024 1:45 am    Post subject: Reply with quote

Here's an example from my Neverwinter Nights Remake Steam you can adapt to to other 64bit games etc, I have a 32bit version if your interested?
I also find it quite useful to have a XYZ tracker which again if you want I'll share with you?
This way you can see the XYZ to see every point in the game and just notepad down interesting locations, then manually edit the teleport cheat to where you want to teleport to!

Code:
{ Game   : nwmain.exe
  Version:
  Date   : 2024-02-22
  Author : Apocalypticx

  This script does store and teleport K=Store L=Teleport
}

[ENABLE]

aobscanmodule(storetele,nwmain.exe,F2 0F 10 87 D0 02 00 00 F2) // should be unique
alloc(newmem,$1000,storetele)

label(code)
label(return)
label(keychecker)
label(storexyz)
label(doteleport)
label(PlayerX)
label(PlayerY)
label(PlayerZ)

newmem:
pushfq              //save the flags
cmp [rdi+00000238],1      //compare against me
je keychecker             //jumnp to keychecking code
popfq               //restore the flags

code:
  movsd xmm0,[rdi+000002D0]      //original instruction
  jmp return            //jump back to gamecode

keychecker:
popfq                  //restore the flags
movsd xmm0,[rdi+000002D0]           //original instruction
pushfq                 //save the flags
push rax               //push all regsiters affected by GetAsyncKeyState
push rcx
push rdx
push r8
push r9
push r10
push r11
sub rsp,28
mov rcx,4B             //check for K keypress microsoft virtual keycodes
call GetAsyncKeyState
add rsp,28
pop r11                //restore all registers affaected by GetAsyncKeyState
pop r10
pop r9
pop r8
pop rdx
pop rcx
test ax,8001
pop rax
jnz storexyz           //jump to our store routine
popfq                 //restore the flags
pushfq                 //save the flags
push rax              //push all regsiters affected by GetAsyncKeyState
push rcx
push rdx
push r8
push r9
push r10
push r11
sub rsp,28
mov rcx,4C            //check for L keypress microsoft virtual keycodes
call GetAsyncKeyState
add rsp,28
pop r11                //restore all registers affaected by GetAsyncKeyState
pop r10
pop r9
pop r8
pop rdx
pop rcx
test ax,8001
pop rax
jnz doteleport        //jump to our teleport routine
popfq                //restore the flags
jmp return           //jump back to gamecode

storexyz:
popfq                //restore flags
push rbx             //save rbx on stack so we can use it
mov rbx,[rdi+000002D0]      //move current X into rbx
mov [PlayerX],rbx           //mov current X into our address
mov rbx,[rdi+000002D4]      //move current Y into rbx
mov [PlayerY],rbx           //move current Y into our address
mov rbx,[rdi+000002D8]      //mov current Z into rbx
mov [PlayerZ],rbx           //mov current Z into our address
pop rbx                     //restore rbx from the stack
jmp return            //jump back to gamecode

doteleport:
popfq                 //restore flags
push rbx             //save rbx on stack so we can use it
mov rbx,[PlayerX]    //move current X into rbx
mov [rdi+000002D0],rbx      //move current X into Player X position
mov rbx,[PlayerY]    //move Current Y into rbx
mov [rdi+000002D4],rbx      //move current Y into Player Y position
mov rbx,[PlayerZ]    //move current Z into rbx
mov [rdi+000002D8],rbx      //move current Z into Player Z position
pop rbx               //restore rbx from the stack
jmp return            //jump back to gamecode

PlayerX:
dd 0

PlayerY:
dd 0

PlayerZ:
dd 0
storetele:
  jmp newmem
  nop
  nop
  nop
return:
registersymbol(storetele)
registersymbol(PlayerX)
registersymbol(PlayerY)
registersymbol(PlayerZ)

[DISABLE]

storetele:
  db F2 0F 10 87 D0 02 00 00

unregistersymbol(PlayerX)
unregistersymbol(PlayerY)
unregistersymbol(PlayerZ)
unregistersymbol(storetele)
dealloc(newmem)

{
// ORIGINAL CODE - INJECTION POINT: nwmain.exe+737A2A

nwmain.exe+7379EF: 45 0F 57 E4                 - xorps xmm12,xmm12
nwmain.exe+7379F3: F3 44 0F 10 35 C4 B9 51 00  - movss xmm14,["nwmain.`InstanceLookup::List<DataPump>::active'::`2'::`dynamic atexit destructor for 's''"+6940]
nwmain.exe+7379FC: 83 BF 08 03 00 00 00        - cmp dword ptr [rdi+00000308],00
nwmain.exe+737A03: 0F 85 67 01 00 00           - jne nwmain.exe+737B70
nwmain.exe+737A09: 45 0F 28 EB                 - movaps xmm13,xmm11
nwmain.exe+737A0D: 83 BF E8 02 00 00 01        - cmp dword ptr [rdi+000002E8],01
nwmain.exe+737A14: 75 09                       - jne nwmain.exe+737A1F
nwmain.exe+737A16: F3 44 0F 10 2D E5 EF 5B 00  - movss xmm13,[nwmain.exe+CF6A04]
nwmain.exe+737A1F: 45 0F 57 D2                 - xorps xmm10,xmm10
nwmain.exe+737A23: 48 8B 9F B0 02 00 00        - mov rbx,[rdi+000002B0]
// ---------- INJECTING HERE ----------
nwmain.exe+737A2A: F2 0F 10 87 D0 02 00 00     - movsd xmm0,[rdi+000002D0]
// ---------- DONE INJECTING  ----------
nwmain.exe+737A32: F2 0F 11 44 24 48           - movsd [rsp+48],xmm0
nwmain.exe+737A38: 8B 87 D8 02 00 00           - mov eax,[rdi+000002D8]
nwmain.exe+737A3E: 89 44 24 50                 - mov [rsp+50],eax
nwmain.exe+737A42: F3 0F 10 54 24 4C           - movss xmm2,[rsp+4C]
nwmain.exe+737A48: F3 0F 10 5C 24 48           - movss xmm3,[rsp+48]
nwmain.exe+737A4E: 66 90                       - nop 2
nwmain.exe+737A50: F2 0F 10 03                 - movsd xmm0,[rbx]
nwmain.exe+737A54: 8B 43 08                    - mov eax,[rbx+08]
nwmain.exe+737A57: 89 44 24 78                 - mov [rsp+78],eax
nwmain.exe+737A5B: 0F 28 F8                    - movaps xmm7,xmm0
}
Back to top
View user's profile Send private message
Crashyyy
Newbie cheater
Reputation: 0

Joined: 17 Mar 2022
Posts: 15

PostPosted: Sun May 19, 2024 4:05 am    Post subject: Thanks mate Reply with quote

can we talk about this stuff in discord if you have
my discord:crashyyyn_byte

thanks mate

_________________
Every soul will taste death,(كُلُّ نَفْسٍۢ ذَآئِقَةُ ٱلْمَوْتِ ۖ)
Back to top
View user's profile Send private message Send e-mail
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