|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
oddgamer Advanced Cheater Reputation: 0
Joined: 19 Jan 2013 Posts: 58
|
Posted: Sun May 27, 2018 7:37 pm Post subject: 3-Byte Custom type? |
|
|
I'm using an emulator, and it stores some values as 3-Byte values (probably since the original system did, I'm guessing). They are actual 3-Byte values (not 4-bytes where it ignores the end, since making it a 4-byte increases the value, but using an array of three bytes shows the correct answer). Is there a custom type somewhere that does this (since I want to be able to edit and freeze those values, not to mention searching for them)?
|
|
Back to top |
|
|
broly7 Advanced Cheater Reputation: 0
Joined: 13 Aug 2015 Posts: 60
|
Posted: Mon May 28, 2018 7:42 am Post subject: Re: 3-Byte Custom type? |
|
|
oddgamer wrote: | I'm using an emulator, and it stores some values as 3-Byte values (probably since the original system did, I'm guessing). They are actual 3-Byte values (not 4-bytes where it ignores the end, since making it a 4-byte increases the value, but using an array of three bytes shows the correct answer). Is there a custom type somewhere that does this (since I want to be able to edit and freeze those values, not to mention searching for them)? |
|
|
Back to top |
|
|
oddgamer Advanced Cheater Reputation: 0
Joined: 19 Jan 2013 Posts: 58
|
Posted: Mon May 28, 2018 8:10 am Post subject: Re: 3-Byte Custom type? |
|
|
[/quote]
I wrote the following in my original message:
They are actual 3-Byte values (not 4-bytes where it ignores the end, since making it a 4-byte increases the value,
So if I have a value of 464,511 to search for, searching for the Array of Bytes of 7F 16 07 works, but searching for any form of 4-byte does not work because the 4-byte value of that same spot is 7f 16 07 58, and not 7f 16 07 00. This is why I asked about a custom search type. These are actual 3-byte values, not 4-byte values that only use the first three bytes. Yes, I could do it with an Array of Byte search of length 3 converting the numbers to hex code, but that's really annoying.
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Mon May 28, 2018 9:04 am Post subject: |
|
|
Are you sure it's a 3 byte value, and not the 4 byte semi float, where the first 8 bits of the value define the fraction? (e.g civilization uses that type)
anyhow:
Code: |
alloc(ConvertRoutine,1024)
alloc(ConvertBackRoutine,1024)
alloc(TypeName,256)
alloc(ByteSize,4)
alloc(UsesFloat,1)
alloc(CallMethod,1)
alloc(PREFEREDALIGNMENT,1)
TypeName:
db '3 byte integer',0
ByteSize:
dd 3
PREFEREDALIGNMENT:
db 1
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 eax,[rcx] //eax now contains the bytes 'input' pointed to
and eax,00ffffff //strip off bit 24 to 31
ret
[/64-bit]
[32-bit]
//jmp dllname.functionname
//or manual:
//parameters: (32-bit)
push ebp
mov ebp,esp
//[ebp+8]=address of input
//[ebp+c]=address
//example:
mov eax,[ebp+8] //place the address that contains the bytes into eax
mov eax,[eax] //place the bytes into eax so it's handled as a normal 4 byte value
and eax,00ffffff //strip off bit 24 to 31
pop ebp
ret
[/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: 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:
mov [r8],cx //first 16 bits
shr ecx,#16 //move the upper 16 bits of ecx to the lower
mov [r8+2],cl //this results in bits 16 to 23 to be written to r8+2
ret
[/64-bit]
[32-bit]
//parameters: (32-bit)
push ebp
mov ebp,esp
//[ebp+8]=input
//[ebp+c]=address
//[ebp+10]=address of output
//example:
push eax
push ebx
mov eax,[ebp+8] //load the value into eax
mov ebx,[ebp+10] //load the output address into ebx
mov word [ebx],ax
shr eax,#16
mov [ebx+2],al
pop ebx
pop eax
pop ebp
ret
[/32-bit]
|
_________________
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 |
|
|
|
|
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
|
|