(Modding) Encode/Convert .dll and .xml Gibberish

Started by Hell Diguner, December 23, 2014, 04:29:43 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

wobatt

The easy way is to use this... http://babbage.cs.qc.cuny.edu/IEEE-754/
In the Input Format box, select "hexadecimal", and tick "Hexadecimal is little-endian (right-to-left)"
Copy/paste the hex and press enter. The decimal value will be shown.

If you want to learn more though...
Swapping the bytes refers to converting little-endian values (like in the code) to big-endian values (like we read normal numbers). This wikipedia page gives an in-depth explanation of endianness: http://en.wikipedia.org/wiki/Endianness

This means that if a BinHex value in an XML file is CEB68E0D, you reverse the order of each pair of characters, so it becomes 0D8EB6CE, which puts the digits in order from largest on the left to smallest on the right.

This is then interpreted as a floating point number: http://en.wikipedia.org/wiki/IEEE_floating_point

aleeque

Hmmmm... I still don't understand though how people actually get text out of these small numbers.

Like in this example:

Spoiler
<value hash="88596C97" type="UInt32">30</value>
into
<value hash="88596C97" type="UInt32">30</value> <!-- iAmmoInClip -->

I know how to convert long hex strings into ASCII but this is obviously something different.

wobatt

This is using a CRC32 hash. It is a one way operation, from text to a number.
More about CRC hash algorithms: http://en.wikipedia.org/wiki/Cyclic_redundancy_check
The 32 means it gives a 32 bit output.

You can put the text (aka string) "iAmmoInClip" into https://www.tools4noobs.com/online_php_functions/crc32/ (this uses the exact same algorithm as the game)
This gives the hash "88596c97", which matches what you have in the example you gave.

The only way of going from a hash back to text is to just try putting loads of strings through the CRC32 algorithm, and see if any of them give the matching hash. You can't go directly from the hash to get a string.

As for how we know what to try, there are fragments of text spread among the code in Dunia.dll in the game directory. These can be extracted, then use CRC32 to produce a dictionary of string/hash pairs that can be replaced in the XML.

This is what my tool does. It takes the dictionary of extracted strings, performs the CRC32 on each, then attempts to find a match for any hashes in the XML. It just uses the ~70k strings that I have extracted, and attempts all of them at once to save you the w@&k.

Once you have the name, you can see that it starts with a lower case "i", so it is an integer (UInt32 = unsigned integer, 32 bit). The value converts from 1E000000 (little-endian hex) to 0000001E (big-endian hex) = 30 (decimal).

Art Blade

nice tutorials and explanations, wobatt. +1 :-X :)
[titlebar]Vision without action is a daydream. Action without vision is a nightmare.[/titlebar]What doesn't kill us, makes us weirder.

aleeque


PZ


Tags:
🡱 🡳