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 seperate this AOB into multiple codes?

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

Joined: 13 Jun 2012
Posts: 36
Location: localhost

PostPosted: Tue Sep 26, 2023 3:27 am    Post subject: How to seperate this AOB into multiple codes? Reply with quote

In the game I am currently writing some cheats for, its essentially the same AOB that handles multiple codes by comparing a register.
It is not elegant by any means and needs refactoring but that comes next. I believe AOB are unique and my question is how can I create these as individual toggles?

Is it possible to have 3 empty codes in my code list and detect which ones are active or something similar?

Code:

[ENABLE]

aobscanmodule(SomeFunc,Heretics Fork.exe,48 8B 07 48 89 03 48 8B 9C) // should be unique
alloc(newmem,$1000,SomeFunc)

label(code)
label(return)
label(cardcost)
label(infinitemoney)
label(infinitehealth)

newmem:
  cmp r14,189AF //Card Cost
  je cardcost
  cmp r14,18B54 //Money count
  je infinitemoney
  cmp r14,18B92 //Health
  je infinitehealth
  jmp code

cardcost:
  push #6  //(int)
  fild [rsp]
  fstp qword ptr [rdi]
  add rsp,8
  jmp code

infinitemoney:
  push #10000  //(int)
  fild [rsp]
  fstp qword ptr [rdi]
  add rsp,8
  jmp code

infinitehealth:
  push #500  //(int)
  fild [rsp]
  fstp qword ptr [rdi]
  add rsp,8
  jmp code

code:
  mov rax,[rdi]
  mov [rbx],rax
  jmp return

SomeFunc:
  jmp newmem
  nop
return:
registersymbol(SomeFunc)

[DISABLE]

SomeFunc:
  db 48 8B 07 48 89 03

unregistersymbol(SomeFunc)
dealloc(newmem)
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4711

PostPosted: Tue Sep 26, 2023 10:36 am    Post subject: Reply with quote

Have a parent script do the injection, and have child scripts set flags that enable / disable cheats.
Code:
...
newmem:
  mov eax,[is_cheat_enabled]
  test eax,eax
  jz code
// cheat here
  mov ecx,#999
code:
// original code
  mov [rbx+4C],ecx
  jmp return

is_cheat_enabled:
  dd 0 // 0 = false, 1 = true

registersymbol(is_cheat_enabled)
...
Code:
[ENABLE]
is_cheat_enabled:
  dd 1
[DISABLE]
is_cheat_enabled:
  dd 0

You don't need to resort to x87 to move doubles.
Code:
mov rax,(double)6
mov [rdi],rax


Injecting some place further up the callstack might be better, but that's a little more advanced.

Instead of setting a certain value, you might be able to copy the addresses instead and use those in the table. (search "injection copy")

_________________
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
Kriogenic
Cheater
Reputation: -1

Joined: 13 Jun 2012
Posts: 36
Location: localhost

PostPosted: Tue Sep 26, 2023 3:56 pm    Post subject: Reply with quote

Awesome, thanks for the information. Setting flags in child scripts is working well.
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