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 


[SOLVED] How to execute auto assembly inside Lua ?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Scorm
Newbie cheater
Reputation: 0

Joined: 06 Dec 2018
Posts: 11

PostPosted: Fri Dec 14, 2018 5:58 am    Post subject: [SOLVED] How to execute auto assembly inside Lua ? Reply with quote

Hello,
I have a simple AOB injection code as a script (that could have been simple replacement, but let's not focus on that).
Code:
[ENABLE]

aobscan(myLabel,49 8D 44 C4 20 4C 8B 28 41 C6 45 31 00 FF C3)
alloc(newmem,$1000)

label(code)
label(return)

newmem:
  mov byte ptr [r13+31],01
  jmp return

code:
  mov byte ptr [r13+31],00
  jmp return

myLabel+8:
  jmp newmem
return:

[DISABLE]

myLabel+8:
  db 41 C6 45 31 00

dealloc(newmem)


Now, I want to use it in a cheat table Lua script to make a custom trainer (of course, it works with the generic trainer maker but reading the code generated by it didn't help).
So, I tried using the AA syntax ($asm} to switch between Lua/ASM, however it doesn't look compilable.

How can I do the AOB injection toggling function inside a lua code while still keeping auto assembler code for the instructions ? I don't mind if your answer contains the lua aob scan functions, though.


Code:

-- Toggle
local activated = 0
function CEToggleBox1Click(sender)
  -- ENABLE
  if (activated == 0) then
    {$asm}
    aobscan(myLabel,49 8D 44 C4 20 4C 8B 28 41 C6 45 31 00 FF C3)
    alloc(newmem,$1000)

    label(code)
    label(return)

    newmem:
      mov byte ptr [r13+31],01
      jmp return

    code:
      mov byte ptr [r13+31],00
      jmp return

    myLabel+8:
      jmp newmem

    return:
    {$lua}
    activated = 1

  -- DISABLE
  else
    {$asm}
    myLabel+8:
    db 41 C6 45 31 00

    dealloc(newmem)
    {$lua}
    activated = 0
  end
end



Unfortunately, the generic trainer maker sets a hotkey in the cheat table so it actually displaces the issue because I want to make an executable without modifying the cheat tables and coding the functionalities.


Last edited by Scorm on Fri Dec 14, 2018 10:12 am; edited 1 time in total
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 68

Joined: 06 Jul 2014
Posts: 2238

PostPosted: Fri Dec 14, 2018 9:25 am    Post subject: Reply with quote

Use the autoAssemble Lua function.
https://forum.cheatengine.org/viewtopic.php?t=604767

_________________
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
Scorm
Newbie cheater
Reputation: 0

Joined: 06 Dec 2018
Posts: 11

PostPosted: Fri Dec 14, 2018 10:12 am    Post subject: Reply with quote

Great, thank you !
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