77 e.
add(
"Failed reading BZF file");
104 for (KEYFile::ResourceList::const_iterator keyRes = keyResList.begin(); keyRes != keyResList.end(); ++keyRes) {
105 if (keyRes->bifIndex != dataFileIndex)
109 warning(
"Resource index out of range (%d/%d)", keyRes->resIndex, (
int)
_iResources.size());
113 if (keyRes->type !=
_iResources[keyRes->resIndex].type)
114 warning(
"KEY and BZF disagree on the type of the resource \"%s\" (%d, %d). Trusting the BZF",
115 keyRes->name.c_str(), keyRes->type,
_iResources[keyRes->resIndex].type);
119 res.
name = keyRes->name;
121 res.index = keyRes->resIndex;
#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...
Internal resource information.
const ResourceList & getResources() const
Return the list of resources.
virtual size_t seek(ptrdiff_t offset, Origin whence=kOriginBegin)=0
Sets the stream position indicator for the stream.
const ResourceList & getResources() const
Return a list of all containing resources.
static const uint32 kVersion1
Implementing the reading stream interfaces for plain memory blocks.
BZFFile(Common::SeekableReadStream *bzf)
Take over this stream and read a BZF file out of it.
Common::UString name
The resource's name.
Decompress LZMA, using liblzma.
Common::ScopedPtr< Common::SeekableReadStream > _bzf
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.
IResourceList _iResources
Internal list of resource offsets and sizes.
const IResource & getIResource(uint32 index) const
Handling BioWare's KEYs (resource index files).
ResourceList _resources
External list of resource names and types.
Basic exceptions to throw.
Utility templates and functions.
Handling BioWare's BZFs (resource data files), used in the iOS version of Knights of the Old Republic...
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 offset
The offset of the resource within the BZF.
uint32 _id
The file's ID.
A resource within the archive.
uint32 _version
The file's version.
void warning(const char *s,...)
virtual size_t size() const =0
Obtains the total size of the stream, measured in bytes.
byte * decompressLZMA1(const byte *data, size_t inputSize, size_t outputSize, bool noEndMarker)
Decompress using the LZMA1 algorithm.
uint32 size
The resource's size.
void readVarResTable(Common::SeekableReadStream &bzf, uint32 offset)
void mergeKEY(const KEYFile &key, uint32 dataFileIndex)
Merge information from the KEY into the data file.
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.
uint32 getResourceSize(uint32 index) const
Return the size of a resource.
FileType
Various file types used by the Aurora engine and found in archives.
static const uint32 kBZFID
uint32 packedSize
Raw, compressed data size.
Interface for a seekable & readable data stream.
std::vector< Resource > ResourceList
void load(Common::SeekableReadStream &bzf)