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 


Can't use define() with aobscanmodule()

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Praefator
Newbie cheater
Reputation: 0

Joined: 26 Feb 2016
Posts: 10

PostPosted: Sat Mar 19, 2016 3:03 pm    Post subject: Can't use define() with aobscanmodule() Reply with quote

So I'm trying to clean up my AA script by moving the array of bytes to a definition above the [ENABLE] section but when I'm activating the script the injection does not happen.

Code:

define(aobbytes,D9 96 E0 00 00 00 D9 EE)

[ENABLE]
aobscanmodule(aob,Game.exe,aobbytes)
alloc(newmem,$1000)


I'm certain it must be a noob issue but I can't solve it by myself.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sat Mar 19, 2016 3:15 pm    Post subject: Reply with quote

Seems "aobbyte" is the issue. Use any other word. Smile
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Mar 19, 2016 3:15 pm    Post subject: Reply with quote

lines with aobscan, aobscanmodule, aobscanregion are executed before interpreting other lines.

Quote:

//6.3: do the aobscans first
//this will break scripts that use define(state,33) aobscan(name, 11 22 state 44 55), but really, live with it


link: https://github.com/cheat-engine/cheat-engine/blob/c24e35f71c5a4fc8acc54b7b66ae34a1723259ab/Cheat%20Engine/autoassembler.pas#L1323


 

_________________
Back to top
View user's profile Send private message MSN Messenger
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sat Mar 19, 2016 3:24 pm    Post subject: Reply with quote

So what's special about the word "aobbyte" which causes the script to not activate at all?
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Mar 19, 2016 3:30 pm    Post subject: Reply with quote



When you paste that string, CE will group it like this:

step1
ao bb yt es

step2
A? BB ?? E?

step3
memoryscanner, type aob, pattern A? BB ?? E?, get the first occurrence.






this will work
Code:
aobscan(test, 01 02 03 04 05 06 07 08 09)

pattern passed to memoryscanner is
01 02 03 04 05 06 07 08 09



this won't
Code:
define(blabla,06)
aobscan(test, 01 02 03 04 05 blabla 07 08 09)

pattern passed to memoryscanner is
01 02 03 04 05 B? AB ?A 07 08 09

_________________


Last edited by mgr.inz.Player on Sat Mar 19, 2016 3:36 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
Praefator
Newbie cheater
Reputation: 0

Joined: 26 Feb 2016
Posts: 10

PostPosted: Sat Mar 19, 2016 3:34 pm    Post subject: Reply with quote

I see... So this is why it was activating but nothing happened at the expected address.

Bummer...

Thank You, mgr.inz.Player! Smile
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Mar 19, 2016 3:43 pm    Post subject: Reply with quote

You can use several {$lua} blocks. Like this:

Code:

{$lua}
myAOBSignature='D9 96 E0 00 00 00 D9 EE'
myAobscanmodule="aobscanmodule(aob,Game.exe,"..myAOBSignature..")"
return "define(aobbytes,"..myAOBSignature..")"
{$asm}

[ENABLE]
{$lua}
return myAobscanmodule
{$asm}
alloc(newmem,$1000)

_________________
Back to top
View user's profile Send private message MSN Messenger
Praefator
Newbie cheater
Reputation: 0

Joined: 26 Feb 2016
Posts: 10

PostPosted: Sat Mar 19, 2016 4:07 pm    Post subject: Reply with quote

Interesting... I guess I could try to use Lua to clean up my code.
This way the define statement becomes unnecessary.

Thank you.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sat Mar 19, 2016 6:08 pm    Post subject: Reply with quote

How often are you referring to your AOB anyway?
Should only be once. Smile
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