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

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

#include <biffile.h>

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

Classes

struct  IResource
 Internal resource information. More...
 

Public Member Functions

 BIFFile (Common::SeekableReadStream *bif)
 Take over this stream and read a BIF file out of it. More...
 
 ~BIFFile ()
 
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 &bif)
 
void readVarResTable (Common::SeekableReadStream &bif, uint32 offset)
 
const IResourcegetIResource (uint32 index) const
 

Private Attributes

Common::ScopedPtr< Common::SeekableReadStream_bif
 
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 BIF file.

A BIF file is one part of the KEY/BIF resource archive system. The KEY file contains the resource names and types, and the BIF file contains the actual resource data. So BIF files only contain the resource data itself.

A KEY file can index resources of several BIF files and several BIF files can in turn index different resources of the same BIF file.

Additionally, there are BZF files. 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 BZFFile in bzffile.h.

There are two versions of BIF files known and supported

Please note that BIF (and KEY) files found in Infinity Engine games (Baldur's Gate et al) are not supported at all, even though they claim to be V1.

Definition at line 71 of file biffile.h.

Member Typedef Documentation

◆ IResourceList

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

Definition at line 105 of file biffile.h.

Constructor & Destructor Documentation

◆ BIFFile()

Aurora::BIFFile::BIFFile ( Common::SeekableReadStream bif)

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

Definition at line 45 of file biffile.cpp.

References _bif, and load().

Here is the call graph for this function:

◆ ~BIFFile()

Aurora::BIFFile::~BIFFile ( )

Definition at line 51 of file biffile.cpp.

Member Function Documentation

◆ getIResource()

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

Definition at line 130 of file biffile.cpp.

References _iResources.

Referenced by getResource(), and getResourceSize().

Here is the caller graph for this function:

◆ getResource()

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

Return a stream of the resource's contents.

Implements Aurora::Archive.

Definition at line 141 of file biffile.cpp.

References _bif, Common::ScopedPtrBase< T, Deallocator >::get(), getIResource(), Aurora::BIFFile::IResource::offset, and Aurora::BIFFile::IResource::size.

Here is the call graph for this function:

◆ getResources()

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

Return the list of resources.

Implements Aurora::Archive.

Definition at line 126 of file biffile.cpp.

References _resources.

◆ getResourceSize()

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

Return the size of a resource.

Reimplemented from Aurora::Archive.

Definition at line 137 of file biffile.cpp.

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

Here is the call graph for this function:

◆ load()

void Aurora::BIFFile::load ( Common::SeekableReadStream bif)
private

Definition at line 54 of file biffile.cpp.

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

Referenced by BIFFile().

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

◆ mergeKEY()

void Aurora::BIFFile::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 99 of file biffile.cpp.

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

Here is the call graph for this function:

◆ readVarResTable()

void Aurora::BIFFile::readVarResTable ( Common::SeekableReadStream bif,
uint32  offset 
)
private

Definition at line 84 of file biffile.cpp.

References _iResources, Aurora::AuroraFile::_version, kVersion11, Common::ReadStream::readUint32LE(), Common::SeekableReadStream::seek(), 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

◆ _bif

Common::ScopedPtr<Common::SeekableReadStream> Aurora::BIFFile::_bif
private

Definition at line 107 of file biffile.h.

Referenced by BIFFile(), and getResource().

◆ _iResources

IResourceList Aurora::BIFFile::_iResources
private

Internal list of resource offsets and sizes.

Definition at line 113 of file biffile.h.

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

◆ _resources

ResourceList Aurora::BIFFile::_resources
private

External list of resource names and types.

Definition at line 110 of file biffile.h.

Referenced by getResources(), and mergeKEY().


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