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 

mini AA Macro

Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions
View previous topic :: View next topic  
Author Message
Grandmaster Cheater
Reputation: 34

Joined: 01 Oct 2008
Posts: 792

PostPosted: Fri Mar 04, 2016 4:02 pm    Post subject: mini AA Macro Reply with quote

This is a simple application of the lua function registerAssembler.

Also check this thread by mgr.inz.Player

- fix ; should not count empty line & label
- to abuse syntax highlight, require the command id follow by at least one space and an exclamation mark


-- load module
local minimacro = cerequire 'minimacro'

-- load saved macro from table file

-- define by string, can also be defined by function, but cannot save
  local reg,vtype,lbound,ubound,ret = inst:match('^ *(.-) *; *(.-) *; *(.-) *; *(.-) *$')
  if reg~=nil and reg:len()>0 and lbound:len()>0 and ubound:len()>0 then
    local jmpshort = targetIs64Bit() and 'short ' or ''
    lbound,ubound = vtype..lbound, vtype..ubound
    ret = string.format([[
    cmp  %s,%s
    jge  %[email protected]
    mov  %s,%s
    cmp  %s,%s
    jle  %[email protected]
    mov  %s,%s
  return ret~=nil and ret:gsub('&',hexaddr) or nil

-- minimacro.Save('filename') -- to save all string type macro definition into a file
   -- load the saved file into table file of the *.ct , like 'mymacro' , so that it can be reload

-- minimacro.List() -- to see what macro defined at this point

-- test


  Push ! rax;rbx;rcx;rdx;[&]
  Pop  ! rax;rbx;rcx;rdx;[&]
  // & is starting address of the current (custom or not) instruction, changed every lines
  Bound ! dword ptr[testpad+40];(float);0.1;100
  Bound ! eax;#;1;10000
  mul ! push symbol;pop rbp;jmp & //<-- relative jump, not right

since the assembling rely on rough simulation, which the generated bytes is ALWAYS located at 'scratchpad' symbol address, instead of the supplied actual starting address, the mini macro cannot work with relative address offset instruction (ie. e9 xx xx xx xx jjmp ; e8 xx xx xx xx call) that target outside the generated code block.

May be I'm ignorance, it seems ce has not a line assembler in Lua yet .... no, autoAssembler is! But currently the function will actually write the generated bytes to memory, so I'll suggest the autoAssemble function has a simulation mode, ie.

-- if second parameter is 'false', the script executed and if successes, instead of writing the generated bytes to memory, it is return as a table for further manipulation. for example, it return {{address1,bytesTable1},{address2,bytesTable2},...}



 Filename:  miniMacro.CT
 Filesize:  7.72 KB
 Downloaded:  1560 Time(s)

- Retarded.
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 Extensions 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