xoreos  0.0.5
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Aurora::BZFFile Class Reference

Class to hold resource data information of a BZF file. More...

#include <bzffile.h>

Inheritance diagram for Aurora::BZFFile:
Inheritance graph
[legend]
Collaboration diagram for Aurora::BZFFile:
Collaboration graph
[legend]

Classes

struct  IResource
 Internal resource information. More...
 

Public Member Functions

 BZFFile (Common::SeekableReadStream *bzf)
 Take over this stream and read a BZF file out of it. More...
 
 ~BZFFile ()
 
const ResourceListgetResources () const
 Return the list of resources. More...
 
uint32 getResourceSize (uint32 index) const
 Return the size of a resource. More...
 
Common::SeekableReadStreamgetResource (uint32 index, bool tryNoCopy=false) const
 Return a stream of the resource's contents. More...
 
void mergeKEY (const KEYFile &key, uint32 dataFileIndex)
 Merge information from the KEY into the data file. More...
 
- Public Member Functions inherited from Aurora::KEYDataFile
virtual ~KEYDataFile ()
 
- Public Member Functions inherited from Aurora::Archive
 Archive ()
 
virtual ~Archive ()
 
virtual Common::HashAlgo getNameHashAlgo () const
 Return with which algorithm the name is hashed. More...
 
uint32 findResource (uint64 hash) const
 Return the index of the resource matching the hash, or 0xFFFFFFFF if not found. More...
 
uint32 findResource (const Common::UString &name, FileType type) const
 Return the index of the resource matching the name and type, or 0xFFFFFFFF if not found. More...
 
- Public Member Functions inherited from Aurora::AuroraFile
 AuroraFile ()
 
void clear ()
 
uint32 getID () const
 Return the file's ID. More...
 
uint32 getVersion () const
 Return the file's version. More...
 
bool isUTF16LE () const
 Were the ID and version encoded in little-endian UTF-16 in the file? More...
 

Private Types

typedef std::vector< IResourceIResourceList
 

Private Member Functions

void load (Common::SeekableReadStream &bzf)
 
void readVarResTable (Common::SeekableReadStream &bzf, uint32 offset)
 
const IResourcegetIResource (uint32 index) const
 

Private Attributes

Common::ScopedPtr< Common::SeekableReadStream_bzf
 
ResourceList _resources
 External list of resource names and types. More...
 
IResourceList _iResources
 Internal list of resource offsets and sizes. More...
 

Additional Inherited Members

- Public Types inherited from Aurora::Archive
typedef std::list< ResourceResourceList
 
- Static Public Member Functions inherited from Aurora::AuroraFile
static void readHeader (Common::ReadStream &stream, uint32 &id, uint32 &version, bool &utf16le)
 Read the header out of a stream. More...
 
static void readHeader (Common::ReadStream &stream, uint32 &id, uint32 &version)
 Read the ID and version out of a stream. More...
 
static uint32 readHeaderID (Common::ReadStream &stream)
 Read the ID out of a stream. More...
 
- Protected Member Functions inherited from Aurora::AuroraFile
void readHeader (Common::ReadStream &stream)
 
- Static Protected Member Functions inherited from Aurora::AuroraFile
static uint32 convertUTF16LE (uint32 x1, uint32 x2)
 
- Protected Attributes inherited from Aurora::AuroraFile
uint32 _id
 The file's ID. More...
 
uint32 _version
 The file's version. More...
 
bool _utf16le
 The file's ID and version are in little-endian UTF-16. More...
 

Detailed Description

Class to hold resource data information of a BZF file.

A BZF is a compressed variation of a BIF file, found exclusively in the Android and iOS version of Knights of the Old Republic.

See also classes KEYFile in keyfile.h and BIFFile in biffile.h.

Definition at line 55 of file bzffile.h.

Member Typedef Documentation

◆ IResourceList

typedef std::vector<IResource> Aurora::BZFFile::IResourceList
private

Definition at line 91 of file bzffile.h.

Constructor & Destructor Documentation

◆ BZFFile()

Aurora::BZFFile::BZFFile ( Common::SeekableReadStream bzf)

Take over this stream and read a BZF file out of it.

Definition at line 44 of file bzffile.cpp.

References _bzf, and load().

Here is the call graph for this function:

◆ ~BZFFile()

Aurora::BZFFile::~BZFFile ( )

Definition at line 50 of file bzffile.cpp.

Member Function Documentation

◆ getIResource()

const BZFFile::IResource & Aurora::BZFFile::getIResource ( uint32  index) const
private

Definition at line 132 of file bzffile.cpp.

References _iResources.

Referenced by getResource(), and getResourceSize().

Here is the caller graph for this function:

◆ getResource()

Common::SeekableReadStream * Aurora::BZFFile::getResource ( uint32  index,
bool  tryNoCopy = false 
) const
virtual

Return a stream of the resource's contents.

Implements Aurora::Archive.

Definition at line 143 of file bzffile.cpp.

References _bzf, Common::decompressLZMA1(), getIResource(), Aurora::BZFFile::IResource::offset, Aurora::BZFFile::IResource::packedSize, and Aurora::BZFFile::IResource::size.

Here is the call graph for this function:

◆ getResources()

const Archive::ResourceList & Aurora::BZFFile::getResources ( ) const
virtual

Return the list of resources.

Implements Aurora::Archive.

Definition at line 128 of file bzffile.cpp.

References _resources.

◆ getResourceSize()

uint32 Aurora::BZFFile::getResourceSize ( uint32  index) const
virtual

Return the size of a resource.

Reimplemented from Aurora::Archive.

Definition at line 139 of file bzffile.cpp.

References getIResource(), and Aurora::BZFFile::IResource::size.

Here is the call graph for this function:

◆ load()

void Aurora::BZFFile::load ( Common::SeekableReadStream bzf)
private

Definition at line 53 of file bzffile.cpp.

References Aurora::AuroraFile::_id, _iResources, Aurora::AuroraFile::_version, Common::StackException::add(), Common::debugTag(), kBZFID, kVersion1, Aurora::AuroraFile::readHeader(), Common::ReadStream::readUint32LE(), and readVarResTable().

Referenced by BZFFile().

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

◆ mergeKEY()

void Aurora::BZFFile::mergeKEY ( const KEYFile key,
uint32  dataFileIndex 
)
virtual

Merge information from the KEY into the data file.

Without this step, this data file archive does not contain any resource names at all.

Parameters
keyA KEYFile with information about this data file.
dataFileIndexThe index this data file has within the KEY file.

Implements Aurora::KEYDataFile.

Definition at line 101 of file bzffile.cpp.

References _iResources, _resources, Aurora::KEYFile::getResources(), Aurora::Archive::Resource::name, and warning().

Here is the call graph for this function:

◆ readVarResTable()

void Aurora::BZFFile::readVarResTable ( Common::SeekableReadStream bzf,
uint32  offset 
)
private

Definition at line 83 of file bzffile.cpp.

References _iResources, Common::ReadStream::readUint32LE(), Common::SeekableReadStream::seek(), Common::SeekableReadStream::size(), and Common::SeekableReadStream::skip().

Referenced by load().

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

Member Data Documentation

◆ _bzf

Common::ScopedPtr<Common::SeekableReadStream> Aurora::BZFFile::_bzf
private

Definition at line 93 of file bzffile.h.

Referenced by BZFFile(), and getResource().

◆ _iResources

IResourceList Aurora::BZFFile::_iResources
private

Internal list of resource offsets and sizes.

Definition at line 99 of file bzffile.h.

Referenced by getIResource(), load(), mergeKEY(), and readVarResTable().

◆ _resources

ResourceList Aurora::BZFFile::_resources
private

External list of resource names and types.

Definition at line 96 of file bzffile.h.

Referenced by getResources(), and mergeKEY().


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