Reverse engineering Diablo v1.09b (last patch)
#24
(01-30-2018, 02:10 AM)TheKillerVortex Wrote:
Code:
00686D8C - 03 00 00 00

This represents the graphic image to load for your character (00 = no weapon, 01 = sword, 02 = axe, 03 = bow, 04 = mace; I guess?).

Yes. That address points to the item type of an equipped item on the player.

The Player struct is not currently documented, as it's huge. However, some fields are known. For instance, the equipped items.

Code:
typedef struct {
   ...
   // offset: 037C (2576 bytes)
   Item body_items[7];
   ...
} Player;

The player global variable has been documented (but is currently commented out, until the Player struct is defined), and it is located at address 0x686448. Since it is commented out, it does not appear at http://sanctuary.github.io/notes/#variable/players yet.

Code:
// address: 0x686448
//
// players contains the player characters of the current game.
Player players[4];

And the Item struct has been documented, thus its size (0x170) is known and the offset to its member.

From this information, we can calculate what the address 0x686D8C corresponds to.

Code:
0x686D8C - 0x686448 = 0x944 // offset into the player struct.
0x944 - 0x37C = 0x5C8       // offset into the body_items member of players[0].
0x5C8 % 0x170 = 0x8         // offset into the Item struct; players[0].items[4].type

Looking at http://sanctuary.github.io/notes/#struct/Item we can locate the member at offset 0x8, which corresponds to the item type.

Code:
typedef struct {
   ...
   // offset 0008 (4 bytes)
   item_type  type;
   ...
} Item;

Lastly, the item_type enum is defined at http://sanctuary.github.io/notes/#enum/item_type

Code:
// Item types.
typedef enum {
    ITEM_TYPE_MISC         =  0, // Potions, scrolls, books and quest items.
    ITEM_TYPE_SWORD        =  1,
    ITEM_TYPE_AXE          =  2,
    ITEM_TYPE_BOW          =  3,
    ITEM_TYPE_MACE         =  4,
    ITEM_TYPE_SHIELD       =  5,
    ITEM_TYPE_LIGHT_ARMOR  =  6,
    ITEM_TYPE_HELM         =  7,
    ITEM_TYPE_MEDIUM_ARMOR =  8,
    ITEM_TYPE_HEAVY_ARMOR  =  9,
    ITEM_TYPE_STAFF        = 10,
    ITEM_TYPE_GOLD         = 11,
    ITEM_TYPE_RING         = 12,
    ITEM_TYPE_AMULET       = 13,
    ITEM_TYPE_14           = 14, // NOTE: Unused?
    ITEM_TYPE_NONE         = -1,
} item_type;

I hope this may provide useful for your future reversing adventures :)

As you will notice, there is still a lot left to be documented in the game. Care to join us at sanctuary? :)

Cheers!
Reply


Messages In This Thread
RE: Reverse engineering Diablo v1.09b (last patch) - by mewmew - 02-15-2018, 01:56 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)