EOSERV Wiki > Page: EDF Data Files > History > View Revision

View Revision: EDF Data Files

Summary

EDF Data Files are used to store text data that is used by the client. These files have no use in a server. They are located in the client's 'data' folder and follow the naming convention dat{num}.edf, where num is a 3-digit number padded with leading zeroes. (ie dat001.edf, dat012.edf). There are 12 files in total.

What's in the files?

Data stored in each of the files is as follows:

  1. Credits (unencrypted)
  2. Checksum(?) (unencrypted)
  3. Chat filter
  4. Jukebox song titles
  5. Game text 1 (english)
  6. Game text 2 (english)
  7. Game text 1 (dutch)
  8. Game text 2 (dutch)
  9. Game text 1 (swedish)
  10. Game text 2 (swedish)
  11. Game text 1 (portuguese)
  12. Game text 2 (portuguese)

Decryption

Files are "encrypted" using a jumbling scheme, with the exception of the first 2 files which are unencrypted. The text is decrypted as follows:

Eenmdelhets s -> Endless theme

First, run through the string starting at the first character and skipping every other character:

E n d l e s s

Our resulting string so far reads 'Endless'.

Then, do the same thing, but backwards (note the word 'theme' is backwards):

 e m e h t  

Appending each character in reversed order, the result string now reads 'Endless theme'.

There is a final step that unscrambles remaining characters. Characters that have an ASCII value which is a multiple of 7 that are directly adjacent to each other should be flipped. The first sample does not require this step. However, some entries do

Without the final step, "Crazzy Stepping" in the jukebox file will become:

Cgrnapzpyi est -> Crazy steippng

'i' and 'p' are both ASCII multiples of 7:

Crazy steippng (START)
Crazy stepipng (i followed by p = SWAP)
Crazy stepping (i followed by p = SWAP)

Code Sample

Here is a function in C# that '''completely''' decodes the EDF strings.

private string _decodeDatString(string input)
{
	string ret = "";

	for (int i = 0; i < input.Length; i += 2)
		ret += input[i];

	//start at the other end of the string and work backwards
	int startIndex = input.Length - (input.Length%2 == 0 ? 1 : 2);
	for (int i = startIndex; i >= 0; i -= 2)
		ret += input[i];

	StringBuilder sb = new StringBuilder(ret);
	//adjacent ascii char values that are multiples of 7 should be flipped
	for (int i = 0; i < sb.Length; ++i)
	{
		int next = i + 1;
		if (next < sb.Length)
		{
			char c1 = sb[i], c2 = sb[next];
			int ch1 = Convert.ToInt32(c1);
			int ch2 = Convert.ToInt32(c2);

			if (ch1%7 == 0 && ch2%7 == 0)
			{
				sb[i] = c2;
				sb[next] = c1;
			}
		}
	}
	return sb.ToString();
}
EOSERV Wiki > Page: EDF Data Files > History > View Revision