xoreos
0.0.5
|
Class to hold resource data of an OBB virtual filesystem. More...
#include <obbfile.h>
Classes | |
struct | IResource |
Internal resource information. More... | |
Public Member Functions | |
OBBFile (Common::SeekableReadStream *obb) | |
Take over this stream and read an OBB file out of it. More... | |
~OBBFile () | |
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... | |
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... | |
Private Types | |
typedef std::vector< IResource > | IResourceList |
Private Member Functions | |
void | load (Common::SeekableReadStream &obb) |
void | readResList (Common::SeekableReadStream &index) |
Common::SeekableReadStream * | getIndex (Common::SeekableReadStream &obb) |
const IResource & | getIResource (uint32 index) const |
Private Attributes | |
Common::ScopedPtr< Common::SeekableReadStream > | _obb |
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 |
Class to hold resource data of an OBB virtual filesystem.
Aspyr's Jade Empire port for Android comes with all data files wrapped into a virtual filesystem within two OBB files. All data and even the index are zlib compressed.
This class treats OBB files like an archive, allowing easy access to the files within.
TODO: Check if the OBB virtual filesystem is also used in Aspyr's ports of the Knights of the Old Republic games. Also, is it maybe also used for the iOS ports?
|
private |
Aurora::OBBFile::OBBFile | ( | Common::SeekableReadStream * | obb | ) |
Take over this stream and read an OBB file out of it.
Definition at line 39 of file obbfile.cpp.
Aurora::OBBFile::~OBBFile | ( | ) |
Definition at line 45 of file obbfile.cpp.
|
private |
Definition at line 106 of file obbfile.cpp.
References Common::decompressDeflateWithoutOutputSize(), Common::kWindowBitsMax, Common::searchBackwards(), Common::SeekableReadStream::size(), and SIZE_MAX.
Referenced by load().
|
private |
Definition at line 157 of file obbfile.cpp.
References _iResources.
Referenced by getResource(), and getResourceSize().
|
virtual |
Return a stream of the resource's contents.
Implements Aurora::Archive.
Definition at line 168 of file obbfile.cpp.
References _obb, Common::decompressDeflateChunk(), Common::ScopedPtrBase< T, Deallocator >::get(), getIResource(), Common::kWindowBitsMax, Aurora::OBBFile::IResource::offset, Common::ScopedPtrBase< T, Deallocator >::release(), and Aurora::OBBFile::IResource::uncompressedSize.
|
virtual |
Return the list of resources.
Implements Aurora::Archive.
Definition at line 153 of file obbfile.cpp.
References _resources.
Return the size of a resource.
Reimplemented from Aurora::Archive.
Definition at line 164 of file obbfile.cpp.
References getIResource(), and Aurora::OBBFile::IResource::uncompressedSize.
|
private |
Definition at line 48 of file obbfile.cpp.
References Common::StackException::add(), getIndex(), readResList(), and Common::ReadStream::readUint16BE().
Referenced by OBBFile().
|
private |
Definition at line 66 of file obbfile.cpp.
References _iResources, _resources, Aurora::OBBFile::IResource::compressedSize, Aurora::Archive::Resource::index, Common::kEncodingASCII, Aurora::kFileTypeNone, Aurora::Archive::Resource::name, Aurora::OBBFile::IResource::offset, Common::readStringFixed(), Common::ReadStream::readUint32LE(), Common::SeekableReadStream::skip(), Aurora::Archive::Resource::type, TypeMan, and Aurora::OBBFile::IResource::uncompressedSize.
Referenced by load().
|
private |
Internal list of resource offsets and sizes.
Definition at line 87 of file obbfile.h.
Referenced by getIResource(), and readResList().
|
private |
Definition at line 81 of file obbfile.h.
Referenced by getResource(), and OBBFile().
|
private |
External list of resource names and types.
Definition at line 84 of file obbfile.h.
Referenced by getResources(), and readResList().