WBF

From wowdev
Jump to navigation Jump to search
This section only applies to versions ≥ Battle.

WBF files are a Battle cache file, located within the Cache folder. They contain, at the very least, information about graphic card hardware, drivers and software. Each compatible device has it's own named WBF file e.g. DX12ShaderCache_AMD_Radeon_TM_R9_390_Series.wbf. They are only used by the Windows client and only for devices with DirectX 12 support.

Header

char magic[4];     // CSXG
uint32_t version;  // 2 Battle (8.0.1.26892) … Battle (8.0.1.27089), 3 ≥ Battle (8.0.1.27101)
char unk_1[0x18];  // final 8 bytes (at least) is driver version related
uint32_t OsVersion;
uint32_t OsBits;  // 0 = x86, 1 = x64
uint32_t unk_2;    // flags?
uint32_t vendor_id;
uint32_t device_id;
uint32_t subsystem_vendor_id;
uint32_t subsystem_device_id;
uint32_t revision;
uint32_t unk4;     // number of devices?

char unk[0x2E8]; // todo probably not fixed size padding (not aligned...)

uint32_t entries_table_a;
uint64_t bytes_table_b;
uint64_t bytes_table_c;
uint64_t bytes_table_d;
char hashish[16];

struct {
  struct {
    char hashish[16];
    uint32_t a;
    uint32_t a;
    uint32_t a;
    uint32_t a;
    char FF[32-8];
    int32_t b;
    int32_t c;
  } indexish[entries_table_a];
} table_a;

struct {
  struct {
    wstring s;
  } descish[entries_table_a]<optimize=false>; // todo: probably not entries_table_a but something from in there implicitly referencing
} table_b_strings;

struct {
  struct dxbc { // Direct3D shader bytecode
      local int start = FTell();
    uint32_t magic;
      Assert (magic == 1128421444);
    char checksum[16];
    uint32_t __1;
    uint32_t size;
    uint32_t chunk_count;
    uint32_t chunk_offsets[chunk_count];
      local int last_offset = chunk_offsets[chunk_count - 1];
      local int last_size = ReadUInt (start + chunk_offsets[chunk_count - 1] + 4) + 8;
      local int real_size = last_offset + last_size;
      Assert (real_size == size);
    struct iffchunk {
      uint32_t magic;
      uint32_t size;
      char data[size];
    } chunks[chunk_count]<optimize=false>;
  } e[704]<optimize=false>; // todo: size is probably referneces from table_a with deduplication
  // todo: file format is likely independent of being DXBC and this is a binary blob to the format
} table_c;

struct {
  char hashish2[16];
  uint32_t a;
  uint32_t a;
  uint32_t a;
  uint32_t count; // todo == entries_table_a, accident?
  char blob[FileSize() - FTell()]; // todo: lol
} table_d;