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 


Any way to include custom Value Type in a cheat table?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
otb
Advanced Cheater
Reputation: 2

Joined: 27 Jan 2015
Posts: 70

PostPosted: Sun Jun 21, 2015 7:07 pm    Post subject: Any way to include custom Value Type in a cheat table? Reply with quote

As the topic says, is it possible to include a usable (Auto Assembler) custom Value Type in a .CT file?
I've searched and don't really come up with a whole lot of information. Most of the results I got were for Dragon Age Inquisition and Civ Beyond.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25785
Location: The netherlands

PostPosted: Sun Jun 21, 2015 7:19 pm    Post subject: Reply with quote

yes, your table can include a lua script and in there use registerCustomTypeAutoAssembler() to temporarily add a new custom type to CE (it will be forgotten when CE closes)

e.g:
Code:

registerCustomTypeAutoAssembler([[
alloc(TypeName,256)
alloc(ByteSize,4)
alloc(ConvertRoutine,1024)
alloc(ConvertBackRoutine,1024)

TypeName:
db 'Money',0

ByteSize:
dd 4

//The convert routine should hold a routine that converts the data to an nteger (in eax)
//function declared as: stdcall int ConvertRoutine(unsigned char *input);

//Note: Keep in mind that this routine can be called by multiple threads at the same time.

ConvertRoutine:
[32-bit]
push ebp
mov ebp,esp
push ecx
mov ecx,[ebp+8]
[/32-bit]

//at this point ecx contains the address where the bytes are stored
//save the used registers
push edx //fun fact about ce's assembler, because push ebx does not exist in 64-bit it becomes the 64-bit push rdx automatically
push ebx

//put the bytes into the eax register
mov eax,[ecx] //second fun fact, addressing with 32-bit registers doesn't work in 64-bit, it becomes a 64-bit automatically (most of the time)

xor edx,edx
mov ebx,#100
div ebx //divide eax by 100 and put the result in eax (and leftover in edx)

pop ebx
pop edx
//and now exit the routine
[64-bit]
ret
[/64-bit]
[32-bit]
pop ecx
pop ebp
ret 4
[/32-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: stdcall void ConvertBackRoutine(int i, unsigned char *output);
ConvertBackRoutine:
[32-bit]
push ebp
mov ebp,esp
push edx //save the registers
push ecx
mov edx,[ebp+0c]
mov ecx,[ebp+08]
[/32-bit]

//at this point edx contains the address to write the value to
//and ecx contains the value
push eax
push edx
push ecx

mov eax,ecx //eax gets the given value
xor edx,edx //clear edx
mov ecx,#100
mul ecx //multiply eax and put the results into edx:eax (edx is ignored for this routine)

pop ecx
pop edx
mov [edx],eax
pop eax

[64-bit]
//everything is back to what it was, so exit
ret
[/64-bit]

[32-bit]
//cleanup first
pop ecx
pop edx
pop ebp
ret 8
[/32-bit]
]])


this can be put in the lua script of the table itself (table->show cheat table lua script)
or if you like inside an auto assembler script that uses the {$lua} tag and under it the entries that make use of the type

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
otb
Advanced Cheater
Reputation: 2

Joined: 27 Jan 2015
Posts: 70

PostPosted: Sun Jun 21, 2015 7:51 pm    Post subject: Reply with quote

Dark Byte wrote:
yes, your table can include a lua script and in there use registerCustomTypeAutoAssembler() to temporarily add a new custom type to CE (it will be forgotten when CE closes)
Thanks! Worked like a charm.
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 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