 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
ripperwa Newbie cheater
Reputation: 0
Joined: 26 Dec 2009 Posts: 10 Location: Perth, Australia
|
Posted: Sun Aug 09, 2020 4:00 am Post subject: Embed Custom Type in Table |
|
|
Is there any way to embed a custom type for cheat engine into the table file?
I tried to add the custom type as a file to the table (which does store it) but it doesn't make that type automatically load when the table is loaded.
I realise that because the custom types are code it could be considered dangerous to automatically load the type.
I'm asking since it would make sharing the table with others much easier so that they don't have to do the manual step of loading the custom type into cheat engine.
It also could bring up problems since different people might call different types the same thing and should it then override those types?
It seems the types are stored and loaded by their name rather than some other feature (like a guid) so it makes it more likely there would be a collision.
Also if someone then changed the custom type should it change it for the table or for cheat engine in general.
Sorry if this has been discussed elsewhere, and if it has please point me to it since I couldn't find it. _________________
-----------------------------------------------------
Hey sexy mumma... Wanna kill all humans?
Bender, Futurama |
|
| Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1535
|
|
| Back to top |
|
 |
panraven Grandmaster Cheater
Reputation: 62
Joined: 01 Oct 2008 Posts: 959
|
Posted: Sun Aug 09, 2020 4:51 am Post subject: |
|
|
This is in celua.txt:
| Code: |
CustomType class (Object)
The custom type is an convertor of raw data, to a human readable interpretation.
global functions
registerCustomTypeLua(typename, bytecount, bytestovaluefunction, valuetobytesfunction, isFloat)
Registers a Custom type based on lua functions
The bytes to value function should be defined as "function bytestovalue (b1,b2,b3,b4)" and return an integer as result
The value to bytes function should be defined as "function valuetobytes (integer)" and return the bytes it should write
returns the Custom Type object
registerCustomTypeAutoAssembler(script)
Registers a custom type based on an auto assembler script. The script must allocate an "ConvertRoutine" and "ConvertBackRoutine"
returns the Custom Type object
getCustomType(typename) : Returns the custom type object, or nil if not found
properties
name: string
functiontypename: string
CustomTypeType: TCustomTypeType - The type of the script
script: string - The custom type script
scriptUsesFloat: boolean - True if this script interprets it's user side values as float
methods
byteTableToValue({bytetable},Address Optional)
valueToByteTable(value, Address Optional)
|
Probably only need registerCustomTypeLua, registerCustomTypeAutoAssembler unless you need to manipulate the type after registration.
The custom type registered by these lua function should exist only that ce instance,IIRC, not in registration that shared by all ce installed.
I guess name collision should be avoided just by using a more descriptive type name inside the script definition, eg. "ripper_decodedInteger"
btw, to avoid double registration, may try this pattern
| Code: |
if not getCustomType('type_name')then
MyCustomType = registerCustomTypeAutoAssembler[=[
... AA custom type definition ...
]=]
if not MyCustomType then error'register custom type failed' end
end
|
_________________
- Retarded. |
|
| Back to top |
|
 |
ripperwa Newbie cheater
Reputation: 0
Joined: 26 Dec 2009 Posts: 10 Location: Perth, Australia
|
Posted: Sun Aug 09, 2020 5:24 am Post subject: |
|
|
Thanks for that I didn't even realise that celua.txt existed.
I didn't want the name of the type to be too long since it makes the type column in CE look distracting which is why I had shortened it to "8B xor addr"
instead of "8 Byte Xorred with Address"
Here is what I added to the cheat tables lua for other people who are looking to do the same thing.
| Code: |
registerCustomTypeAutoAssembler([[
alloc(ConvertRoutine,1024)
alloc(ConvertBackRoutine,1024)
alloc(TypeName,256)
alloc(ByteSize,4)
alloc(UsesFloat,1)
alloc(CallMethod,1)
// Note that this type uses the address of the stored value and xors the desired value with the address to find the actual stored value
TypeName:
db '8B xor addr',0
ByteSize:
dd 8
UsesFloat:
db 0 //Change to 1 if this custom type should be treated as a float
CallMethod:
db 1 //Remove or change to 0 for legacy call mechanism
//The convert routine should hold a routine that converts the data to an integer (in eax)
//function declared as: cdecl int ConvertRoutine(unsigned char *input, PTR_UINT address);
//Note: Keep in mind that this routine can be called by multiple threads at the same time.
ConvertRoutine:
//jmp dllname.functionname
[64-bit]
//or manual:
//parameters: (64-bit)
//rcx=address of input
//rdx=address
mov rax,[rcx] //eax now contains the bytes 'input' pointed to
xor rax,rdx
ret
[/64-bit]
//The convert back routine should hold a routine that converts the given integer back to a row of bytes (e.g when the user wats to write a new value)
//function declared as: cdecl void ConvertBackRoutine(int i, PTR_UINT address, unsigned char *output);
ConvertBackRoutine:
//jmp dllname.functionname
//or manual:
[64-bit]
//parameters: (64-bit)
//ecx=input
//rdx=address
//r8=address of output
//example:
xor rcx,rdx
mov [r8],rcx //place the integer at the 4 bytes pointed to by r8
ret
[/64-bit]
]])
|
_________________
-----------------------------------------------------
Hey sexy mumma... Wanna kill all humans?
Bender, Futurama |
|
| Back to top |
|
 |
|
|
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
|
|