FastFiles and Zone files (BO2)

From COD Engine Research
Revision as of 12:18, 30 January 2015 by Aerosoul94 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

FastFile Structure

struct DB_Header
{
  char magic[8];
  int version;
};
 
struct DB_AuthSignature
{
  char bytes[256];
};
 
struct DB_AuthHeader
{
  char magic[8];
  int reserved;
  char fastfileName[32];
  DB_AuthSignature signedSubheaderHash;
};

Encryption & Compression

PS3

After the zone file is created, it is split into blocks. The first block is the 0x28 byte XFile header. After that, each block is 0x7FC0 bytes. Each block is first compressed using best compression, then encrypted using salsa20.

FastFile Keys

XBOX 360

Thanks to Chocolate.

0x0E, 0x50, 0xF4, 0x9F,
0x41, 0x23, 0x17, 0x09, 
0x60, 0x38, 0x66, 0x56, 
0x22, 0xDD, 0x09, 0x13, 
0x32, 0xA2, 0x09, 0xBA, 
0x0A, 0x05, 0xA0, 0x0E, 
0x13, 0x77, 0xCE, 0xDB, 
0x0A, 0x3C, 0xB1, 0xD3

PS3

0xC8, 0x0B, 0x0E, 0x0C,
0x15, 0x4B, 0xFF, 0x91,
0x76, 0xA0, 0xC5, 0xC8,
0xD2, 0x4F, 0xA5, 0xE3,
0xEE, 0x09, 0xEE, 0x90,
0x6F, 0x72, 0x90, 0x80,
0xA3, 0x92, 0x75, 0xFD,
0x3E, 0xA7, 0x13, 0x39 

Wii U

0xB3, 0xBD, 0x6B, 0x2C,
0x82, 0x42, 0x8D, 0x11,
0xB8, 0x88, 0x2D, 0x4C,
0x6D, 0x18, 0xCC, 0x79,
0xE2, 0x70, 0x9F, 0x6B,
0xD4, 0x39, 0x91, 0x35,
0xFD, 0xDE, 0x14, 0xE6,
0x8F, 0x3A, 0xBC, 0xCE

PC

Thanks to master131.

0x64, 0x1D, 0x8A, 0x2F,
0xE3, 0x1D, 0x3A, 0xA6,
0x36, 0x22, 0xBB, 0xC9,
0xCE, 0x85, 0x87, 0x22,
0x9D, 0x42, 0xB0, 0xF8, 
0xED, 0x9B, 0x92, 0x41,
0x30, 0xBF, 0x88, 0xB6,
0x5E, 0xDC, 0x50, 0xBE

Zone File

Header

enum
{
  XFILE_BLOCK_TEMP = 0,
  XFILE_BLOCK_RUNTIME_VIRTUAL = 1,
  XFILE_BLOCK_RUNTIME_PHYSICAL = 2,
  XFILE_BLOCK_DELAY_VIRTUAL = 3,
  XFILE_BLOCK_DELAY_PHYSICAL = 4,
  XFILE_BLOCK_VIRTUAL = 5,
  XFILE_BLOCK_PHYSICAL = 6,
  XFILE_BLOCK_STREAMER_RESERVE = 7,
  MAX_XFILE_COUNT
};
 
struct XFile
{
  unsigned int size;
  unsigned int externalSize;
  unsigned int blockSize[MAX_XFILE_COUNT];
};

Asset List

enum XAssetType
{
  ASSET_TYPE_XMODELPIECES = 0x0,
  ASSET_TYPE_PHYSPRESET = 0x1,
  ASSET_TYPE_PHYSCONSTRAINTS = 0x2,
  ASSET_TYPE_DESTRUCTIBLEDEF = 0x3,
  ASSET_TYPE_XANIMPARTS = 0x4,
  ASSET_TYPE_XMODEL = 0x5,
  ASSET_TYPE_MATERIAL = 0x6,
  ASSET_TYPE_TECHNIQUE_SET = 0x7,
  ASSET_TYPE_IMAGE = 0x8,
  ASSET_TYPE_SOUND = 0x9,
  ASSET_TYPE_SOUND_PATCH = 0xA,
  ASSET_TYPE_CLIPMAP = 0xB,
  ASSET_TYPE_CLIPMAP_PVS = 0xC,
  ASSET_TYPE_COMWORLD = 0xD,
  ASSET_TYPE_GAMEWORLD_SP = 0xE,
  ASSET_TYPE_GAMEWORLD_MP = 0xF,
  ASSET_TYPE_MAP_ENTS = 0x10,
  ASSET_TYPE_GFXWORLD = 0x11,
  ASSET_TYPE_LIGHT_DEF = 0x12,
  ASSET_TYPE_UI_MAP = 0x13,
  ASSET_TYPE_FONT = 0x14,
  ASSET_TYPE_FONTICON = 0x15,
  ASSET_TYPE_MENULIST = 0x16,
  ASSET_TYPE_MENU = 0x17,
  ASSET_TYPE_LOCALIZE_ENTRY = 0x18,
  ASSET_TYPE_WEAPON = 0x19,
  ASSET_TYPE_WEAPONDEF = 0x1A,
  ASSET_TYPE_WEAPON_VARIANT = 0x1B,
  ASSET_TYPE_WEAPON_FULL = 0x1C,
  ASSET_TYPE_ATTACHMENT = 0x1D,
  ASSET_TYPE_ATTACHMENT_UNIQUE = 0x1E,
  ASSET_TYPE_WEAPON_CAMO = 0x1F,
  ASSET_TYPE_SNDDRIVER_GLOBALS = 0x20,
  ASSET_TYPE_FX = 0x21,
  ASSET_TYPE_IMPACT_FX = 0x22,
  ASSET_TYPE_AITYPE = 0x23,
  ASSET_TYPE_MPTYPE = 0x24,
  ASSET_TYPE_MPBODY = 0x25,
  ASSET_TYPE_MPHEAD = 0x26,
  ASSET_TYPE_CHARACTER = 0x27,
  ASSET_TYPE_XMODELALIAS = 0x28,
  ASSET_TYPE_RAWFILE = 0x29,
  ASSET_TYPE_STRINGTABLE = 0x2A,
  ASSET_TYPE_LEADERBOARD = 0x2B,
  ASSET_TYPE_XGLOBALS = 0x2C,
  ASSET_TYPE_DDL = 0x2D,
  ASSET_TYPE_GLASSES = 0x2E,
  ASSET_TYPE_EMBLEMSET = 0x2F,
  ASSET_TYPE_SCRIPTPARSETREE = 0x30,
  ASSET_TYPE_KEYVALUEPAIRS = 0x31,
  ASSET_TYPE_VEHICLEDEF = 0x32,
  ASSET_TYPE_MEMORYBLOCK = 0x33,
  ASSET_TYPE_ADDON_MAP_ENTS = 0x34,
  ASSET_TYPE_TRACER = 0x35,
  ASSET_TYPE_SKINNEDVERTS = 0x36,
  ASSET_TYPE_QDB = 0x37,
  ASSET_TYPE_SLUG = 0x38,
  ASSET_TYPE_FOOTSTEP_TABLE = 0x39,
  ASSET_TYPE_FOOTSTEPFX_TABLE = 0x3A,
  ASSET_TYPE_ZBARRIER = 0x3B,
  ASSET_TYPE_COUNT = 0x3C,
  ASSET_TYPE_STRING = 0x3C,
  ASSET_TYPE_ASSETLIST = 0x3D,
  ASSET_TYPE_REPORT = 0x3E,
  ASSET_TYPE_DEPEND = 0x3F,
  ASSET_TYPE_FULL_COUNT = 0x40,
};
 
union XAssetHeader
{
  XModelPieces *xmodelPieces;
  PhysPreset *physPreset;
  PhysConstraints *physConstraints;
  DestructibleDef *destructibleDef;
  XAnimParts *parts;
  XModel *model;
  Material *material;
  MaterialPixelShader *pixelShader;
  MaterialVertexShader *vertexShader;
  MaterialTechniqueSet *techniqueSet;
  GfxImage *image;
  SndBank *sound;
  SndPatch *soundPatch;
  clipMap_t *clipMap;
  ComWorld *comWorld;
  GameWorldSp *gameWorldSp;
  GameWorldMp *gameWorldMp;
  MapEnts *mapEnts;
  GfxWorld *gfxWorld;
  GfxLightDef *lightDef;
  Font_s *font;
  FontIcon *fontIcon;
  MenuList *menuList;
  menuDef_t *menu;
  LocalizeEntry *localize;
  WeaponVariantDef *weapon;
  WeaponAttachment *attachment;
  WeaponAttachmentUnique *attachmentUnique;
  WeaponCamo *weaponCamo;
  SndDriverGlobals *sndDriverGlobals;
  FxEffectDef *fx;
  FxImpactTable *impactFx;
  RawFile *rawfile;
  StringTable *stringTable;
  LeaderboardDef *leaderboardDef;
  XGlobals *xGlobals;
  ddlRoot_t *ddlRoot;
  Glasses *glasses;
  TextureList *textureList;
  EmblemSet *emblemSet;
  ScriptParseTree *scriptParseTree;
  KeyValuePairs *keyValuePairs;
  VehicleDef *vehicleDef;
  MemoryBlock *memoryBlock;
  AddonMapEnts *addonMapEnts;
  TracerDef *tracerDef;
  SkinnedVertsDef *skinnedVertsDef;
  Qdb *qdb;
  Slug *slug;
  FootstepTableDef *footstepTableDef;
  FootstepFXTableDef *footstepFXTableDef;
  ZBarrierDef *zbarrierDef;
  void *data;
};
 
struct ScriptStringList
{
  int count;
  const char **strings;
};
 
struct XAsset
{
  XAssetType type;
  XAssetHeader header;
};
 
struct XAssetList
{
  ScriptStringList stringList;
  int dependCount;
  const char **depends;
  int assetCount;
  XAsset *assets;
};