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

Class to hold resource data of a RIM archive file. More...

#include <rimfile.h>

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

Classes

struct  IResource
 Internal resource information. More...
 

Public Member Functions

 RIMFile (Common::SeekableReadStream *rim)
 Take over this stream and read a RIM file out of it. More...
 
 ~RIMFile ()
 
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...
 
- 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< IResourceIResourceList
 

Private Member Functions

void load (Common::SeekableReadStream &rim)
 
void readResList (Common::SeekableReadStream &rim, uint32 offset)
 
const IResourcegetIResource (uint32 index) const
 

Private Attributes

Common::ScopedPtr< Common::SeekableReadStream_rim
 
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
 
- 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...
 

Detailed Description

Class to hold resource data of a RIM archive file.

A RIM file is a resource archive, used in several Aurora games. It is a simplified version of the more complex ERF format, lacking the support for a localized description text as found in early ERF formats, as well as compression and encryption as found in later ERF formats.

There is only one single version, V1.0, of the RIM format known and supported. For each resource file, it stores a path- and extension-less name (with a maximum of 16 ASCII characters) and a Type ID.

RIM files are found in Knights of the Old Republic, Knights of the Old Republic II and Jade Empire. They always have the .rim extension.

Note: .rim files in the Dragon Age games are not real RIM files. Instead, they are ERF files. See class ERFFile in erffile.h.

Definition at line 61 of file rimfile.h.

Member Typedef Documentation

◆ IResourceList

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

Definition at line 83 of file rimfile.h.

Constructor & Destructor Documentation

◆ RIMFile()

Aurora::RIMFile::RIMFile ( Common::SeekableReadStream rim)

Take over this stream and read a RIM file out of it.

Definition at line 40 of file rimfile.cpp.

References _rim, and load().

Here is the call graph for this function:

◆ ~RIMFile()

Aurora::RIMFile::~RIMFile ( )

Definition at line 46 of file rimfile.cpp.

Member Function Documentation

◆ getIResource()

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

Definition at line 97 of file rimfile.cpp.

References _iResources.

Referenced by getResource(), and getResourceSize().

Here is the caller graph for this function:

◆ getResource()

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

Return a stream of the resource's contents.

Implements Aurora::Archive.

Definition at line 108 of file rimfile.cpp.

References _rim, Common::ScopedPtrBase< T, Deallocator >::get(), getIResource(), Aurora::RIMFile::IResource::offset, and Aurora::RIMFile::IResource::size.

Referenced by Engines::DragonAge::Area::getName(), and Engines::DragonAge2::Area::getName().

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

◆ getResources()

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

Return the list of resources.

Implements Aurora::Archive.

Definition at line 93 of file rimfile.cpp.

References _resources.

◆ getResourceSize()

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

Return the size of a resource.

Reimplemented from Aurora::Archive.

Definition at line 104 of file rimfile.cpp.

References getIResource(), and Aurora::RIMFile::IResource::size.

Here is the call graph for this function:

◆ load()

void Aurora::RIMFile::load ( Common::SeekableReadStream rim)
private

◆ readResList()

void Aurora::RIMFile::readResList ( Common::SeekableReadStream rim,
uint32  offset 
)
private

Definition at line 77 of file rimfile.cpp.

References _iResources, _resources, Common::kEncodingASCII, Common::readStringFixed(), Common::ReadStream::readUint16LE(), Common::ReadStream::readUint32LE(), Common::SeekableReadStream::seek(), and Common::SeekableReadStream::skip().

Referenced by load().

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

Member Data Documentation

◆ _iResources

IResourceList Aurora::RIMFile::_iResources
private

Internal list of resource offsets and sizes.

Definition at line 91 of file rimfile.h.

Referenced by getIResource(), load(), and readResList().

◆ _resources

ResourceList Aurora::RIMFile::_resources
private

External list of resource names and types.

Definition at line 88 of file rimfile.h.

Referenced by getResources(), load(), and readResList().

◆ _rim

Common::ScopedPtr<Common::SeekableReadStream> Aurora::RIMFile::_rim
private

Definition at line 85 of file rimfile.h.

Referenced by getResource(), and RIMFile().


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