Difference between revisions of "Help File:Big endian 2 byte"

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

Revision as of 08:04, 10 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 '2 Byte Big Endian',0
  
  
 ByteSize:
 dd 2
  
  
 //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 ax,[rcx] //eax now contains the bytes 'input' pointed to
 xchg ah,al //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 ax,[eax] //place the bytes into eax so it's handled as a normal 4 byte value
 and eax,ffff //cleanup
 xchg ah,al //convert to big endian
  
  
 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:
 xchg ch,cl //convert the little endian input into a big endian input
 mov [rdx],cx //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
 xchg ah,al
  
  
 mov [ebx],ax //write the value into the address
 pop ebx
 pop eax
  
  
 pop ebp
 ret 8
 [/32-bit]


Links