Aobscan and writeBytes

Want Cheat Engine to do something specific and no idea how to do that, ask here. (From simple scripts to full trainers and extensions)
Post Reply
Reclaimer Shawn
Cheater
Cheater
Posts: 29
Joined: Fri Feb 23, 2018 9:41 am
Reputation: 1

Aobscan and writeBytes

Post by Reclaimer Shawn » Sat Aug 03, 2019 3:44 am

So, I wanted to create a script that writes to addresses near an AOBScan signature. Here's my AOBScan Code:

Code: Select all

[ENABLE]
aobscan(EnemyData, 80 00 03 40 00 00 00 01 80 4A BD DC 80 83 36 08 80 4A 86 98 00 00 00 01 80 4A BD DC 80 83 36 18 80 00 C6 28 00 00 00 00 00 00 00 02 80 83 36 38 80 1F C5 4C 00 00 00 00 00 00 00 00 00 00 00 00 80 4A 86 CC)
label(_EnemyData)
registersymbol(_EnemyData)

EnemyData:
_EnemyData:

[DISABLE]
unregistersymbol(_EnemyData)
Let's say I want to write the address that is 0x6C bytes away from this signature. How would I go about doing that? I tried through all of these ways, but they don't work for me:

Code: Select all

writeBytes(_EnemyData+6C,01,01)
writeBytes("_EnemyData+6C",01,01)
writeBytes(EnemyData+6C,01,01)
writeBytes("EnemyData+6C",01,01)
The EnemyData address would need to be stored as a global variable, as this will be subsequently accessed by several different functions.

MartaLabieniec
Expert Cheater
Expert Cheater
Posts: 157
Joined: Sat Oct 06, 2018 3:19 pm
Reputation: 82

Re: Aobscan and writeBytes

Post by MartaLabieniec » Tue Aug 06, 2019 9:50 am

Your AOB signature is: EnemyData.

So if you want to write the address that is 0x6C bytes away from signature, just write like this:

EnemyData+6C:

And that is all!

MartaLabieniec
Expert Cheater
Expert Cheater
Posts: 157
Joined: Sat Oct 06, 2018 3:19 pm
Reputation: 82

Re: Aobscan and writeBytes

Post by MartaLabieniec » Tue Aug 06, 2019 9:51 am

And to write bytes in this address, just write like this:

EnemyData+6C:
db 01 01 01

01 01 01 - are an example of bytes.

User avatar
SunBeam
Administration
Administration
Posts: 2946
Joined: Sun Feb 04, 2018 7:16 pm
Reputation: 1311

Re: Aobscan and writeBytes

Post by SunBeam » Wed Aug 07, 2019 10:06 am

writeBytes is Lua syntax :) So:

Code: Select all

[ENABLE]
aobscan(EnemyData, 80 00 03 40 00 00 00 01 80 4A BD DC 80 83 36 08 80 4A 86 98 00 00 00 01 80 4A BD DC 80 83 36 18 80 00 C6 28 00 00 00 00 00 00 00 02 80 83 36 38 80 1F C5 4C 00 00 00 00 00 00 00 00 00 00 00 00 80 4A 86 CC)
label(_EnemyData)
registersymbol(_EnemyData)

EnemyData:
_EnemyData:

[DISABLE]
unregistersymbol(_EnemyData)
The above will do the ASM part. I recommend using "aobscanmodule" if you know the AOB is inside a certain game module. Else, if this is what I believe an Unity game (correct?), you can use aobscan. Just note that some of the code may be available only after being JIT-ed.

Now for Lua:

Code: Select all

local t = getAddress( "symbol" ) -- you need first to get the address
writeBytes( t + 0x6C, 1, 1 )
-- or directly
writeBytes( getAddress( "_EnemyData" ) + 0x6C, 1, 1 )
If you wanna do this in ASM, then use what Marta said: _EnemyData+6C: db 01 01.

Cheers,
Sun

Post Reply

Who is online

Users browsing this forum: No registered users