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 


combining two AA scripts into one is failing

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> Auto Assembler tutorials
View previous topic :: View next topic  
Author Message
sgsgwv$6263
Advanced Cheater
Reputation: 0

Joined: 05 Aug 2020
Posts: 82

PostPosted: Sun Dec 22, 2024 3:42 am    Post subject: combining two AA scripts into one is failing Reply with quote

Hi cheat engineers, I am trying to combine two AA scripts into one, But the game crashes everytime I enable it. I have renamed labels correctly. But there is something else wrong. Below is my combined script:

Code:

{ Game   : GTA5.exe
  Version:
  Date   : 2024-12-22

  This script does blah blah blah
}

[ENABLE]

aobscanmodule(fallVectorInject,GTA5.exe,0F 58 44 01 10 0F 29 44 01 10 48) // should be unique
aobscanmodule(PlayerSpeedInject,GTA5.exe,8B 48 08 89 4B 08 8B 40 0C 89 43 0C EB) // should be unique
alloc(newmemForFall,$1000,fallVectorInject)
alloc(newmem,$1000,"GTA5.exe"+8F1D8F)
alloc(PlayerRax,8)
alloc(Playerbase,8)
alloc(minH,4)
alloc(fallBase,4)
registerSymbol(fallBase)
registersymbol(PlayerRax)
registersymbol(Playerbase)
label(codeForFall)
label(returnForFall)


newmem:

sub rsp,20
movups [rsp],xmm0
movups [rsp+10],xmm1

movss xmm1,[rdi+280]
movss xmm0,[minH]
ucomiss xmm1,xmm0
jb code

cmp [rax],0
je code

mov [Playerbase],rdi
mov [PlayerRax],rax

code:
  movups xmm1,[rsp+10]
  movups xmm0,[rsp]
  add rsp,20

  mov ecx,[rax+08]
  mov [rbx+08],ecx
  jmp return

newmemForFall:

cmp r13,[PlayerRax]
jne codeForFall

mov [fallBase],r13
je codeForFall


codeForFall:
  addps xmm0,[rcx+rax+10]
  jmp returnForFall

fallVectorInject:
  jmp newmemForFall
returnForFall:
registersymbol(fallVectorInject)

PlayerSpeedInject:
  jmp newmem
  nop
return:
registersymbol(PlayerSpeedInject)

minH:
dd (float)380


[DISABLE]

PlayerSpeedInject:
  db 8B 48 08 89 4B 08


unregistersymbol(PlayerSpeedInject)
unregistersymbol(PlayerRax)
unregistersymbol(Playerbase)
dealloc(newmem)
dealloc(Playerbase)
dealloc(PlayerRax)
dealloc(minH)


fallVectorInject:
  db 0F 58 44 01 10

unregistersymbol(fallVectorInject)
dealloc(newmemForFall)
dealloc(fallBase)
unregistersymbol(fallBase)



Please point out what I may be doing wrong. Thanks in advance.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 148

Joined: 06 Jul 2014
Posts: 4593

PostPosted: Sun Dec 22, 2024 1:14 pm    Post subject: Reply with quote

The comments at the bottom that show the code around the injection point are important.
sgsgwv$6263 wrote:
Code:
alloc(newmem,$1000,"GTA5.exe"+8F1D8F)
You should change the third argument to PlayerSpeedInject
sgsgwv$6263 wrote:
Code:
alloc(fallBase,4)
...
mov [fallBase],r13
r13 is an 8 byte register, but since fallBase is the last alloc, it probably shouldn't cause anything to crash. Change the alloc to 8 bytes anyway
sgsgwv$6263 wrote:
Code:
code:
...
return:
These symbols were never declared as labels. Maybe CE found an already existing symbol named "code" or "return" and used that instead of implicitly declaring it a label. Put label(code) and label(return) at the top with the other labels
sgsgwv$6263 wrote:
Code:
je codeForFall


codeForFall:
Remove that `je`. It does nothing

If it still crashes, check where/why it crashes by enabling Memory Viewer -> Debug -> Break on unexpected exceptions -> Always
If that doesn't work out, pause the process ("Advanced Options" window in bottom left of main CE window), enable the script, go to fallVectorInject and PlayerSpeedInject in the disassembler, set breakpoints at the `jmp` to your code injection, resume the process, and step through your code to see what happens and where it crashes.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> Auto Assembler tutorials 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