WoW Model Viewer
Your premiere tool for viewing, equipping and animating World of Warcraft models.
Loading...
Searching...
No Matches
ChunkReader Namespace Reference

Standalone utility for parsing WoW chunk-based file formats. More...

Classes

struct  ChunkHeader
 On-disk chunk header: 4-byte magic + 4-byte size. More...
 
struct  ChunkInfo
 Runtime representation of a single parsed chunk. More...
 

Functions

const std::vector< std::string > & knownFirstChunks ()
 
bool isChunked (const unsigned char *data, size_t dataSize)
 Determine whether a buffer begins with a known chunked-file header.
 
std::vector< ChunkInfoparse (const unsigned char *data, size_t dataSize)
 Parse all top-level chunks from a buffer.
 

Detailed Description

Standalone utility for parsing WoW chunk-based file formats.

All WoW chunked files (M2, .skel, .bone, .anim, WMO, ADT, etc.) share a common envelope: sequential [4-char magic][uint32 size][data] blocks. This reader walks the buffer and returns the chunk table. Detection of chunked files uses a whitelist of known first-chunk IDs to avoid false positives on non-chunked formats (.skin, .db2, .blp, etc.) that also happen to start with printable ASCII.

Function Documentation

◆ isChunked()

bool ChunkReader::isChunked ( const unsigned char *  data,
size_t  dataSize 
)
inline

Determine whether a buffer begins with a known chunked-file header.

Checks the first 4 bytes against the whitelist of known WoW chunk IDs and verifies the declared size fits within the buffer.

Parameters
dataPointer to the start of the buffer.
dataSizeTotal size of the buffer in bytes.
Returns
true if the buffer appears to be chunk-structured.

Definition at line 61 of file ChunkReader.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ knownFirstChunks()

const std::vector< std::string > & ChunkReader::knownFirstChunks ( )
inline

Known first-chunk magic values for WoW chunked file formats. Only the magic that can appear as the first chunk in a file needs to be listed here — inner chunks are parsed generically.

Definition at line 39 of file ChunkReader.h.

Here is the caller graph for this function:

◆ parse()

std::vector< ChunkInfo > ChunkReader::parse ( const unsigned char *  data,
size_t  dataSize 
)
inline

Parse all top-level chunks from a buffer.

Walks sequential [magic][size][data] blocks until the end of the buffer is reached. No whitelist is required — any valid header that fits within bounds is accepted.

Parameters
dataPointer to the start of the buffer.
dataSizeTotal size of the buffer in bytes.
Returns
Ordered vector of parsed chunks.

Definition at line 86 of file ChunkReader.h.

Here is the caller graph for this function: