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 


Confusions regarding auto assembler

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Tutorials -> Auto Assembler tutorials
View previous topic :: View next topic  
Author Message
ParkourPenguin
I post too much
Reputation: 90

Joined: 06 Jul 2014
Posts: 2878

PostPosted: Sat Aug 08, 2020 11:10 am    Post subject: This post has 1 review(s) Reply with quote

q1) Generally, it's what you expect it to be such that everything works out. The only exception I can think of right now is {$lua} blocks which are more or less a preprocessor directive- whatever string those blocks return is substituted as AA code.

define(...), aobscan(...), alloc(...), and label(...) happen before most stuff. Instructions get assembled and written to memory, and registersymbol(...) happens eventually.
The script first goes through a syntax check that is pretty much a dry run (e.g. doesn't allocate or modify anything). Then it actually does what it's suppose to do.

If you're talking about the order the game executes instructions, that depends entirely on what code you've written. e.g. something basic like this:
Code:
alloc(newmem,1024)

injectionpoint:
  jmp newmem
return:

newmem:
  mov eax,4
  jmp return
The game will eventually execute the code that was at "injectionpoint" by itself on its own terms (you can't force it). When it does, the new code the script wrote to the injection point will jump to allocated memory, run the code there ("mov eax,4"), then jump back after the injection point. The game then continues on its merry way as normal.

q2) There exists code at the injection point. If there weren't, the game would never run the injection point, and your code injection is useless.
You need space to write your code. It's not common there's enough space at the injection point for you to do what you want (it's not beginner-friendly to do that correctly, either). So, the AA script allocates some memory in the target process, and you can do whatever you want there.

q3) I remember there being some way of accessing Lua variables in AA scripts, but that example you posted wouldn't work regardless. The Lua value would be converted to a string and substituted in ("fld [55.5]" doesn't make sense). You might want something like this:
Code:
floatValue:
{$lua}
return 'dd (float)' .. tostring(readFloat(address) * 2)
{$asm}
//...
newmem:
  fld dword ptr[floatValue]

_________________
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 Tutorials -> Auto Assembler tutorials 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