Difference between revisions of "Help File:Big endian 4 byte"
Jump to navigation
Jump to search
(Created page with '<hr><div align="left"><font face="Arial" color="#010101" class="Arial2"> alloc(TypeName,256)</font></div><div align="left"><font face="Arial" color="#010101" class="Arial2"> …') |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | [[Category:Help]] | |
− | alloc(TypeName,256) | + | This script will add the 2 byte Big Endian type support to cheat engine. |
− | alloc(ByteSize,4) | + | |
− | alloc(ConvertRoutine,1024) | + | alloc(TypeName,256) |
− | alloc(ConvertBackRoutine,1024) | + | alloc(ByteSize,4) |
− | TypeName: | + | alloc(ConvertRoutine,1024) |
− | db '4 Byte Big Endian',0 | + | alloc(ConvertBackRoutine,1024) |
− | ByteSize: | + | |
− | dd 4 | + | |
− | //The convert routine should hold a routine that converts the data to an integer (in eax) | + | TypeName: |
− | //function declared as: stdcall int ConvertRoutine(unsigned char *input); | + | db '4 Byte Big Endian',0 |
− | //Note: Keep in mind that this routine can be called by multiple threads at the same time. | + | |
− | ConvertRoutine: | + | |
− | //jmp dllname.functionname | + | ByteSize: |
− | [64-bit] | + | dd 4 |
− | //or manual: | + | |
− | //parameters: (64-bit) | + | |
− | //rcx=address of input | + | //The convert routine should hold a routine that converts the data to an integer (in eax) |
− | xor eax,eax | + | //function declared as: stdcall int ConvertRoutine(unsigned char *input); |
− | mov eax,[rcx] //eax now contains the bytes 'input' pointed to | + | //Note: Keep in mind that this routine can be called by multiple threads at the same time. |
− | bswap eax //convert to big endian | + | ConvertRoutine: |
− | ret | + | //jmp dllname.functionname |
− | [/64-bit] | + | [64-bit] |
− | [32-bit] | + | //or manual: |
− | //jmp dllname.functionname | + | //parameters: (64-bit) |
− | //or manual: | + | //rcx=address of input |
− | //parameters: (32-bit) | + | xor eax,eax |
− | push ebp | + | mov eax,[rcx] //eax now contains the bytes 'input' pointed to |
− | mov ebp,esp | + | bswap eax //convert to big endian |
− | //[ebp+8]=input | + | |
− | //example: | + | |
− | mov eax,[ebp+8] //place the address that contains the bytes into eax | + | ret |
− | mov eax,[eax] //place the bytes into eax so it's handled as a normal 4 byte value | + | [/64-bit] |
− | bswap eax | + | |
− | pop ebp | + | |
− | ret 4 | + | [32-bit] |
− | [/32-bit] | + | //jmp dllname.functionname |
− | //The convert back routine should hold a routine that converts the given integer back to a row of | + | //or manual: |
− | bytes (e.g when the user wats to write a new value) | + | //parameters: (32-bit) |
− | //function declared as: stdcall void ConvertBackRoutine(int i, unsigned char *output); | + | push ebp |
− | ConvertBackRoutine: | + | mov ebp,esp |
− | //jmp dllname.functionname | + | //[ebp+8]=input |
− | //or manual: | + | //example: |
− | [64-bit] | + | mov eax,[ebp+8] //place the address that contains the bytes into eax |
− | //parameters: (64-bit) | + | mov eax,[eax] //place the bytes into eax so it's handled as a normal 4 byte value |
− | //ecx=input | + | |
− | //rdx=address of output | + | |
− | //example: | + | bswap eax |
− | bswap ecx //convert the little endian input into a big endian input | + | |
− | mov [rdx],ecx //place the integer the 4 bytes pointed to by rdx | + | |
− | ret | + | pop ebp |
− | [/64-bit] | + | ret 4 |
− | [32-bit] | + | [/32-bit] |
− | //parameters: (32-bit) | + | |
− | push ebp | + | |
− | mov ebp,esp | + | //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) |
− | //[ebp+8]=input | + | //function declared as: stdcall void ConvertBackRoutine(int i, unsigned char *output); |
− | //[ebp+c]=address of output | + | ConvertBackRoutine: |
− | //example: | + | //jmp dllname.functionname |
− | push eax | + | //or manual: |
− | push ebx | + | [64-bit] |
− | mov eax,[ebp+8] //load the value into eax | + | //parameters: (64-bit) |
− | mov ebx,[ebp+c] //load the address into ebx | + | //ecx=input |
− | //convert the value to big endian | + | //rdx=address of output |
− | bswap eax | + | //example: |
− | mov [ebx],eax //write the value into the address | + | bswap ecx //convert the little endian input into a big endian input |
− | pop ebx | + | mov [rdx],ecx //place the integer the 4 bytes pointed to by rdx |
− | pop eax | + | |
− | pop ebp | + | |
− | ret 8 | + | 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 | ||
+ | bswap eax | ||
+ | | ||
+ | | ||
+ | mov [ebx],eax //write the value into the address | ||
+ | pop ebx | ||
+ | pop eax | ||
+ | | ||
+ | | ||
+ | pop ebp | ||
+ | ret 8 | ||
+ | [/32-bit] | ||
+ | |||
+ | |||
+ | == Links == | ||
+ | * [[Cheat Engine:Help File|Help File]] | ||
+ | |||
+ | * [[Help_File:Big_endian_2_byte|Back]] | ||
+ | |||
+ | * [[Help_File:Unsigned_values|Next]] |
Latest revision as of 12:02, 19 March 2017
This script will add the 2 byte Big Endian type support to cheat engine.
alloc(TypeName,256) alloc(ByteSize,4) alloc(ConvertRoutine,1024) alloc(ConvertBackRoutine,1024) TypeName: db '4 Byte Big Endian',0 ByteSize: dd 4 //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 mov eax,[rcx] //eax now contains the bytes 'input' pointed to bswap eax //convert to big endian ret [/64-bit] [32-bit] //jmp dllname.functionname //or manual: //parameters: (32-bit) push ebp mov ebp,esp //[ebp+8]=input //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 bswap eax 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: bswap ecx //convert the little endian input into a big endian input mov [rdx],ecx //place the integer the 4 bytes pointed to by rdx 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 bswap eax mov [ebx],eax //write the value into the address pop ebx pop eax pop ebp ret 8 [/32-bit]