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 


Custom AA Command for MemoryRecord update/creation

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

Joined: 01 Oct 2008
Posts: 667

PostPosted: Tue Nov 03, 2015 5:23 am    Post subject: Custom AA Command for MemoryRecord update/creation Reply with quote

This is an AA Command extension to allow MemoryRecord manipulation in AA Script.

The command is MemoryRecord or MR, format:
Code:
MemoryRecord(mr-description-path,record-property-list)


The mr-description-path is a collection of memory record description lua regular expression separated by symbol '/'.

It is in lua regular expression so that the matching need not be complete and exact.

For example, if the following is current address list:
Code:

-GAMEZ
 +-32bit
    +-Folder1
    +-Folder2  -- (a)
    +-OHK
 +-64-bit
    +-Folder1  -- (b)
    +-Folder2
    +-money   -- (c)

GAMEZ/32/Folder2 match (a)
GAME/64/Folder    match (b) 
GAMEZ/64%-bit/money match (c)   , note that the minus sign need to be escape with lua re symbol %


If the memory record expressed by the desc-path not exist, it will be created. Then the record will be update with properties specified on activating. Note that the update will be done even the script activate fail.

record-property-list is the key-value pairs expressed as KEY=VALUE separated by comma ','

The following is an example, if the 64 bit ce is attached to itself , ie, cheatengine-x86_64.exe:

Code:
MR(ABC/DEF,Type=vtByteArray,Address="cheatengine-x86_64.exe",Aob.Size=10)


Check main.lua at ce directory or https://raw.githubusercontent.com/cheat-engine/cheat-engine/master/Cheat%20Engine/bin/main.lua for the property of Memory Record.

The following is Memory Record Type defined in define.lua at ce directory:
Code:
vtByte=0
vtWord=1
vtDword=2
vtQword=3
vtSingle=4
vtDouble=5
vtString=6
vtUnicodeString=7 --Only used by autoguess
vtByteArray=8
vtBinary=9
vtAutoAssembler=11
vtPointer=12 --Only used by autoguess and structures
vtCustom=13
vtGrouped=14

If the MRAA.lua file has been load as table file in a *.ct, the following script can load & run it.
Code:
function loadTableFile(n,mode)
  local hdr = 'loadTableFile: '
  assert(type(n)=='string',hdr.."input should be a string -"..tostring(n).." of "..type(n))
  local m = assert(findTableFile(n),hdr.."can't find table file -"..n).Stream
  m = assert(readStringLocal(m.Memory,m.Size),hdr.."can't read content -"..n)
  if type(mode)~='boolean' then return m end
  m = assert(loadstring(m,n),hdr.."lua script load fail -"..n)
  return mode and m() or m
end

loadTableFile("MRAA.lua",true)
,


Sorry, not a detailed explain~


FIXED:
sorry, left an external function in the script, updated.

_________________
- Retarded.
dropbox
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 -> Lua 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