DDL Asset

From COD Engine Research
Jump to: navigation, search

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 Black Ops 1 and Black Ops 2. 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
};
 
struct ddlHash_t
{
  int hash;
  int index;
};
 
struct ddlEnumDef_t
{
  const char *name;
  int memberCount;
  const char **members;
#ifdef BO2
  ddlHash_t *hashTable;
#endif
};
 
struct ddlMemberDef_t
{
  const char *name;
  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;
#ifdef BO2
  ddlHash_t *hashTable;
#endif
};
 
struct ddlDef_t
{
  int version;
  int size;
  ddlStructDef_t *structList;
  int structCount;
  ddlEnumDef_t *enumList;
  int enumCount;
  ddlDef_t *next;
};
 
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 structreddatadef.