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

Class to hold resource data of an OBB virtual filesystem. More...

#include <obbfile.h>

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

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 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...
 
- 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< IResourceIResourceList
 

Private Member Functions

void load (Common::SeekableReadStream &obb)
 
void readResList (Common::SeekableReadStream &index)
 
Common::SeekableReadStreamgetIndex (Common::SeekableReadStream &obb)
 
const IResourcegetIResource (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< ResourceResourceList
 

Detailed Description

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?

Definition at line 56 of file obbfile.h.

Member Typedef Documentation

◆ IResourceList

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

Definition at line 79 of file obbfile.h.

Constructor & Destructor Documentation

◆ OBBFile()

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.

References _obb, and load().

Here is the call graph for this function:

◆ ~OBBFile()

Aurora::OBBFile::~OBBFile ( )

Definition at line 45 of file obbfile.cpp.

Member Function Documentation

◆ getIndex()

Common::SeekableReadStream * Aurora::OBBFile::getIndex ( Common::SeekableReadStream obb)
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().

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

◆ getIResource()

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

Definition at line 157 of file obbfile.cpp.

References _iResources.

Referenced by getResource(), and getResourceSize().

Here is the caller graph for this function:

◆ getResource()

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

◆ getResources()

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

Return the list of resources.

Implements Aurora::Archive.

Definition at line 153 of file obbfile.cpp.

References _resources.

◆ getResourceSize()

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

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.

Here is the call graph for this function:

◆ load()

void Aurora::OBBFile::load ( Common::SeekableReadStream obb)
private

Definition at line 48 of file obbfile.cpp.

References Common::StackException::add(), getIndex(), readResList(), and Common::ReadStream::readUint16BE().

Referenced by OBBFile().

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

◆ readResList()

void Aurora::OBBFile::readResList ( Common::SeekableReadStream index)
private

Member Data Documentation

◆ _iResources

IResourceList Aurora::OBBFile::_iResources
private

Internal list of resource offsets and sizes.

Definition at line 87 of file obbfile.h.

Referenced by getIResource(), and readResList().

◆ _obb

Common::ScopedPtr<Common::SeekableReadStream> Aurora::OBBFile::_obb
private

Definition at line 81 of file obbfile.h.

Referenced by getResource(), and OBBFile().

◆ _resources

ResourceList Aurora::OBBFile::_resources
private

External list of resource names and types.

Definition at line 84 of file obbfile.h.

Referenced by getResources(), and readResList().


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