wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
wowlib::fs::detail Namespace Reference

Classes

struct  ChainEntry
 One base-tier row. More...
struct  ChainMember
 One resolved member of a chain, in load order. More...
class  FdidAllocator
 Monotonic allocator for custom (non-Blizzard) FileDataIDs. More...
struct  MpqChainSpec
 A client version's archive chain: the fixed base tier plus how its patch tier is found. More...

Enumerations

enum class  ChainEntryKind { Fixed , LocaleFixed }
 How one base-tier row produces its archive path. More...
enum class  PatchScheme { None , ClassicWildcard , UpdateChain }
 How a version's patch tier is discovered on disk. More...

Functions

const MpqChainSpec * findChainSpec (const ClientVersion &version)
 The chain spec for version: exact build match first, then major.minor.patch.
Result< std::vector< ChainMember > > expandChain (const MpqChainSpec &spec, const std::filesystem::path &dataDir, Locale locale)
 Expand a chain spec against a Data directory into concrete members in load order (lowest -> highest priority): the base tier in table order, then the patch tier as ONE list sorted by the client's case-insensitive, extension-stripped filename order (so patch < patch-2 < ..., with base and locale patches interleaved — a high base letter-patch like patch-Z outranks the locale patches).

Enumeration Type Documentation

◆ ChainEntryKind

How one base-tier row produces its archive path.

Patches are NOT table rows: the client wildcard-loads them, so we discover them on disk via a PatchScheme (glob + sort) rather than naming each.

Enumerator
Fixed 

One archive in Data/, e.g.

"common.MPQ".

LocaleFixed 

One archive in Data/{locale}/, "{locale}" expanded.

Definition at line 20 of file mpq_chain.hpp.

◆ PatchScheme

How a version's patch tier is discovered on disk.

Enumerator
None 

No patch tier.

ClassicWildcard 

Pre-Cata wildcard patch tier.

patch.MPQ + single-char patch-?.MPQ in Data/, and patch-{locale}[-?].MPQ in Data/{locale}/, merged and sorted by extension-agnostic filename.

UpdateChain 

cata/MoP incremental updates: wow-update-{build}.MPQ / wow-update-base-{build}.MPQ in Data/ and wow-update-{locale}-{build}.MPQ in Data/{locale}/, ascending build.

These are NOT standalone archives: they hold PTCH deltas and added files that must attach to the base archives via StormLib's patch-archive mechanism. Retail archives store entries under BARE paths, so the attach passes no prefix (see mpq_storage.cpp).

Definition at line 32 of file mpq_chain.hpp.

Function Documentation

◆ expandChain()

Result< std::vector< ChainMember > > wowlib::fs::detail::expandChain ( const MpqChainSpec & spec,
const std::filesystem::path & dataDir,
Locale locale )

Expand a chain spec against a Data directory into concrete members in load order (lowest -> highest priority): the base tier in table order, then the patch tier as ONE list sorted by the client's case-insensitive, extension-stripped filename order (so patch < patch-2 < ..., with base and locale patches interleaved — a high base letter-patch like patch-Z outranks the locale patches).

Members whose file/dir is absent are skipped — clients routinely lack optional patches. A member resolves to a loose directory when a folder of the archive's name stands in for the archive; a real file of the same name would win, though a single Data root cannot hold both.

For the UpdateChain scheme (Cata/MoP), the patch tier instead globs the wow-update-* archives of Data/ (prefix "base") and Data/{locale}/ (prefix "{locale}") and appends them ascending by build number as INCREMENTAL members — the storage attaches each to the base archives of its directory rather than opening it standalone.

Parameters
specthe version's chain table.
dataDirthe client's Data/ directory.
localethe locale used for "{locale}" expansion.
Returns
members in load order.

Definition at line 292 of file mpq_chain.cpp.

References wowlib::fs::detail::MpqChainSpec::baseEntries, ClassicWildcard, Fixed, wowlib::fs::detail::ChainEntry::kind, wowlib::localeCode(), LocaleFixed, wowlib::fs::detail::MpqChainSpec::patchScheme, wowlib::fs::detail::ChainEntry::pattern, and UpdateChain.

◆ findChainSpec()

const MpqChainSpec * wowlib::fs::detail::findChainSpec ( const ClientVersion & version)

The chain spec for version: exact build match first, then major.minor.patch.

Parameters
versionthe client version to look up.
Returns
the spec, or nullptr for versions without a table yet.

Definition at line 282 of file mpq_chain.cpp.

References wowlib::ClientVersion::build, wowlib::ClientVersion::major, and wowlib::ClientVersion::minor.