78 e.
add(
"Failed reading BIF file");
102 for (KEYFile::ResourceList::const_iterator keyRes = keyResList.begin(); keyRes != keyResList.end(); ++keyRes) {
103 if (keyRes->bifIndex != dataFileIndex)
107 warning(
"Resource index out of range (%d/%d)", keyRes->resIndex, (
int)
_iResources.size());
111 if (keyRes->type !=
_iResources[keyRes->resIndex].type)
112 warning(
"KEY and BIF disagree on the type of the resource \"%s\" (%d, %d). Trusting the BIF",
113 keyRes->name.c_str(), keyRes->type,
_iResources[keyRes->resIndex].type);
117 res.
name = keyRes->name;
119 res.index = keyRes->resIndex;
void load(Common::SeekableReadStream &bif)
#define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like 'DATA', to ensure portability.
void add(const char *s,...) GCC_PRINTF(2
uint32 readUint32LE()
Read an unsigned 32-bit word stored in little endian (LSB first) order from the stream and return it...
virtual size_t seek(ptrdiff_t offset, Origin whence=kOriginBegin)=0
Sets the stream position indicator for the stream.
static const uint32 kVersion1
const ResourceList & getResources() const
Return a list of all containing resources.
IResourceList _iResources
Internal list of resource offsets and sizes.
Implementing the reading stream interfaces for plain memory blocks.
Common::UString name
The resource's name.
uint32 size
The resource's size.
static const uint32 kBIFID
static const uint32 kVersion11
Class to hold resource index information of a KEY file.
Utility templates and functions for working with strings and streams.
Exception that provides a stack of explanations.
static void readHeader(Common::ReadStream &stream, uint32 &id, uint32 &version, bool &utf16le)
Read the header out of a stream.
Handling BioWare's KEYs (resource index files).
Basic exceptions to throw.
Handling BioWare's BIFs (resource data files).
Utility templates and functions.
void readVarResTable(Common::SeekableReadStream &bif, uint32 offset)
void mergeKEY(const KEYFile &key, uint32 dataFileIndex)
Merge information from the KEY into the data file.
std::list< Resource > ResourceList
virtual size_t skip(ptrdiff_t offset)
Skip the specified number of bytes, adding that offset to the current position in the stream...
uint32 _id
The file's ID.
A resource within the archive.
uint32 _version
The file's version.
Internal resource information.
void warning(const char *s,...)
const IResource & getIResource(uint32 index) const
uint32 offset
The offset of the resource within the BIF.
const ResourceList & getResources() const
Return the list of resources.
PointerType get() const
Returns the plain pointer value.
BIFFile(Common::SeekableReadStream *bif)
Take over this stream and read a BIF file out of it.
ResourceList _resources
External list of resource names and types.
UString debugTag(uint32 tag, bool trim)
Create an elaborate string from an integer tag, for debugging purposes.
Common::SeekableReadStream * getResource(uint32 index, bool tryNoCopy=false) const
Return a stream of the resource's contents.
FileType
Various file types used by the Aurora engine and found in archives.
SeekableSubReadStream provides access to a SeekableReadStream restricted to the range [begin...
uint32 getResourceSize(uint32 index) const
Return the size of a resource.
Interface for a seekable & readable data stream.
Common::ScopedPtr< Common::SeekableReadStream > _bif
std::vector< Resource > ResourceList