DDL Asset

From COD Engine Research

The DDL asset is Treyarch's equivalent to IW's structureddatadef asset and is used to store structure information. As such it only appears in the Black Ops franchise. The acronym that "ddl" represents (Data Definition Language most likely, Data Definition Library, Dynamic Data Library?) is currently unknown.

enum ddlPrimitiveTypes_e : unsigned int
{
  DDL_INVALID_TYPE = 0xFFFFFFFF,
  DDL_BYTE_TYPE = 0x0,
  DDL_SHORT_TYPE = 0x1,
  DDL_UINT_TYPE = 0x2,
  DDL_INT_TYPE = 0x3,
  DDL_INT64_TYPE = 0x4,
  DDL_FLOAT_TYPE = 0x5,
  DDL_FIXEDPOINT_TYPE = 0x6,
  DDL_STRING_TYPE = 0x7,
  DDL_STRUCT_TYPE = 0x8,
  DDL_ENUM_TYPE = 0x9,
#ifdef BO3
  DDL_PAD_TYPE = 0xA
#endif
};

struct ddlHash_t
{
#ifdef BO3
  char * unknownData; //Size = unknownSize << 3
  int unknownSize;
  int unknown;
#else
  int hash;
  int index;
#endif
};

struct ddlEnumDef_t
{
  const char *name;
  int memberCount;
  const char **members;
#if defined(BO2) || defined(BO3)
  ddlHash_t *hashTable;
#endif
};

struct ddlMemberDef_t
{
  const char *name;
#ifdef BO3
  int indexInParent;
  ddlStructDef_t * parent;
  char unknown2[0x4];
#endif
  int size;
  int offset;
  ddlPrimitiveTypes_e type;
  int externalIndex;
  unsigned int rangeLimit;
  unsigned int serverDelta;
  unsigned int clientDelta;
  int arraySize;
  int enumIndex;
  int permission;
#ifdef BO1
  int unknown3;
#endif
};

struct ddlStructDef_t
{
  const char *name;
  int size;
  int memberCount;
  ddlMemberDef_t *members;
#if defined(BO2) || defined(BO3)
  ddlHash_t *hashTable;
#ifdef BO3
  ddlHash_t *hashTable2;
#endif
#endif
};

struct ddlDef_t
{
#ifdef BO3
  const char * name;
  short version;
  unsigned int checksum;
  char unknown1[0x4];
  int size;
  int unknown2;
#else
  int version;
  int size;
#endif
  ddlStructDef_t *structList;
  int structCount;
  ddlEnumDef_t *enumList;
  int enumCount;
  ddlDef_t *next;
#ifdef BO3
  char unknown3[0x14];
#endif
};

struct ddlRoot_t
{
  const char *name;
  ddlDef_t *ddlDef;
};

Source Format

The current public source format for DDLs is no good for the modding scene. It is similar to a string table with the name of the entries and their maximum and minimum values. A more useful format would be similar to the structureddatadefs with a structure and enums. DDLs are defined at "ddl/" for SP and shared DDLs, and at "ddl_mp/" for MP DDLs.

First enums must be dumped. These are very simple with each EnumEntry an individual enum and having a single string in the entries for each member of the enum.

Structures are the second and last item to be dumped. Each StructEntry is a structure to be used, and each MemberEntry is an item in the structure. Keep in mind that while IW's structureddatadef used normal lengths and byte offsets, the DDL uses bit offset/lengths and aligns almost nothing. Dumping the DDL should be fairly obvious when compared to the structureddatadef.