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 


Reading and saving bytes that were AOB scanned

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
nocw
How do I cheat?
Reputation: 0

Joined: 24 Nov 2024
Posts: 1

PostPosted: Sun Nov 24, 2024 4:02 am    Post subject: Reading and saving bytes that were AOB scanned Reply with quote

Code:

[ENABLE]

aobscanmodule(INJECT,Game.exe,F3 41 ? ? ? ? ? ? ? 41 38)
alloc(newmem,$1000,INJECT)

label(code)
label(return)

newmem:

code:
  //movss [r14+000006C8],xmm0
  jmp return

INJECT:
  jmp newmem
  nop 4
return:
registersymbol(INJECT)

[DISABLE]

INJECT:
  db F3 41 0F 11 86 C8 06 00 00

unregistersymbol(INJECT)
dealloc(newmem)


I have this script. There is a problem because it writes wrong bytes on DISABLE section. Actually I need to wrote original bytes there but it's not static and might be not F3 41 0F 11 86 C8 06 00 00. I tried to use readmem with originalcode label, but no success.
Back to top
View user's profile Send private message
Game Hacking Dojo
Expert Cheater
Reputation: 1

Joined: 17 Sep 2023
Posts: 240

PostPosted: Sun Nov 24, 2024 8:07 am    Post subject: Reply with quote

The approach to solving this is to store the bytes in memory and read them when done

Code:
[Enable]
...
alloc(old_bytes, 9, INJECT)    //allocating (assigning) memory to fit the old bytes

old_bytes:
  readmem(INJECT, 9)    //storing the original bytes at the injection address

...

[Disable]
INJECT:
  readmem(old_bytes, 9)    //restoring the original bytes
Back to top
View user's profile Send private message Visit poster's website
ParkourPenguin
I post too much
Reputation: 147

Joined: 06 Jul 2014
Posts: 4570

PostPosted: Sun Nov 24, 2024 12:30 pm    Post subject: Reply with quote

If you want to execute the original code, use `reassemble(address)` within the code injection. The behaviour of some machine code changes depending on the address it's located at. `reassemble` will preserve the behaviour but not necessarily the bytes.

Still use `readmem` for backing up and restoring the original bytes as Game Hacking Dojo said.

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