xoreos
0.0.5
|
Class to hold resource data of an HERF archive file. More...
#include <herffile.h>
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 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... | |
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< IResource > | IResourceList |
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 IResource & | getIResource (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< Resource > | ResourceList |
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.
|
private |
Definition at line 78 of file herffile.h.
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.
Aurora::HERFFile::~HERFFile | ( | ) |
Definition at line 45 of file herffile.cpp.
|
private |
Definition at line 148 of file herffile.cpp.
References _iResources.
Referenced by getResource(), and getResourceSize().
|
virtual |
Return with which algorithm the name is hashed.
Reimplemented from Aurora::Archive.
Definition at line 170 of file herffile.cpp.
References Common::kHashDJB2.
|
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.
|
virtual |
Return the list of resources.
Implements Aurora::Archive.
Definition at line 144 of file herffile.cpp.
References _resources.
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.
|
private |
Definition at line 48 of file herffile.cpp.
References _iResources, _resources, Common::StackException::add(), readResList(), Common::ReadStream::readUint32LE(), and searchDictionary().
Referenced by HERFFile().
|
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().
|
private |
|
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().
|
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().
|
private |
The offset of the dict file (if available).
Definition at line 88 of file herffile.h.
Referenced by readDictionary(), readResList(), and searchDictionary().
|
private |
The size of the dict file (if available).
Definition at line 89 of file herffile.h.
Referenced by readDictionary(), readResList(), and searchDictionary().
|
private |
Definition at line 80 of file herffile.h.
Referenced by getResource(), and HERFFile().
|
private |
Internal list of resource offsets and sizes.
Definition at line 86 of file herffile.h.
Referenced by getIResource(), load(), and readResList().
|
private |
External list of resource names and types.
Definition at line 83 of file herffile.h.
Referenced by getResources(), load(), and readResList().