wowlib 0.0.0
Read & write World of Warcraft client files — a C++26 core
Loading...
Searching...
No Matches
wowlib::formats::m2::AnimCache Class Reference

A lazy per-sequence .anim loader handing out resolution windows: for a chunked file (leading AFM2) the requested chunk's payload, for a raw file the whole content when AFM2 is asked for (raw files predate the split sections). More...

#include <wowlib/formats/m2/satellites.hpp>

Public Member Functions

 AnimCache (std::function< Result< FileBuffer >(SequenceKey)> loader)
std::span< const std::byte > window (SequenceKey key, std::uint32_t target)
 The resolution window of sequence key's file for chunk target (afm2/afsa/AfsbMagic); empty when unavailable.
template<typename Sequence>
auto sequenceBase (const std::vector< Sequence > &sequences, std::span< const std::byte > inlineBase, std::uint32_t target)
 The per-sequence base resolver every M2-family read path shares: sequence i's inner arrays resolve against inlineBase when its data is inline, the EMPTY span when it is an alias (stale records are never chased — see M2Sequence::isAlias), or the matching .anim window otherwise.

Static Public Member Functions

static std::uint32_t afidLookup (std::span< const chunked::record::AnimFileEntry > entries, SequenceKey key)
 The AFID FileDataID for sequence key, 0 when unlisted.

Static Public Attributes

static constexpr std::uint32_t Afm2Magic = fourcc("AFM2", FourCCEndian::Forward)
static constexpr std::uint32_t AfsaMagic = fourcc("AFSA", FourCCEndian::Forward)
static constexpr std::uint32_t AfsbMagic = fourcc("AFSB", FourCCEndian::Forward)

Detailed Description

A lazy per-sequence .anim loader handing out resolution windows: for a chunked file (leading AFM2) the requested chunk's payload, for a raw file the whole content when AFM2 is asked for (raw files predate the split sections).

Missing files and absent sections resolve to empty spans — the offset engine leaves those tracks empty.

Definition at line 103 of file satellites.hpp.

Constructor & Destructor Documentation

◆ AnimCache()

wowlib::formats::m2::AnimCache::AnimCache ( std::function< Result< FileBuffer >(SequenceKey)> loader)
inlineexplicit
Parameters
loaderfetches the .anim bytes for a sequence key.

Definition at line 118 of file satellites.hpp.

Member Function Documentation

◆ afidLookup()

std::uint32_t wowlib::formats::m2::AnimCache::afidLookup ( std::span< const chunked::record::AnimFileEntry > entries,
SequenceKey key )
inlinestatic

The AFID FileDataID for sequence key, 0 when unlisted.

Definition at line 111 of file satellites.hpp.

References wowlib::formats::m2::SequenceKey::id, and wowlib::formats::m2::SequenceKey::variation.

◆ sequenceBase()

template<typename Sequence>
auto wowlib::formats::m2::AnimCache::sequenceBase ( const std::vector< Sequence > & sequences,
std::span< const std::byte > inlineBase,
std::uint32_t target )
inline

The per-sequence base resolver every M2-family read path shares: sequence i's inner arrays resolve against inlineBase when its data is inline, the EMPTY span when it is an alias (stale records are never chased — see M2Sequence::isAlias), or the matching .anim window otherwise.

The alias-datablock policy lives here ONCE for the monolithic, chunked and skeleton decode paths alike.

Parameters
sequencesthe sequence table driving the flags; taken by reference — it may still be mid-decode when the context is built, the resolver reads it lazily.
inlineBasethe buffer inline sequence data resolves against.
targetthe .anim chunk the tracks live in (afm2/afsa/afsb).
Returns
the resolver to install as OffsetReadContext::sequenceBase.

Definition at line 159 of file satellites.hpp.

References window().

◆ window()

std::span< const std::byte > wowlib::formats::m2::AnimCache::window ( SequenceKey key,
std::uint32_t target )
inline

The resolution window of sequence key's file for chunk target (afm2/afsa/AfsbMagic); empty when unavailable.

Definition at line 123 of file satellites.hpp.

References Afm2Magic, and wowlib::formats::fourcc().

Referenced by sequenceBase().

Member Data Documentation

◆ Afm2Magic

std::uint32_t wowlib::formats::m2::AnimCache::Afm2Magic = fourcc("AFM2", FourCCEndian::Forward)
staticconstexpr

Definition at line 106 of file satellites.hpp.

Referenced by window().

◆ AfsaMagic

std::uint32_t wowlib::formats::m2::AnimCache::AfsaMagic = fourcc("AFSA", FourCCEndian::Forward)
staticconstexpr

Definition at line 107 of file satellites.hpp.

Referenced by wowlib::formats::m2::detail::Skeleton< V >::write().

◆ AfsbMagic

std::uint32_t wowlib::formats::m2::AnimCache::AfsbMagic = fourcc("AFSB", FourCCEndian::Forward)
staticconstexpr

Definition at line 108 of file satellites.hpp.

Referenced by wowlib::formats::m2::detail::Skeleton< V >::write().


The documentation for this class was generated from the following file: