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

Class to hold resource data of an HERF archive file. More...

#include <herffile.h>

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

Classes

struct  IResource
 Internal resource information. More...
 

Public Member Functions

 HERFFile (Common::SeekableReadStream *herf)
 Take over this stream and read an HERF file out of it. More...
 
 ~HERFFile ()
 
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...
 
Common::HashAlgo getNameHashAlgo () const
 Return with which algorithm the name is hashed. More...
 
- Public Member Functions inherited from Aurora::Archive
 Archive ()
 
virtual ~Archive ()
 
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 &herf)
 
void searchDictionary (Common::SeekableReadStream &herf, uint32 resCount)
 
void readDictionary (Common::SeekableReadStream &herf, std::map< uint32, Common::UString > &dict)
 
void readResList (Common::SeekableReadStream &herf)
 
void readNames ()
 
const IResourcegetIResource (uint32 index) const
 

Private Attributes

Common::ScopedPtr< Common::SeekableReadStream_herf
 
ResourceList _resources
 External list of resource names and types. More...
 
IResourceList _iResources
 Internal list of resource offsets and sizes. More...
 
uint32 _dictOffset
 The offset of the dict file (if available). More...
 
uint32 _dictSize
 The size of the dict file (if available). More...
 

Additional Inherited Members

- Public Types inherited from Aurora::Archive
typedef std::list< ResourceResourceList
 

Detailed Description

Class to hold resource data of an HERF archive file.

A HERF file is a very simplified version of a ERF file, similar to a RIM file. But unlike a RIM file, a HERF file only stores djb2 hashes of the included resource names. A dictionary, which matches hashes back to names might be present, but doesn't have to.

HERF files are only used in the Nintendo DS game Sonic Chronicles.

Definition at line 53 of file herffile.h.

Member Typedef Documentation

◆ IResourceList

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

Definition at line 78 of file herffile.h.

Constructor & Destructor Documentation

◆ HERFFile()

Aurora::HERFFile::HERFFile ( Common::SeekableReadStream herf)

Take over this stream and read an HERF file out of it.

Definition at line 39 of file herffile.cpp.

References _herf, and load().

Here is the call graph for this function:

◆ ~HERFFile()

Aurora::HERFFile::~HERFFile ( )

Definition at line 45 of file herffile.cpp.

Member Function Documentation

◆ getIResource()

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

Definition at line 148 of file herffile.cpp.

References _iResources.

Referenced by getResource(), and getResourceSize().

Here is the caller graph for this function:

◆ getNameHashAlgo()

Common::HashAlgo Aurora::HERFFile::getNameHashAlgo ( ) const
virtual

Return with which algorithm the name is hashed.

Reimplemented from Aurora::Archive.

Definition at line 170 of file herffile.cpp.

References Common::kHashDJB2.

◆ getResource()

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

Return a stream of the resource's contents.

Implements Aurora::Archive.

Definition at line 159 of file herffile.cpp.

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

Here is the call graph for this function:

◆ getResources()

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

Return the list of resources.

Implements Aurora::Archive.

Definition at line 144 of file herffile.cpp.

References _resources.

◆ getResourceSize()

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

Return the size of a resource.

Reimplemented from Aurora::Archive.

Definition at line 155 of file herffile.cpp.

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

Here is the call graph for this function:

◆ load()

void Aurora::HERFFile::load ( Common::SeekableReadStream herf)
private

Definition at line 48 of file herffile.cpp.

References _iResources, _resources, Common::StackException::add(), readResList(), Common::ReadStream::readUint32LE(), and searchDictionary().

Referenced by HERFFile().

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

◆ readDictionary()

void Aurora::HERFFile::readDictionary ( Common::SeekableReadStream herf,
std::map< uint32, Common::UString > &  dict 
)
private

Definition at line 88 of file herffile.cpp.

References _dictOffset, _dictSize, Common::kEncodingASCII, Common::SeekableReadStream::pos(), Common::readStringFixed(), Common::ReadStream::readUint32LE(), Common::SeekableReadStream::seek(), and Common::UString::toLower().

Referenced by readResList().

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

◆ readNames()

void Aurora::HERFFile::readNames ( )
private

◆ readResList()

void Aurora::HERFFile::readResList ( Common::SeekableReadStream herf)
private

Definition at line 113 of file herffile.cpp.

References _dictOffset, _dictSize, _iResources, _resources, Common::FilePath::getStem(), Aurora::kFileTypeDICT, readDictionary(), Common::ReadStream::readUint32LE(), Common::SeekableReadStream::size(), and TypeMan.

Referenced by load().

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

◆ searchDictionary()

void Aurora::HERFFile::searchDictionary ( Common::SeekableReadStream herf,
uint32  resCount 
)
private

Definition at line 69 of file herffile.cpp.

References _dictOffset, _dictSize, Common::hashStringDJB2(), Common::SeekableReadStream::pos(), 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

◆ _dictOffset

uint32 Aurora::HERFFile::_dictOffset
private

The offset of the dict file (if available).

Definition at line 88 of file herffile.h.

Referenced by readDictionary(), readResList(), and searchDictionary().

◆ _dictSize

uint32 Aurora::HERFFile::_dictSize
private

The size of the dict file (if available).

Definition at line 89 of file herffile.h.

Referenced by readDictionary(), readResList(), and searchDictionary().

◆ _herf

Common::ScopedPtr<Common::SeekableReadStream> Aurora::HERFFile::_herf
private

Definition at line 80 of file herffile.h.

Referenced by getResource(), and HERFFile().

◆ _iResources

IResourceList Aurora::HERFFile::_iResources
private

Internal list of resource offsets and sizes.

Definition at line 86 of file herffile.h.

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

◆ _resources

ResourceList Aurora::HERFFile::_resources
private

External list of resource names and types.

Definition at line 83 of file herffile.h.

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


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