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 


Multiple AOB Scans in a single Script

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

Joined: 08 Feb 2021
Posts: 32

PostPosted: Mon Feb 08, 2021 2:37 pm    Post subject: Multiple AOB Scans in a single Script Reply with quote

I am a still a bit new to CheatEngine and Assembly in general so bear with me on this one. I have a game that drains a Stamina value whenever the player is running and jumping. When tracking the Stamina value, I noticed that doing different actions (ie, running, running on stairs and jumping) subtracts the Stamina value but in different locations in memory. So this leads to multiple AOB Scans and Injections in multiple areas. I created a single script to reflect this, however the programmer in me feels like there should be a better way to do this. Can you look at my script and let me know if there is a more efficient way to do this?

I tried pointer scans instead for the value but this is a Unity game and pointer scans are a nightmare.

One more question: when I use the CheatEngine Template for AOB scans, there is always a memory allocation line: alloc(newmem, INJECT). is this allocation even necessary if I am basically just nop'ing a line? what purpose does allocating memory here serve?

Sorry for the newb questions, I feel like I should probably already know this but Assembly has never been my forte. I appreciate any answers, suggestions and guidance.

Code:

[ENABLE]

aobscan(DrainOnRun, F3 0F 11 6E 50 66 0F 57 C0)
aobscan(DrainOnJump, F3 0F 11 6F 50 E9 ?? ?? ?? ?? 48 8B CE)
aobscan(DrainOnStairs,F2 0F 10 4D E8 F2 0F 59 CA F2 0F 5C C1 F2 0F 5A E8 F3 0F 11 6E 50 48)

label(returnDrainOnRun)
label(returnDrainOnJump)
label(returnDrainOnStairs)

DrainOnRun:
  jmp returnDrainOnRun

returnDrainOnRun:
  registersymbol(DrainOnRun)

DrainOnJump:
  jmp returnDrainOnJump

returnDrainOnJump:
  registersymbol(DrainOnJump)

DrainOnStairs+11:
  jmp returnDrainOnStairs

returnDrainOnStairs:
  registersymbol(DrainOnStairs)

[DISABLE]
DrainOnRun:
  db F3 0F 11 6E 50

DrainOnJump:
  db F3 0F 11 6F 50

DrainOnStairs+11:
  db F3 0F 11 6E 50

unregistersymbol(DrainOnRun)
unregistersymbol(DrainOnStairs)
unregistersymbol(DrainOnJump)
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4706

PostPosted: Mon Feb 08, 2021 2:59 pm    Post subject: Reply with quote

Whether or not there's an "easier" way to do this depends on how the game is programmed. Probably not worth looking into IMO- could take too much effort.

No need to allocate any memory if you're just noping instructions. I'd actually use nops and reorganize registersymbol(...):
Code:
aobscan...

registersymbol(DrainOnRun)
registersymbol(DrainOnJump)
registersymbol(DrainOnStairs)

DrainOnRun:
  nop 5

DrainOnJump:
  nop 5

etc...

_________________
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 -> 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