StructuredDataDef Asset: Difference between revisions
No edit summary |
No edit summary |
||
| Line 4: | Line 4: | ||
[[Category:MW3]] | [[Category:MW3]] | ||
[[Category:Ghosts]] | [[Category:Ghosts]] | ||
[[Category:AW]] | |||
The structureddatadef asset stores information for data structures and enums used by the game. This asset is only used on Modern Warfare 2, Modern Warfare 3, Ghosts and Advanced Warfare. | The structureddatadef asset stores information for data structures and enums used by the game. This asset is only used on Modern Warfare 2, Modern Warfare 3, Ghosts and Advanced Warfare. | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
Revision as of 20:50, 28 October 2014
The structureddatadef asset stores information for data structures and enums used by the game. This asset is only used on Modern Warfare 2, Modern Warfare 3, Ghosts and Advanced Warfare.
enum DataType
{
STRUCTURED_DATA_INT = 0,
STRUCTURED_DATA_BYTE = 1,
STRUCTURED_DATA_BOOL = 2,
STRUCTURED_DATA_STRING = 3,
STRUCTURED_DATA_ENUM = 4,
STRUCTURED_DATA_STRUCT = 5,
STRUCTURED_DATA_INDEXEDARR = 6,
STRUCTURED_DATA_ENUMARR = 7,
STRUCTURED_DATA_FLOAT = 8,
STRUCTURED_DATA_SHORT = 9
};
#pragma pack(push,4)
struct EnumEntry
{
#ifdef IW6 // if it is Ghosts..
ScriptString name;
#else
const char *name;
#endif
unsigned __int16 index;
};
#pragma pack(pop)
struct DefinedEnum
{
int entryCount;
int unknown;
EnumEntry *entries;
};
union TypeData
{
int integer;
int stringSize;
int flags;
int enumIndex;
int enumArrIndex;
int indexedArrIndex;
int structIndex;
};
struct StructureEntryItem
{
DataType type;
TypeData data;
int index;
};
#pragma pack(push,4)
struct StructureEntry
{
#ifdef IW6 || S1 // if it is Ghosts or Advanced Warfare..
ScriptString name;
#else
const char *name;
#endif
StructureEntryItem item;
#ifndef IW4 // if not Modern Warfare 2..
int unknown;
#endif
};
#pragma pack(pop)
struct DefinedStructure
{
int entryCount;
StructureEntry *entries;
int size;
int unknown;
};
struct DefinedIndexedArray
{
int numItems;
StructureEntryItem item;
};
struct DefinedEnumArray
{
int enumIndex;
StructureEntryItem item;
};
struct StructuredData
{
int version;
int hash;
int enumCount;
DefinedEnum *enums;
int structureCount;
DefinedStructure *structures;
int indexedArrCount;
DefinedIndexedArray *indexedArrays;
int enumArrayCount;
DefinedEnumArray *enumArrays;
StructureEntryItem rootItem;
};
struct StructuredDataDef
{
const char *name;
int numEntries;
StructuredData *entries;
};Notice that on Ghosts and Advanced Warfare all strings were replaced with ScriptStrings, which caused EnumEntry to drop to 4 bytes.
Source Format
The official source format is currently unknown, however they still must be dumped for use. The structureddatadefs are defined at "raw/mp/".
First enums must be dumped. These are very simple with each DefinedEnum an individual enum and EnumEntry (holding the name and enum index value), a value in the enum.
Structures are the second and last item to be dumped. Each DefinedStructure is a structure to be used, and each StructureEntry is an item in the structure. The "index" in the StructureEntryItem for each item is the byte offset of the item in the structure. If the entry item has a "ENUM" or "STRUCT" type then the "data" will be an integer with the index of the enum or struct to use in this StructuredData. If the entry item has a "INDEXEDARR" or "ENUMARR" type then the "data" will be an integer with the index of the "indexedArray" or "enumArray" to use. The array item will then have the type of the element to use. It is possible for an "indexedArray" or "enumArray" to also have a type of "INDEXEDARR" or "ENUMARR" in which case it will be a double array. An "indexedArray" will contain the number of items in the array while the "enumArray" will contain the index for the enum to use for this array. The array will have 1 element for each element in the array, and members will be referenced by their enum value.