xoreos
0.0.5
|
Class to hold resource data information of a BIF file. More...
#include <biffile.h>
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 ResourceList & | getResources () const |
Return the list of resources. More... | |
uint32 | getResourceSize (uint32 index) const |
Return the size of a resource. More... | |
Common::SeekableReadStream * | getResource (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< IResource > | IResourceList |
Private Member Functions | |
void | load (Common::SeekableReadStream &bif) |
void | readVarResTable (Common::SeekableReadStream &bif, uint32 offset) |
const IResource & | getIResource (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< Resource > | ResourceList |
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... | |
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.
|
private |
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.
Aurora::BIFFile::~BIFFile | ( | ) |
Definition at line 51 of file biffile.cpp.
|
private |
Definition at line 130 of file biffile.cpp.
References _iResources.
Referenced by getResource(), and getResourceSize().
|
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.
|
virtual |
Return the list of resources.
Implements Aurora::Archive.
Definition at line 126 of file biffile.cpp.
References _resources.
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.
|
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().
Merge information from the KEY into the data file.
Without this step, this data file archive does not contain any resource names at all.
key | A KEYFile with information about this data file. |
dataFileIndex | The 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().
|
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().
|
private |
Definition at line 107 of file biffile.h.
Referenced by BIFFile(), and getResource().
|
private |
Internal list of resource offsets and sizes.
Definition at line 113 of file biffile.h.
Referenced by getIResource(), load(), mergeKEY(), and readVarResTable().
|
private |
External list of resource names and types.
Definition at line 110 of file biffile.h.
Referenced by getResources(), and mergeKEY().