wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
wdb2.hpp File Reference

WDB2 — the .db2 format of the Cataclysm..WoD MPQ/early-CASC era (4.0.1.12911 . More...

#include <cstddef>
#include <cstdint>
#include <span>
#include <type_traits>
#include <wowlib/core/buffer.hpp>
#include <wowlib/core/error.hpp>
#include <wowlib/db/codec.hpp>
#include <wowlib/formats/common/fourcc.hpp>
Include dependency graph for wdb2.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  wowlib::db::Wdb2Header
 The 48-byte WDB2 header (wowdev.wiki/DB2). More...

Namespaces

namespace  wowlib
namespace  wowlib::db

Functions

Result< void > wowlib::db::readWdb2 (const TableInfo &info, std::span< const std::byte > data, RecordSink &sink, TableState &state)
 Decode a WDB2 image: header, optional id-index block, fixed-stride records, string block, optional trailing copy table (index/copy preserved verbatim).
Result< FileBuffer > wowlib::db::writeWdb2 (const TableInfo &info, const RecordSource &source, const TableState &state)
 Encode a WDB2 image; header identity and the verbatim index/copy blocks are re-emitted.

Variables

constexpr std::uint32_t wowlib::db::Wdb2Magic = formats::fourcc("WDB2", formats::FourCCEndian::Forward)
 The WDB2 magic as memcpy'd off the file front (the bytes "WDB2").
constexpr std::size_t wowlib::db::Wdb2IndexEntryBytes = 6
 The per-id index block entry stride when maxId != 0: int32 indices[maxId - minId + 1] followed by int16 string_lengths[maxId - minId + 1] — 6 bytes per id in total.

Detailed Description

WDB2 — the .db2 format of the Cataclysm..WoD MPQ/early-CASC era (4.0.1.12911 .

. 7.0.1.20740): the WDBC layout plus table identity (tableHash/build/timestamp), an optional id-index block ahead of the records (engaged when maxId != 0) and an optional trailing copy table. Field types are still not in the file; the schema comes from WoWDBDefs.

UNVERIFIED against real clients: no Cata/MoP/WoD install is available locally — the layout follows wowdev.wiki/DB2 and is exercised by synthetic unit tests only (plan of record, stage 2). The index and copy blocks are preserved and re-emitted verbatim.

Definition in file wdb2.hpp.