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

Unified reader for WDC2, WDC3, WDC4 and WDC5 DB2 files. More...

#include <DB2Reader.h>

Inheritance diagram for DB2Reader:
[legend]
Collaboration diagram for DB2Reader:
[legend]

Classes

struct  CopyTableEntry
 
struct  FieldStorageInfo
 
struct  FieldStructure
 
struct  OffsetMapEntry
 
struct  RecordLocation
 
struct  SectionData
 
struct  SectionHeaderWDC2
 
struct  SectionHeaderWDC3
 
struct  WDCHeader
 

Public Member Functions

 DB2Reader (const std::string &file)
 
 ~DB2Reader () override
 
bool open ()
 
bool close ()
 
- Public Member Functions inherited from CASCFile
 CASCFile (std::string path, int id=-1)
 
 ~CASCFile ()
 
size_t read (void *dest, size_t bytes)
 Read bytes from the file into dest.
 
void seek (size_t offset)
 Seek to an absolute byte offset.
 
void dumpStructure ()
 
- Public Member Functions inherited from GameFile
 GameFile (std::string path, int id=-1)
 
virtual ~GameFile ()=default
 
size_t getSize ()
 Total size of the file in bytes.
 
size_t getPos ()
 Current read position.
 
unsigned char * getBuffer () const
 Pointer to the start of the internal buffer.
 
unsigned char * getPointer ()
 Pointer to the current read position within the buffer.
 
bool isEof ()
 True if the read pointer has reached the end of the file.
 
void seekRelative (size_t offset)
 Advance the read pointer by offset bytes.
 
bool open (bool useMemoryBuffer=true)
 Open the file, optionally loading into a memory buffer.
 
bool close ()
 Close the file and release the internal buffer.
 
void setFullName (const std::string &name)
 
const std::string & fullname () const
 
int fileDataId ()
 
void allocate (unsigned long long size)
 Allocate (or reallocate) the internal buffer to the given size.
 
bool setChunk (std::string chunkName, bool resetToStart=true)
 Switch the active read window to the named chunk.
 
bool isChunked ()
 True if the file has been parsed into named chunks.
 
- Public Member Functions inherited from Component
 Component ()
 
virtual ~Component ()
 
virtual bool addChild (Component *)
 Add a child component to this node.
 
virtual bool removeChild (Component *)
 Remove a child component from this node.
 
virtual void removeAllChildren ()
 
virtual unsigned int nbChildren () const
 
virtual bool findChildComponent (Component *, bool)
 
virtual ComponentgetChild (unsigned int)
 
virtual const ComponentgetChild (unsigned int) const
 
void setParentComponent (Component *)
 Set the parent of this component.
 
virtual void onParentSet (Component *)
 Called after the parent has been set; override for custom logic.
 
const Componentparent () const
 Get the parent component (const).
 
Componentparent ()
 Get the parent component.
 
template<class DataType >
const DataType * firstParentOfType ()
 Walk up the parent chain and return the first ancestor of the given type.
 
void ref ()
 Increment the reference counter.
 
void unref ()
 Decrement the reference counter; deletes this when it reaches zero.
 
void setName (const std::string &name)
 
std::string name () const
 
virtual void onNameChanged ()
 
void print (int l_depth=0)
 
virtual void doPrint ()
 
void copy (const Component &component, bool)
 

Private Types

enum  FieldCompression : uint32_t {
  COMP_NONE = 0 , COMP_BITPACKED = 1 , COMP_COMMON_DATA = 2 , COMP_BITPACKED_INDEXED = 3 ,
  COMP_BITPACKED_INDEXED_ARRAY = 4 , COMP_BITPACKED_SIGNED = 5
}
 

Private Member Functions

uint64_t readBitpackedValue64 (const FieldStorageInfo &info, const unsigned char *recordOffset) const
 
bool readFieldValue (unsigned int sectionIndex, unsigned int recordIndexInSection, unsigned int fieldIndex, unsigned int arrayIndex, unsigned int arraySize, uint32_t recordID, unsigned int &result) const
 
const unsigned char * getRecordOffset (unsigned int sectionIndex, unsigned int recordIndexInSection) const
 

Private Attributes

int m_wdcVersion = 0
 
WDCHeader m_header {}
 
std::vector< FieldStorageInfom_fieldStorageInfo
 
std::map< uint32_t, uint32_t > m_palletBlockOffsets
 
unsigned char * m_palletData = nullptr
 
std::map< uint32_t, std::map< uint32_t, uint32_t > > m_commonData
 
std::vector< SectionDatam_sections
 
std::vector< RecordLocationm_recordLocations
 
std::unordered_map< uint32_t, size_t > m_idToRecordIndex
 
std::unordered_map< uint32_t, std::vector< uint32_t > > m_relationshipLookup
 
std::map< uint32_t, uint32_t > m_copyTable
 
unsigned char * m_fileData = nullptr
 
size_t m_fileDataSize = 0
 
std::map< int, int > m_fieldSizes
 

Friends

class DB2Table
 

Additional Inherited Members

- Protected Member Functions inherited from CASCFile
virtual bool openFile ()
 
virtual bool isAlreadyOpened ()
 
virtual bool getFileSize (unsigned long long &s)
 
virtual unsigned long readFile ()
 
virtual void doPostOpenOperation ()
 
virtual bool doPostCloseOperation ()
 
- Protected Attributes inherited from GameFile
bool eof
 
unsigned char * buffer
 
unsigned long long pointer
 
unsigned long long size
 
std::string filepath
 
int m_fileDataId
 
std::vector< Chunkchunks
 
bool m_useMemoryBuffer
 

Detailed Description

Unified reader for WDC2, WDC3, WDC4 and WDC5 DB2 files.

Supports multiple sections, encrypted-section detection, 64-bit bitpacked reads, and WDC4/5 extras.

Definition at line 15 of file DB2Reader.h.

Member Enumeration Documentation

◆ FieldCompression

enum DB2Reader::FieldCompression : uint32_t
private
Enumerator
COMP_NONE 
COMP_BITPACKED 
COMP_COMMON_DATA 
COMP_BITPACKED_INDEXED 
COMP_BITPACKED_INDEXED_ARRAY 
COMP_BITPACKED_SIGNED 

Definition at line 28 of file DB2Reader.h.

Constructor & Destructor Documentation

◆ DB2Reader()

DB2Reader::DB2Reader ( const std::string &  file)
explicit

Definition at line 34 of file DB2Reader.cpp.

◆ ~DB2Reader()

DB2Reader::~DB2Reader ( )
override

Definition at line 39 of file DB2Reader.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ close()

bool DB2Reader::close ( )

Definition at line 47 of file DB2Reader.cpp.

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

◆ getRecordOffset()

const unsigned char * DB2Reader::getRecordOffset ( unsigned int  sectionIndex,
unsigned int  recordIndexInSection 
) const
private

Definition at line 585 of file DB2Reader.cpp.

Here is the caller graph for this function:

◆ open()

bool DB2Reader::open ( )

Definition at line 55 of file DB2Reader.cpp.

Here is the call graph for this function:

◆ readBitpackedValue64()

uint64_t DB2Reader::readBitpackedValue64 ( const FieldStorageInfo info,
const unsigned char *  recordOffset 
) const
private

Definition at line 615 of file DB2Reader.cpp.

Here is the caller graph for this function:

◆ readFieldValue()

bool DB2Reader::readFieldValue ( unsigned int  sectionIndex,
unsigned int  recordIndexInSection,
unsigned int  fieldIndex,
unsigned int  arrayIndex,
unsigned int  arraySize,
uint32_t  recordID,
unsigned int &  result 
) const
private

Definition at line 630 of file DB2Reader.cpp.

Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ DB2Table

friend class DB2Table
friend

Definition at line 25 of file DB2Reader.h.

Member Data Documentation

◆ m_commonData

std::map<uint32_t, std::map<uint32_t, uint32_t> > DB2Reader::m_commonData
private

Definition at line 163 of file DB2Reader.h.

◆ m_copyTable

std::map<uint32_t, uint32_t> DB2Reader::m_copyTable
private

Definition at line 184 of file DB2Reader.h.

◆ m_fieldSizes

std::map<int, int> DB2Reader::m_fieldSizes
private

Definition at line 191 of file DB2Reader.h.

◆ m_fieldStorageInfo

std::vector<FieldStorageInfo> DB2Reader::m_fieldStorageInfo
private

Definition at line 160 of file DB2Reader.h.

◆ m_fileData

unsigned char* DB2Reader::m_fileData = nullptr
private

Definition at line 188 of file DB2Reader.h.

◆ m_fileDataSize

size_t DB2Reader::m_fileDataSize = 0
private

Definition at line 189 of file DB2Reader.h.

◆ m_header

WDCHeader DB2Reader::m_header {}
private

Definition at line 158 of file DB2Reader.h.

◆ m_idToRecordIndex

std::unordered_map<uint32_t, size_t> DB2Reader::m_idToRecordIndex
private

Definition at line 178 of file DB2Reader.h.

◆ m_palletBlockOffsets

std::map<uint32_t, uint32_t> DB2Reader::m_palletBlockOffsets
private

Definition at line 161 of file DB2Reader.h.

◆ m_palletData

unsigned char* DB2Reader::m_palletData = nullptr
private

Definition at line 162 of file DB2Reader.h.

◆ m_recordLocations

std::vector<RecordLocation> DB2Reader::m_recordLocations
private

Definition at line 175 of file DB2Reader.h.

◆ m_relationshipLookup

std::unordered_map<uint32_t, std::vector<uint32_t> > DB2Reader::m_relationshipLookup
private

Definition at line 181 of file DB2Reader.h.

◆ m_sections

std::vector<SectionData> DB2Reader::m_sections
private

Definition at line 165 of file DB2Reader.h.

◆ m_wdcVersion

int DB2Reader::m_wdcVersion = 0
private

Definition at line 156 of file DB2Reader.h.


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