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 


Problem with creating custom value type.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
ArchmageFil
How do I cheat?
Reputation: 0

Joined: 01 Dec 2018
Posts: 2

PostPosted: Sat Dec 01, 2018 11:03 pm    Post subject: Problem with creating custom value type. Reply with quote

Hi, I'm trying to create a type for a game that encrypts the values of variables.
Encryption happens like this:
ror ecx, 07
xor ecx (some key, different every game load)
rol ecx, 15

rol eax, 0B
xor eax, (some key, different every game load)
ror eax, 19
A problem has occurred in passing a key to a type.
I created a script where register Symbol key:
Code:

[ENABLE]
[ENABLE]
alloc(newmem,1024)
label(returnhere)
registerSymbol(newmem)
globalAlloc(key,4)
registerSymbol(key)


newmem:
push ebx
mov ebx,[AGE.EXE+1C6020]
mov ebx,[ebx+55120] //cryptkey in ebx
mov [newmem+44],ebx
define(key,newmem+44)
                       xor ebx,ebx
                       mov ebx,key
                       mov [newmem+48],ebx //check key value

pop ebx
mov [ecx+edx*4],eax
mov ecx,[esp+20]
jmp returnhere

"AGE.EXE"+2603F:
jmp newmem
nop
nop
returnhere:

[DISABLE]
dealloc(newmem)
unregisterSymbol(newmem)
unregisterSymbol(key)
dealloc(key)
"AGE.EXE"+2603F:
mov [ecx+edx*4],eax
mov ecx,[esp+20]


And custom type:

Code:
alloc(ConvertRoutine,1024)
alloc(ConvertBackRoutine,1024)
alloc(TypeName,256)
alloc(ByteSize,4)
alloc(UsesFloat,1)
alloc(CallMethod,1)
globalalloc(key,4)

TypeName:
db 'AGE.exe',0
ByteSize:
dd 4
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

ConvertRoutine:
mov eax,[rcx]
rol eax,0B
xor eax,[key]
ror eax,19
ret

ConvertBackRoutine:
ror ecx,07
xor ecx,[key]
rol ecx,15
mov [r8],ecx
ret

Problem is "key" in ConvertRoutine have value 0, while in other table scripts is all OK. What wrong i don't understand
Back to top
View user's profile Send private message
OldCheatEngineUser
Whateven rank
Reputation: 20

Joined: 01 Feb 2016
Posts: 1586

PostPosted: Sun Dec 02, 2018 12:39 am    Post subject: Reply with quote

Code:
// custom type
globalalloc(key,4) // key already allocated globally, so all other script have the access to read/write to key ... unlike alloc.


another way is to debug your code, your calls and passed values. (if there is any)

im not sure why would you ever need to define key as newmem+44 then newmem+48 (its kinda confusing)

_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote:
i am a sweetheart.
Back to top
View user's profile Send private message Visit poster's website
ArchmageFil
How do I cheat?
Reputation: 0

Joined: 01 Dec 2018
Posts: 2

PostPosted: Sun Dec 02, 2018 1:06 am    Post subject: Reply with quote

OldCheatEngineUser wrote:

another way is to debug your code, your calls and passed values. (if there is any)

im not sure why would you ever need to define key as newmem+44 then newmem+48 (its kinda confusing)

define only +44, both for easy checking if all OK with value. (i even add another script that write [key] to it allocated memory, again all Ok)

As for custom type code, i already exchanged [key] with real number, like this:
Code:
mov eax,[rcx]
rol eax,0B
xor eax,04B7382B
ror eax,19
ret

ConvertBackRoutine:
ror ecx,07
xor ecx,04B7382B
rol ecx,15
mov [r8],ecx
ret

and it work nice, but every game reload = manual editing. There no problem for me, but i just dont understand what wrong, also no way share this for any1.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Sun Dec 02, 2018 1:59 am    Post subject: Reply with quote

combine it with a lua script that sets the key value (in ce"s memory,not the game's) when the process gets opened

you can also let lua register the type and use some code to replace the key with a new value before you register it ( registerCustomTypeAutoAssembler )

_________________
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
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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