Mono:Mono Lua

From Cheat Engine
Revision as of 10:51, 19 April 2015 by Jgoemat (talk | contribs)
Jump to navigation Jump to search

The advanced MONO features of Cheat Engine are controlled by the "monoscript.lua" script in the autorun directory where cheat engine is installed. When you attach to a process, the script scans for "mono.dll". If it is found, the appropriate MonoDataDissector dll from the autorun directory is injected into the process which creates a named pipe waiting for a connection. The LUA code then connects to the pipe and messages are exchanged to perform the mono functions.

Main Methods

LaunchMonoDataCollector()
this is some
information
varType = monoTypeToVarType(monoType)
Returns the Cheat Engine type (vtString, vtByte, vtWorkd, vtDword, vtSingle, vtDouble, vtPointer) for the given mono type
result = LaunchMonoDataCollector()
injects the dll and returns 0 for failure, or monoBase returned from the CMD_INITMONO command on the pipe

mono_object_getClass(address) -- returns classaddress, classname (or nil) -- given the address of an object in memory,

mono_enumDomains() -- returns a table array of domainaddress for each domain in the game

mono_setCurrentDomain(domainaddress) -- returns ? (result of MONOCMD_SETCURRENTDOMAIN) -- sets the domain the MonoDataCollector will use

mono_enumAssemblies() -- returns table of assemblyaddress for each assembly in the current domain from the MonoDataCollector

mono_getImageFromAssembly(assemblyaddress) -- returns the imageaddress for the passed assembly

mono_image_get_name(imageaddress) -- returns the name of the assembly with the given imageaddress

mono_image_enumClasses(imageaddress) -- returns a table of classaddress for classes in the given assembly image

mono_class_getName(classaddress) -- returns the class name as a string

mono_class_getNamespace(classaddress) -- returns the namespace of the given class as a string

mono_class_getParent(classaddress) -- returns the classaddress of the parent class of the given class

mono_class_getStaticFieldAddress(domainaddress, classaddress) -- returns the base address for a special area that stores static addresses for a given class -- for example if you have a class that has 5 static fields, their offsets will be added to this base address to get the memory location

mono_class_enumFields(classaddress) -- returns a table of field objects for fields in the given class

mono_class_enumMethods(classaddress) -- returns a table of method objects for the methods in the given class

mono_getJitInfo(address) --


Cheat Engine Hooks

mono_structureDissectOverrideCallback(structure, baseaddress)
Called by CE when a structure is being dissected to fill in the values if we know the structure
Returns true if the structure members were defined, nil if not
Calls mono_object_findRealStartOfObject(baseaddress), mono_class_enumFields(classaddress), monoTypeToVarType(monotype)
mono_structureNameLookupCallback(address)
Returns classname,currentaddress (the real base address) or nil
Called by CE when creating a new structure in the structure dissector

mono_symbolLookupCallback(symbol) -- returns pointer or nil -- called by CE when it is trying to find the address to go with a symbol -- calls mono_findMethod and mono_compile_method

mono_addressLookupCallback(address) -- returns string -- called by CE in the disassembly window to show a symbol name for the address -- calls mono_getJitInfo(address), mono_method_getClass(method), mono_class_GetName(class), mono_class_GetNamespace(class), mono_method_getName(method)