 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Akami23 Newbie cheater
Reputation: 0
Joined: 19 Jan 2015 Posts: 18
|
Posted: Tue Jul 24, 2018 2:07 am Post subject: How to call two functions in the same script? |
|
|
How I can merge two different function calls in the same asm script and make them run one after another with delay of 500 ms?
| Code: | [ENABLE]
alloc(Function01,256,Game.exe)
registersymbol(Function01)
alloc(Datastack,16)
registersymbol(Datastack)
Function01:
pop r15
sub rsp,30
mov rdx,Datastack
call 1417796C0
add rsp,30
push r15
ret
Datastack:
db 01 D0 00 00 FF FF FF FF 6E 00 00 00
[DISABLE]
dealloc(Function01)
unregistersymbol(Function01)
dealloc(Datastack)
unregistersymbol(Datastack) |
| Code: | [ENABLE]
alloc(Function02,512,Game.exe)
registersymbol(Function02)
alloc(StackDataAOB02,256)
registersymbol(StackDataAOB02)
Function02:
sub rsp,58
mov rcx,[Game.exe+4772D78]
lea rdi,[StackDataAOB02+30]
lea rdx,[StackDataAOB02]
mov r8,rdi
call 140978500
add rsp,58
ret
StackDataAOB02+30:
db 01 80 06 10 FF FF FF
CREATETHREAD(Function02)
[DISABLE]
dealloc(Function02)
unregistersymbol(Function02)
dealloc(StackDataAOB02)
unregistersymbol(StackDataAOB02) |
I tried everything, but they either ignore arguments or just crash or both.
|
|
| Back to top |
|
 |
OldCheatEngineUser Whateven rank
Reputation: 20
Joined: 01 Feb 2016 Posts: 1586
|
Posted: Tue Jul 24, 2018 2:33 am Post subject: |
|
|
registersymbol the address and call it.
_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
| STN wrote: | | i am a sweetheart. |
|
|
| Back to top |
|
 |
Akami23 Newbie cheater
Reputation: 0
Joined: 19 Jan 2015 Posts: 18
|
Posted: Tue Jul 24, 2018 7:01 am Post subject: |
|
|
| Thank you for suggestion. How does using symbols would fix crash and accepting arguments compared to the version with normal addresses? What about delay?
|
|
| Back to top |
|
 |
TheyCallMeTim13 Wiki Contributor
Reputation: 51
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Tue Jul 24, 2018 7:09 am Post subject: |
|
|
For a delay, just call the windows sleep api.
| Code: | push #1000
call sleep |
64 bit
| Code: | mov rcx,#1000
call sleep |
As for merging, you'll need to figure out what needs to be passed and pass that as arguments. I think @OldCheatEngineUser was saying to store the bases/addresses needed, to be used when calling the function.
_________________
|
|
| Back to top |
|
 |
Akami23 Newbie cheater
Reputation: 0
Joined: 19 Jan 2015 Posts: 18
|
Posted: Tue Jul 24, 2018 7:21 am Post subject: |
|
|
I mean I'm already passing these arguments and both of these scripts works perfectly fine separately, but they don't as part of the one script. It's 64 and I tried:
mov rcx,#1000
call sleep
Instantly crash anywhere I put it.
|
|
| Back to top |
|
 |
TheyCallMeTim13 Wiki Contributor
Reputation: 51
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Tue Jul 24, 2018 7:47 am Post subject: |
|
|
Are you sure the first one works, there is no "createThread" call so the code never seems to execute, from what I can tell.
But just to test I would start with something like this and work form there.
| Code: | <?xml version="1.0" encoding="utf-8"?>
<CheatTable>
<CheatEntries>
<CheatEntry>
<ID>0</ID>
<Description>"1"</Description>
<LastState/>
<Color>008000</Color>
<VariableType>Auto Assembler Script</VariableType>
<AssemblerScript>[ENABLE]
alloc(Function01,256,Game.exe)
registersymbol(Function01)
alloc(Datastack,16)
registersymbol(Datastack)
Function01:
pop r15
sub rsp,30
mov rdx,Datastack
call 1417796C0
add rsp,30
push r15
ret
Datastack:
db 01 D0 00 00 FF FF FF FF 6E 00 00 00
[DISABLE]
dealloc(Function01)
unregistersymbol(Function01)
dealloc(Datastack)
unregistersymbol(Datastack)
</AssemblerScript>
</CheatEntry>
<CheatEntry>
<ID>1</ID>
<Description>"2"</Description>
<LastState/>
<Color>008000</Color>
<VariableType>Auto Assembler Script</VariableType>
<AssemblerScript>[ENABLE]
alloc(Function02,512,Game.exe)
registersymbol(Function02)
alloc(StackDataAOB02,256)
registersymbol(StackDataAOB02)
Function02:
sub rsp,58
mov rcx,[Game.exe+4772D78]
lea rdi,[StackDataAOB02+30]
lea rdx,[StackDataAOB02]
mov r8,rdi
call 140978500
add rsp,58
ret
StackDataAOB02+30:
db 01 80 06 10 FF FF FF
// CREATETHREAD(Function02)
[DISABLE]
dealloc(Function02)
unregistersymbol(Function02)
dealloc(StackDataAOB02)
unregistersymbol(StackDataAOB02
</AssemblerScript>
</CheatEntry>
<CheatEntry>
<ID>3</ID>
<Description>"3"</Description>
<LastState/>
<Color>008000</Color>
<VariableType>Auto Assembler Script</VariableType>
<AssemblerScript>{
Process : -
Module :
Game Title : GAME_TITLE
Game Version : GAME_VERSION
CE Version : 6.81
Script Version : 0.0.1
Date : 07/24/18
Author : TheyCallMeTim13
Name :
}
{$STRICT}
////
//// ------------------------------ ENABLE ------------------------------
[ENABLE]
alloc(memThread, 0x400)
label(threadStart)
memThread:
threadStart:
call Function01
mov rcx,#1000
call sleep
call Function02
ret
createThread(threadStart)
////
//// ------------------------------ DISABLE ------------------------------
[DISABLE]
dealloc(memThread)
</AssemblerScript>
</CheatEntry>
</CheatEntries>
</CheatTable>
|
EDIT:
Other then that, I'd say set a breakpoint follow it and see where it's actually crashing.
_________________
|
|
| Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4724
|
Posted: Tue Jul 24, 2018 8:27 am Post subject: |
|
|
Make sure you're following Windows x64 calling conventions. Among other things, the stack needs to be aligned on a 16 byte boundary at the call, and there should be 32 bytes of shadow space on the stack for the callee.
Use breakpoints to figure out where (and maybe why) it's crashing.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
| Back to top |
|
 |
|
|
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
|
|