Challenging,

View on GitHub

In my young age I used to play the french mmorpg Dofus it was part of my childhood; certainly not as extensively as Pokémon or Halo but it had it’s footprint to leave.

What always intrigued me was how a mmorpg that was used by over millions of players when it used to be popular, had such lacking security when it came to protecting the game, accounts or even resources. However all those details are for another time as today we focus on looking at reading the resource files called d2i.

This reverse engineering was done mainly by looking at patterns in the file, hexadecimal code and a few of the uncompiled game sources. However I did try to keep the use of the game sources to a minimum to make this more challenging.

Introduction to d2i

The d2i format is used by Ankama to stock strings such as item names, dialogues and more. This file can vary depending on the language but the structure stays the same.

Structure

The File

This file is composed of 4 major parts:

  • The Datas
  • The Indexes
  • The UI Messages
  • Extra data

Each of these parts has an Index (4 bytes) giving the size of the data that will follow apart from the extra data.

The Datas

The Datas or each composed of 3 parts:

  • Size of all the datas (4 bytes)
  • Size of the string (2 bytes orange)
  • The actual string in UTF-8 (X bytes grey)

d2i data structure

The Indexes

The Indexes since the 2.4X update have become a bit more complex since they introduced diacriticals ( the string with no accents or capital letters).

  • Size of all the indexes (4 bytes)
  • ID of the string; usually called in the d2o files (4 bytes orange)
  • Diacritical exists? (boolean)(1 byte light blue)
  • Pointer to the string (4 bytes brown)
  • If diacritical is true then pointer to the diacritical string (4 bytes dark blue)

d2i index structure

The UI Messages

The UI Messagesare messages that are given in certain packets that don’t have an ID to identify the string.

Example: ui.message.check0

Extra Data

Not having had much time to look at it in the past and now working on other projects I am not sure what this represents.

Diagram

d2i Data Structure

Médéric Burlet