66 std::span<const std::byte>
file;
111 std::uint64_t
fieldRaw(std::size_t field,
112 std::uint32_t element,
113 std::uint32_t arrayCount,
114 std::span<const std::byte> recordBytes,
116 const std::vector<std::uint32_t>& additional)
const;
124 std::size_t
elemBitWidth(std::size_t field, std::uint32_t arrayCount)
const;
149 std::uint32_t _palletValue(std::uint32_t base,
151 std::uint32_t element,
152 std::uint32_t arraySize)
const;
161 std::uint32_t _commonValue(std::uint32_t base, std::uint32_t size, std::uint32_t
id, std::uint32_t fallback)
const;
The on-disk binary structures of the WDC family of .db2 formats (wowdev.wiki/DB2): WDC1 (Legion 7....
Little-endian bit streams over record buffers — the primitive the WDC family's bitpacked column stora...
The error-handling vocabulary: ErrorCode, Error and the Result<T> alias every fallible wowlib operati...
@ BitpackedSigned
Bit-addressed signed value, sign-extended (WDC2+ only; WDC1 spells it Bitpacked + flags 0x01).
@ WdcFlagSparse
Offset-map layout + inline null-terminated strings.
@ WdcFlagNoninlineId
The id lives in the idList, not the record.
StringRefMode
How a record's string-reference fields address the string data.
@ FieldRelative
WDC2+: offset from the referencing field's own position.
@ BlockRelative
WDC1: offset from the string block's first byte.
std::expected< T, Error > Result
Every fallible wowlib operation returns Result<T>; bindings translate the error branch into a target-...
A parsed WDC-family file: the (normalized) header, shared tables, and located sections.
std::span< const std::byte > file
std::size_t elemBitWidth(std::size_t field, std::uint32_t arrayCount) const
The bit width of one element of inline field field: for the inline kinds, the field's total width div...
std::vector< WdcFieldStorage > fieldStorage
std::uint32_t magic
The flavor actually parsed.
std::span< const std::byte > commonData
Wdc5HeaderPrefix wdc5
Valid when magic == Wdc5Magic.
std::uint64_t fieldRaw(std::size_t field, std::uint32_t element, std::uint32_t arrayCount, std::span< const std::byte > recordBytes, std::uint32_t id, const std::vector< std::uint32_t > &additional) const
Decode array element element of inline field field for one record.
Wdc3Header header
WDC1 header fields are mapped onto this.
std::vector< std::uint32_t > fieldAdditionalOffsets() const
The byte offset into palletData / commonData where each field's additional data begins (accumulated i...
static Result< WdcImage > parse(std::span< const std::byte > data)
Parse and structurally validate data as a WDC-family file, sniffing the flavor off the magic.
std::vector< WdcFieldStructure > fieldStructure
std::span< const std::byte > palletData
bool fieldIsSigned(std::size_t field) const
Whether field field's storage is the signed bitpacked kind (after WDC1 normalization).
std::vector< WdcSection > sections
std::vector< std::byte > ownedOffsetMap
Owned backing for WDC1's normalized sparse map (filtered entries + the ids the dense map only implied...
std::vector< std::uint32_t > ownedOffsetMapIds
bool isSparse() const
Whether this file uses the sparse offset-map layout (flag 0x01).
bool idIsNoninline() const
Whether the id comes from the idList rather than a record field (flag 0x04); when false,...
A located, structurally-validated section.
std::span< const std::byte > records
Fixed-stride record region (non-sparse), or the variable sparse record region.
Wdc3SectionHeader header
Synthesized for WDC1.
std::uint32_t stringBase
Absolute file offset the section's strings start at.
std::span< const std::byte > offsetMap
{uint32 offset, uint16 size} entries (sparse).
std::span< const std::byte > copyTable
{uint32 newId, uint32 srcId} pairs.
std::span< const std::byte > idList
uint32 ids, present when flag 0x04.
std::span< const std::byte > relationship
Relationship block (map header + pairs).
std::span< const std::byte > strings
Section string block (non-sparse).
std::vector< std::uint32_t > encryptedIds
WDC4+: the encrypted_status id list.
bool encrypted
tactKeyHash != 0 AND records zeroed.
std::span< const std::byte > offsetMapIds
uint32 ids paired with offsetMap (sparse).