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 


Cheat Engine Forum Index
PostGo back to topic
ParkourPenguin
I post too much
Reputation: 143
Joined: 06 Jul 2014
Posts: 4382

PostPosted: Sat Aug 08, 2020 11:10 am    Post subject:

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
Post reviews:   Approve 1
Author Review
sgsgwv$6263
Review: Approve
Post reference:
ReviewPosted: Wed Oct 14, 2020 2:33 am


Back to top
View user's profile Send private message
Display:  
Cheat Engine Forum Index


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites