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 


3 Byte Big Endian

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

Joined: 19 Jan 2013
Posts: 60

PostPosted: Mon Oct 22, 2018 7:53 pm    Post subject: 3 Byte Big Endian Reply with quote

I'm no good at making search types. I have an emulator that contains a 3-byte value that is big-endian in nature. Can anyone help?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Tue Oct 23, 2018 7:24 am    Post subject: Reply with quote

Try:
Code:

alloc(TypeName,256)
alloc(ByteSize,4)
alloc(ConvertRoutine,1024)
alloc(ConvertBackRoutine,1024)
alloc(PREFEREDALIGNMENT,4)

TypeName:
db '3 Byte Big Endian',0

PREFEREDALIGNMENT:
db 1

ByteSize:
dd 3

//The convert routine should hold a routine that converts the data to an integer (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:
//jmp dllname.functionname
[64-bit]
//or manual:
//parameters: (64-bit)
//rcx=address of input
xor eax,eax
//aa bb cc  -> 0xaabbcc
//0  1  2

//(0xaabb << 8)->0xaabb00
mov ah,[rcx+0]
mov al,[rcx+1]
shl eax,8
mov al,[rcx+2]


ret
[/64-bit]

[32-bit]
//jmp dllname.functionname
//or manual:
//parameters: (32-bit)
push ebp
mov ebp,esp
//[ebp+8]=input
//example:
push ecx
mov ecx,[ebp+8] //place the address that contains the bytes into eax

xor eax,eax
mov ah,[ecx+0]
mov al,[ecx+1]
shl eax,8
mov al,[ecx+2]

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:
//jmp dllname.functionname
//or manual:
[64-bit]
//parameters: (64-bit)
//ecx=input
//rdx=address of output
//example:

//0xaabbcc-> aa bb cc
//    chcl

mov [rdx+2],cl
mov [rdx+1],ch
shr ecx,8
mov [rdx+0],ch

ret
[/64-bit]

[32-bit]
//parameters: (32-bit)
push ebp
mov ebp,esp
//[ebp+8]=input
//[ebp+c]=address of output
//example:
push eax
push ebx
mov eax,[ebp+8] //load the value into eax
mov ebx,[ebp+c] //load the address into ebx

//convert the value to big endian
mov [ebx+2],al
mov [ebx+1],ah
shr eax,8
mov [ebx],ah

pop ebx
pop eax

pop ebp
ret 8
[/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
View user's profile Send private message MSN Messenger
oddgamer
Advanced Cheater
Reputation: 0

Joined: 19 Jan 2013
Posts: 60

PostPosted: Tue Oct 23, 2018 7:45 am    Post subject: Reply with quote

Works! Awesome! Thanks! Way too much XP, here I come! Smile
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