Difference between revisions of "Scripts"

From UODemo Wiki
Jump to: navigation, search
m
Line 1: Line 1:
 
The '''scripts''' subdirectory contains many files with a .m extension.  The files contain binary data and cannot be read by hand.  There is also one text file named [[sdb.txt]].
 
The '''scripts''' subdirectory contains many files with a .m extension.  The files contain binary data and cannot be read by hand.  There is also one text file named [[sdb.txt]].
  
The .m files are not encrypted but they do contain a sort of obfusicated, intermediate binary language between the original script files and the runtime engine of [[uodemo.exe]].
+
The .m files are not encrypted but they do contain a sort of obfuscated, intermediate binary language between the original script files and the runtime engine of [[uodemo.exe]].
  
The .m files consist of obfusicated tokens, constants (byte, word, and double word values), string indexes into [[sdb.txt]] and quoted string indexes into [[sdb.txt]].  Constant, strings and quoted strings are preceded by a (obfusicated) token describing them.  Quoted strings can be concatenated on-the-fly by the parser.
+
The .m files consist of obfuscated tokens, constants (byte, word, and double word values), string indexes into [[sdb.txt]] and quoted string indexes into [[sdb.txt]].  Constant, strings and quoted strings are preceded by a (obfuscated) token describing them.  Quoted strings can be concatenated on-the-fly by the parser.
  
The obfusication works as follows: each token is represented by 5 different words (2 bytes).
+
The obfuscation works as follows: each token is represented by 5 different words (2 bytes).
  
For example, the token "IF" is coded as byte 0x25, which is obfusicated to be 0x12C2, 0x1003, 0x0607, 0x0784 or 0x2B0F.  So to decompile the .m file you must look-up each obfuscated word and convert it to a byte, then convert that byte to a token which we humans can read.  This is a straight-forward process, therefor, (re-)compilation of .m files can be achieved with ease.
+
For example, the token "IF" is coded as byte 0x25, which is obfuscated to be 0x12C2, 0x1003, 0x0607, 0x0784 or 0x2B0F.  So to decompile the .m file you must look-up each obfuscated word and convert it to a byte, then convert that byte to a token which we humans can read.  This is a straight-forward process, therefor, (re-)compilation of .m files can be achieved with ease.
  
 
Decompilation : 0x12C2 or 0x1003 or 0x0607 or 0x0784 or 0x2B0F -> 0x25 -> IF<br>
 
Decompilation : 0x12C2 or 0x1003 or 0x0607 or 0x0784 or 0x2B0F -> 0x25 -> IF<br>
 
Compilation : IF -> 0x25 -> 0x12C2 or 0x1003 or 0x0607 or 0x0784 or 0x2B0F<br>
 
Compilation : IF -> 0x25 -> 0x12C2 or 0x1003 or 0x0607 or 0x0784 or 0x2B0F<br>

Revision as of 08:32, 9 June 2009

The scripts subdirectory contains many files with a .m extension. The files contain binary data and cannot be read by hand. There is also one text file named sdb.txt.

The .m files are not encrypted but they do contain a sort of obfuscated, intermediate binary language between the original script files and the runtime engine of uodemo.exe.

The .m files consist of obfuscated tokens, constants (byte, word, and double word values), string indexes into sdb.txt and quoted string indexes into sdb.txt. Constant, strings and quoted strings are preceded by a (obfuscated) token describing them. Quoted strings can be concatenated on-the-fly by the parser.

The obfuscation works as follows: each token is represented by 5 different words (2 bytes).

For example, the token "IF" is coded as byte 0x25, which is obfuscated to be 0x12C2, 0x1003, 0x0607, 0x0784 or 0x2B0F. So to decompile the .m file you must look-up each obfuscated word and convert it to a byte, then convert that byte to a token which we humans can read. This is a straight-forward process, therefor, (re-)compilation of .m files can be achieved with ease.

Decompilation : 0x12C2 or 0x1003 or 0x0607 or 0x0784 or 0x2B0F -> 0x25 -> IF
Compilation : IF -> 0x25 -> 0x12C2 or 0x1003 or 0x0607 or 0x0784 or 0x2B0F