xoreos
0.0.5
|
A resource manager holding information about and handling all request for all resources usable by the game. More...
#include <resman.h>
Classes | |
class | Change |
struct | ChangeSet |
A set of changes produced by a manager operation. More... | |
struct | KnownArchive |
struct | OpenedArchive |
struct | Resource |
A resource. More... | |
struct | ResourceChange |
A change produced by indexing archive resources. More... | |
struct | ResourceID |
Public Member Functions | |
ResourceManager () | |
~ResourceManager () | |
void | clear () |
Clear all resource information. More... | |
void | setRIMsAreERFs (bool rimsAreERFs) |
Are .rim/.rimp files actually ERF files? More... | |
void | setHasSmall (bool hasSmall) |
Do we have "small" files (compressed with Nintendo DS's LZSS algorithm)? More... | |
void | setHashAlgo (Common::HashAlgo algo) |
With which hash algorithm are/should the names be hashed? More... | |
void | setCursorRemap (const std::vector< Common::UString > &remap) |
Set the array used to map cursor ID to cursor names. More... | |
void | addTypeAlias (FileType alias, FileType realType) |
Add an alias for one file type to another. More... | |
void | registerDataBase (const Common::UString &path) |
Register a path to be the data base. More... | |
const Common::UString & | getDataBase () const |
Return the path of the currently registered base data directory or archive. More... | |
bool | hasArchive (const Common::UString &file) |
Does a specific archive exist? More... | |
void | indexArchive (const Common::UString &file, uint32 priority, Common::ChangeID *changeID=0) |
Add all the resources of an archive to the resource manager. More... | |
void | indexArchive (const Common::UString &file, uint32 priority, const std::vector< byte > &password, Common::ChangeID *changeID=0) |
Add all the resources of an archive to the resource manager. More... | |
bool | hasResourceDir (const Common::UString &dir) |
Does a specific directory, relative to the base directory, exist? More... | |
void | indexResourceFile (const Common::UString &file, uint32 priority, Common::ChangeID *changeID=0) |
Add a single file to the resource manager. More... | |
void | indexResourceDir (const Common::UString &dir, const char *glob, int depth, uint32 priority, Common::ChangeID *changeID=0) |
Add a directory's contents to the resource manager. More... | |
void | undo (Common::ChangeID &changeID) |
Undo the changes done in the specified change ID. More... | |
void | blacklist (const Common::UString &name, FileType type) |
Blacklist a specific resource. More... | |
void | declareResource (const Common::UString &name, FileType type) |
Declare the name of a specific resource. More... | |
void | declareResource (const Common::UString &name) |
Declare the name of a specific resource. More... | |
bool | hasResource (uint64 hash) const |
Does a specific resource exist? More... | |
bool | hasResource (const Common::UString &name, FileType type) const |
Does a specific resource exist? More... | |
bool | hasResource (const Common::UString &name, ResourceType type) const |
Does a specific resource exist? More... | |
bool | hasResource (const Common::UString &name) const |
Does a specific resource exist? More... | |
bool | hasResource (const Common::UString &name, const std::vector< FileType > &types) const |
Does a specific resource exist? More... | |
Common::UString | findResourceFile (const Common::UString &name, FileType type) const |
Find and return the absolute filesystem file behind a resource. More... | |
Common::UString | findResourceFile (const Common::UString &name, ResourceType type) const |
Find and return the absolute filesystem file behind a resource. More... | |
Common::UString | findResourceFile (const Common::UString &name) const |
Find and return the absolute filesystem file behind a resource. More... | |
Common::UString | findResourceFile (const Common::UString &name, const std::vector< FileType > &types) const |
Find and return the absolute filesystem file behind a resource. More... | |
Common::SeekableReadStream * | getResource (uint64 hash, FileType *type=0) const |
Return a resource. More... | |
Common::SeekableReadStream * | getResource (const Common::UString &name, FileType type) const |
Return a resource. More... | |
Common::SeekableReadStream * | getResource (const Common::UString &name) const |
Return a resource. More... | |
Common::SeekableReadStream * | getResource (const Common::UString &name, const std::vector< FileType > &types, FileType *foundType=0) const |
Return a resource. More... | |
Common::SeekableReadStream * | getResource (ResourceType resType, const Common::UString &name, FileType *foundType=0) const |
Return a resource of a specific type. More... | |
void | getAvailableResources (FileType type, std::list< ResourceID > &list) const |
Return a list of all available resources of the specified type. More... | |
void | getAvailableResources (const std::vector< FileType > &types, std::list< ResourceID > &list) const |
Return a list of all available resources of the specified type. More... | |
void | getAvailableResources (ResourceType type, std::list< ResourceID > &list) const |
Return a list of all available resources of the specified type. More... | |
void | dumpResourcesList (const Common::UString &fileName) const |
Dump a list of all resources into a file. More... | |
Private Types | |
enum | Source { kSourceNone, kSourceFile, kSourceArchive } |
Where a resource can be found. More... | |
typedef std::vector< FileType > | FileTypeList |
typedef std::set< FileType > | FileTypeSet |
typedef std::list< KnownArchive > | KnownArchives |
List of all known archive files. More... | |
typedef std::list< OpenedArchive > | OpenedArchives |
List of all opened archive files. More... | |
typedef std::list< Resource > | ResourceList |
List of resources, sorted by priority. More... | |
typedef std::map< uint64, ResourceList > | ResourceMap |
Map over resources, indexed by their hashed name. More... | |
typedef std::pair< KnownArchives *, KnownArchives::iterator > | KnownArchiveChange |
A change produced by adding an archive. More... | |
typedef OpenedArchives::iterator | OpenedArchiveChange |
A change produced by indexing/opening an archive. More... | |
typedef std::list< KnownArchiveChange > | KnownArchiveChanges |
typedef std::list< OpenedArchiveChange > | OpenedArchiveChanges |
typedef std::list< ResourceChange > | ResourceChanges |
typedef std::list< ChangeSet > | ChangeSetList |
Private Attributes | |
bool | _hasSmall |
Do we have "small" files? More... | |
Common::HashAlgo | _hashAlgo |
With which hash algorithm are/should the names be hashed? More... | |
std::vector< Common::UString > | _cursorRemap |
Cursor ID -> cursor name. More... | |
Common::UString | _baseDir |
The data base directory (if any), the directory the current game is in. More... | |
Common::UString | _baseArchive |
The data base archive (if any), the archive the current game is in. More... | |
KnownArchives | _knownArchives [kArchiveMAX] |
List of all known archives. More... | |
OpenedArchives | _openedArchives |
List of currently used archives. More... | |
std::map< FileType, FileType > | _typeAliases |
The current type aliases, changing one type to another. More... | |
ResourceMap | _resources |
All currently known resources. More... | |
ChangeSetList | _changes |
Changes produced by indexing the currently known resources. More... | |
FileTypeSet | _archiveTypeTypes [kArchiveMAX] |
All valid archive types file types. More... | |
FileTypeList | _resourceTypeTypes [kResourceMAX] |
All valid resource type file types. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Common::Singleton< ResourceManager > | |
static ResourceManager & | instance () |
static void | destroy () |
Protected Types inherited from Common::Singleton< ResourceManager > | |
typedef ResourceManager | SingletonBaseType |
Protected Member Functions inherited from Common::Singleton< ResourceManager > | |
Singleton () | |
virtual | ~Singleton () |
A resource manager holding information about and handling all request for all resources usable by the game.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Aurora::ResourceManager::ResourceManager | ( | ) |
Definition at line 109 of file resman.cpp.
References _archiveTypeTypes, _resourceTypeTypes, Aurora::kArchiveBIF, Aurora::kArchiveERF, Aurora::kArchiveEXE, Aurora::kArchiveHERF, Aurora::kArchiveKEY, Aurora::kArchiveNDS, Aurora::kArchiveNSBTX, Aurora::kArchiveRIM, Aurora::kArchiveZIP, Aurora::kFileTypeBIF, Aurora::kFileTypeBIK, Aurora::kFileTypeBMP, Aurora::kFileTypeBMU, Aurora::kFileTypeBZF, Aurora::kFileTypeCRF, Aurora::kFileTypeCUR, Aurora::kFileTypeCURS, Aurora::kFileTypeDDS, Aurora::kFileTypeERF, Aurora::kFileTypeEXE, Aurora::kFileTypeHAK, Aurora::kFileTypeHERF, Aurora::kFileTypeJPG, Aurora::kFileTypeKEY, Aurora::kFileTypeMOD, Aurora::kFileTypeMOV, Aurora::kFileTypeMPG, Aurora::kFileTypeNDS, Aurora::kFileTypeNSBTX, Aurora::kFileTypeNWM, Aurora::kFileTypeOGG, Aurora::kFileTypePLT, Aurora::kFileTypePNG, Aurora::kFileTypeRIM, Aurora::kFileTypeRIMP, Aurora::kFileTypeSBM, Aurora::kFileTypeTGA, Aurora::kFileTypeTPC, Aurora::kFileTypeTXB, Aurora::kFileTypeVX, Aurora::kFileTypeWAV, Aurora::kFileTypeWMA, Aurora::kFileTypeWMV, Aurora::kFileTypeXEOSITEX, Aurora::kFileTypeXMV, Aurora::kFileTypeZIP, Aurora::kResourceCursor, Aurora::kResourceImage, Aurora::kResourceMusic, Aurora::kResourceSound, and Aurora::kResourceVideo.
Aurora::ResourceManager::~ResourceManager | ( | ) |
Definition at line 173 of file resman.cpp.
References clearResources().
|
private |
Definition at line 953 of file resman.cpp.
References Aurora::ResourceManager::Change::_change, _resources, checkHashCollision(), and checkResourceIsArchive().
Referenced by addResource(), addResources(), indexArchive(), and indexResourceFile().
|
private |
Definition at line 986 of file resman.cpp.
References _hasSmall, addResource(), getHash(), Common::FilePath::getStem(), Aurora::ResourceManager::Resource::isSmall, Aurora::kFileTypeSMALL, kSourceFile, Aurora::ResourceManager::Resource::name, normalizeType(), Aurora::ResourceManager::Resource::path, Aurora::ResourceManager::Resource::priority, Aurora::ResourceManager::Resource::source, Aurora::ResourceManager::Resource::type, and TypeMan.
|
private |
Definition at line 1011 of file resman.cpp.
References addResource(), Common::FileList::begin(), and Common::FileList::end().
Referenced by indexResourceDir().
Add an alias for one file type to another.
alias | The type to alias. |
realType | The actual type a resource of the alias type is. |
Definition at line 608 of file resman.cpp.
References _typeAliases.
void Aurora::ResourceManager::blacklist | ( | const Common::UString & | name, |
FileType | type | ||
) |
Blacklist a specific resource.
That resource will never be returned when asked for. The ResourceManager will act like it just doesn't exist. Useful in cases where some resources of different FileTypes in a ResourceType are broken and should not be preferred over the working ones.
Definition at line 612 of file resman.cpp.
References _resources, and getHash().
|
private |
Definition at line 903 of file resman.cpp.
References Common::UString::c_str(), Common::UString::empty(), Common::formatHash(), getHash(), Aurora::ResourceManager::Resource::name, Aurora::ResourceManager::Resource::type, TypeMan, and warning().
Referenced by addResource().
|
private |
Definition at line 922 of file resman.cpp.
References Aurora::ResourceManager::Change::_change, _knownArchives, Common::UString::c_str(), Common::UString::empty(), getArchiveName(), getArchiveType(), Aurora::kArchiveMAX, kSourceNone, Aurora::ResourceManager::Resource::name, Aurora::ResourceManager::Resource::selfArchive, Aurora::ResourceManager::Resource::source, and Aurora::ResourceManager::Resource::type.
Referenced by addResource(), and declareResource().
void Aurora::ResourceManager::clear | ( | ) |
Clear all resource information.
Definition at line 177 of file resman.cpp.
References _hashAlgo, _hasSmall, _typeAliases, clearResources(), Common::kHashFNV64, and setRIMsAreERFs().
Referenced by clearResources().
|
private |
Definition at line 187 of file resman.cpp.
References _baseArchive, _baseDir, _changes, _cursorRemap, _knownArchives, _openedArchives, _resources, clear(), Common::UString::clear(), and Aurora::kArchiveMAX.
Referenced by clear(), registerDataBase(), and ~ResourceManager().
void Aurora::ResourceManager::declareResource | ( | const Common::UString & | name, |
FileType | type | ||
) |
Declare the name of a specific resource.
Useful for declaring the name and type of hashed resources.
name | The name (ResRef) of the resource. |
type | The resource's type. |
Definition at line 621 of file resman.cpp.
References _hasSmall, _resources, checkResourceIsArchive(), getHash(), Aurora::kFileTypeSMALL, and TypeMan.
Referenced by declareResource().
void Aurora::ResourceManager::declareResource | ( | const Common::UString & | name | ) |
Declare the name of a specific resource.
Useful for declaring the name and type of hashed resources.
name | The name (with extension) of the resource. |
Definition at line 646 of file resman.cpp.
References declareResource(), Aurora::kFileTypeNone, and TypeMan.
void Aurora::ResourceManager::dumpResourcesList | ( | const Common::UString & | fileName | ) | const |
Dump a list of all resources into a file.
Definition at line 1052 of file resman.cpp.
References _resources, Common::UString::c_str(), Common::WriteFile::close(), Common::WriteFile::flush(), Common::UString::format(), Common::formatHash(), getResourceSize(), Common::kOpenError, Aurora::ResourceManager::Resource::name, Common::WriteFile::open(), Aurora::ResourceManager::Resource::type, TypeMan, and Common::WriteStream::writeString().
|
private |
Definition at line 267 of file resman.cpp.
References _knownArchives, getArchiveType(), and Aurora::kArchiveMAX.
Referenced by hasArchive(), indexArchive(), and openKEYBIFs().
|
private |
Definition at line 275 of file resman.cpp.
References Common::FilePath::changeExtension(), Common::UString::equalsIgnoreCase(), Common::FilePath::getExtension(), Common::FilePath::isAbsolute(), Common::FilePath::normalize(), and Common::UString::toLower().
Common::UString Aurora::ResourceManager::findResourceFile | ( | const Common::UString & | name, |
FileType | type | ||
) | const |
Find and return the absolute filesystem file behind a resource.
If this resources does not exist, or the resource is not a direct file (because it's found within an archive), an empty string will be returned.
name | The name (ResRef) of the resource. |
type | The resource's type. |
Definition at line 676 of file resman.cpp.
Referenced by findResourceFile().
Common::UString Aurora::ResourceManager::findResourceFile | ( | const Common::UString & | name, |
ResourceType | type | ||
) | const |
Find and return the absolute filesystem file behind a resource.
If this resources does not exist, or the resource is not a direct file (because it's found within an archive), an empty string will be returned.
name | The name (ResRef) of the resource. |
type | The resource's type. |
Definition at line 684 of file resman.cpp.
References _resourceTypeTypes, findResourceFile(), and Aurora::kResourceMAX.
Common::UString Aurora::ResourceManager::findResourceFile | ( | const Common::UString & | name | ) | const |
Find and return the absolute filesystem file behind a resource.
If this resources does not exist, or the resource is not a direct file (because it's found within an archive), an empty string will be returned.
name | The name (with extension) of the resource. |
Definition at line 690 of file resman.cpp.
References findResourceFile(), Aurora::kFileTypeNone, and TypeMan.
Common::UString Aurora::ResourceManager::findResourceFile | ( | const Common::UString & | name, |
const std::vector< FileType > & | types | ||
) | const |
Find and return the absolute filesystem file behind a resource.
If this resources does not exist, or the resource is not a direct file (because it's found within an archive), an empty string will be returned.
name | The name (ResRef) of the resource. |
types | The resource's types. |
Definition at line 694 of file resman.cpp.
References getRes(), kSourceFile, Aurora::ResourceManager::Resource::path, and Aurora::ResourceManager::Resource::source.
|
private |
Definition at line 849 of file resman.cpp.
References kSourceArchive, kSourceFile, Aurora::ResourceManager::Resource::name, Aurora::ResourceManager::Resource::path, Aurora::ResourceManager::Resource::source, Aurora::ResourceManager::Resource::type, and TypeMan.
Referenced by checkResourceIsArchive().
|
private |
Definition at line 717 of file resman.cpp.
References Aurora::ResourceManager::OpenedArchive::archive, Aurora::ResourceManager::Resource::archive, Aurora::ResourceManager::Resource::archiveIndex, and Aurora::Archive::getResource().
Referenced by getResource().
|
private |
Definition at line 837 of file resman.cpp.
References _archiveTypeTypes, and Aurora::kArchiveMAX.
Referenced by checkResourceIsArchive(), findArchive(), and getArchiveType().
|
private |
Definition at line 845 of file resman.cpp.
References getArchiveType(), and TypeMan.
void Aurora::ResourceManager::getAvailableResources | ( | FileType | type, |
std::list< ResourceID > & | list | ||
) | const |
Return a list of all available resources of the specified type.
Definition at line 800 of file resman.cpp.
References _resources.
Referenced by getAvailableResources().
void Aurora::ResourceManager::getAvailableResources | ( | const std::vector< FileType > & | types, |
std::list< ResourceID > & | list | ||
) | const |
Return a list of all available resources of the specified type.
Definition at line 814 of file resman.cpp.
References _resources.
void Aurora::ResourceManager::getAvailableResources | ( | ResourceType | type, |
std::list< ResourceID > & | list | ||
) | const |
Return a list of all available resources of the specified type.
Definition at line 831 of file resman.cpp.
References _resourceTypeTypes, and getAvailableResources().
const Common::UString & Aurora::ResourceManager::getDataBase | ( | ) | const |
Return the path of the currently registered base data directory or archive.
Definition at line 260 of file resman.cpp.
References _baseArchive, _baseDir, and Common::UString::empty().
|
inlineprivate |
Definition at line 895 of file resman.cpp.
References TypeMan.
Referenced by addResource(), blacklist(), checkHashCollision(), declareResource(), getRes(), and indexArchive().
|
inlineprivate |
Definition at line 899 of file resman.cpp.
References _hashAlgo, Common::hashString(), and Common::UString::toLower().
|
private |
Definition at line 1016 of file resman.cpp.
References _resources.
Referenced by findResourceFile(), getRes(), getResource(), and hasResource().
|
private |
Definition at line 1024 of file resman.cpp.
References _hasSmall, getHash(), getRes(), Aurora::kFileTypeSMALL, and TypeMan.
|
private |
Definition at line 1046 of file resman.cpp.
References getRes().
Common::SeekableReadStream * Aurora::ResourceManager::getResource | ( | uint64 | hash, |
FileType * | type = 0 |
||
) | const |
Return a resource.
hash | The hash of the name and extension of the resource. |
type | If != 0, that's where the type of the resource is stored. |
Definition at line 750 of file resman.cpp.
References getRes(), and Aurora::ResourceManager::Resource::type.
Referenced by getResource(), and openArchiveStream().
Common::SeekableReadStream * Aurora::ResourceManager::getResource | ( | const Common::UString & | name, |
FileType | type | ||
) | const |
Return a resource.
name | The name (ResRef) of the resource. |
type | The resource's type. |
Definition at line 724 of file resman.cpp.
References getResource().
Common::SeekableReadStream * Aurora::ResourceManager::getResource | ( | const Common::UString & | name | ) | const |
Return a resource.
name | The name (with extension) of the resource. |
Definition at line 732 of file resman.cpp.
References getResource(), Aurora::kFileTypeNone, and TypeMan.
Common::SeekableReadStream * Aurora::ResourceManager::getResource | ( | const Common::UString & | name, |
const std::vector< FileType > & | types, | ||
FileType * | foundType = 0 |
||
) | const |
Return a resource.
This only returns one stream, even if more than one of the specified file types exist for the given name.
name | The name (ResRef) of the resource. |
types | A list of file types to look for. |
foundType | If != 0, that's where the actually found type is stored. |
Definition at line 736 of file resman.cpp.
References getRes(), getResource(), and Aurora::ResourceManager::Resource::type.
Common::SeekableReadStream * Aurora::ResourceManager::getResource | ( | ResourceType | resType, |
const Common::UString & | name, | ||
FileType * | foundType = 0 |
||
) | const |
Return a resource of a specific type.
resType | The type of the resource. |
name | The name (ResRef or path) of the resource. |
foundType | If != 0, that's where the actually found type is stored. |
Definition at line 786 of file resman.cpp.
References _resourceTypeTypes, getResource(), and Aurora::kResourceMAX.
|
private |
Definition at line 762 of file resman.cpp.
References Aurora::Small::decompress(), getArchiveResource(), Aurora::ResourceManager::Resource::isSmall, kSourceArchive, kSourceFile, Aurora::ResourceManager::Resource::name, Aurora::ResourceManager::Resource::path, Aurora::ResourceManager::Resource::source, Aurora::ResourceManager::Resource::type, and TypeMan.
Definition at line 703 of file resman.cpp.
References Aurora::ResourceManager::OpenedArchive::archive, Aurora::ResourceManager::Resource::archive, Aurora::ResourceManager::Resource::archiveIndex, Common::FilePath::getFileSize(), Aurora::Archive::getResourceSize(), kSourceArchive, kSourceFile, Aurora::ResourceManager::Resource::path, and Aurora::ResourceManager::Resource::source.
Referenced by dumpResourcesList().
bool Aurora::ResourceManager::hasArchive | ( | const Common::UString & | file | ) |
Does a specific archive exist?
file | The name of the archive file. |
Definition at line 292 of file resman.cpp.
References findArchive().
bool Aurora::ResourceManager::hasResource | ( | uint64 | hash | ) | const |
Does a specific resource exist?
hash | The hash of the name and extension of the resource. |
Definition at line 672 of file resman.cpp.
References getRes().
Referenced by hasResource().
bool Aurora::ResourceManager::hasResource | ( | const Common::UString & | name, |
FileType | type | ||
) | const |
Does a specific resource exist?
name | The name (ResRef) of the resource. |
type | The resource's type. |
Definition at line 650 of file resman.cpp.
References hasResource().
bool Aurora::ResourceManager::hasResource | ( | const Common::UString & | name, |
ResourceType | type | ||
) | const |
Does a specific resource exist?
name | The name (ResRef) of the resource. |
type | The resource's type. |
Definition at line 658 of file resman.cpp.
References _resourceTypeTypes, hasResource(), and Aurora::kResourceMAX.
bool Aurora::ResourceManager::hasResource | ( | const Common::UString & | name | ) | const |
Does a specific resource exist?
name | The name (with extension) of the resource. |
Definition at line 664 of file resman.cpp.
References hasResource(), Aurora::kFileTypeNone, and TypeMan.
bool Aurora::ResourceManager::hasResource | ( | const Common::UString & | name, |
const std::vector< FileType > & | types | ||
) | const |
Does a specific resource exist?
name | The name (ResRef) of the resource. |
types | The resource's types. |
Definition at line 668 of file resman.cpp.
References getRes().
bool Aurora::ResourceManager::hasResourceDir | ( | const Common::UString & | dir | ) |
Does a specific directory, relative to the base directory, exist?
dir | A subdirectory of the base directory to look for. |
Definition at line 473 of file resman.cpp.
References _baseDir, Common::UString::empty(), and Common::FilePath::findSubDirectory().
void Aurora::ResourceManager::indexArchive | ( | const Common::UString & | file, |
uint32 | priority, | ||
Common::ChangeID * | changeID = 0 |
||
) |
Add all the resources of an archive to the resource manager.
file | The name of the archive file to index. |
priority | The priority these files have over others of the same name and type. Higher number = higher priority. 0 means blacklisted. |
changeID | If given, record the collective changes done here. |
Definition at line 361 of file resman.cpp.
Referenced by indexArchive(), indexKEY(), and registerDataBase().
void Aurora::ResourceManager::indexArchive | ( | const Common::UString & | file, |
uint32 | priority, | ||
const std::vector< byte > & | password, | ||
Common::ChangeID * | changeID = 0 |
||
) |
Add all the resources of an archive to the resource manager.
file | The name of the archive file to index. |
priority | The priority these files have over others of the same name and type. Higher number = higher priority. 0 means blacklisted. |
password | Use this password to decrypt the archive file, if necessary. |
changeID | If given, record the collective changes done here. |
Definition at line 303 of file resman.cpp.
References _cursorRemap, Common::UString::c_str(), findArchive(), indexArchive(), indexKEY(), Aurora::kArchiveBIF, Aurora::kArchiveERF, Aurora::kArchiveEXE, Aurora::kArchiveHERF, Aurora::kArchiveKEY, Aurora::kArchiveNDS, Aurora::kArchiveNSBTX, Aurora::kArchiveRIM, Aurora::kArchiveZIP, newChangeSet(), openArchiveStream(), Common::ScopedPtrBase< T, Deallocator >::release(), Common::ScopedPtrBase< T, Deallocator >::reset(), and Aurora::ResourceManager::KnownArchive::type.
|
private |
Definition at line 416 of file resman.cpp.
References Aurora::ResourceManager::Change::_change, _hashAlgo, _hasSmall, _openedArchives, addResource(), Aurora::ResourceManager::Resource::archive, Aurora::ResourceManager::Resource::archiveIndex, getHash(), Aurora::Archive::getNameHashAlgo(), Aurora::Archive::getResources(), Common::FilePath::getStem(), Aurora::ResourceManager::Resource::isSmall, Aurora::kFileTypeNone, Aurora::kFileTypeSMALL, Common::kHashNone, kSourceArchive, Aurora::ResourceManager::Resource::name, normalizeType(), Aurora::ResourceManager::Resource::priority, Aurora::ResourceManager::Resource::source, Aurora::ResourceManager::Resource::type, and TypeMan.
|
private |
Definition at line 406 of file resman.cpp.
References indexArchive(), and openKEYBIFs().
Referenced by indexArchive().
void Aurora::ResourceManager::indexResourceDir | ( | const Common::UString & | dir, |
const char * | glob, | ||
int | depth, | ||
uint32 | priority, | ||
Common::ChangeID * | changeID = 0 |
||
) |
Add a directory's contents to the resource manager.
Relative to the base directory.
dir | A subdirectory of the base directory to search for resource files. |
glob | A pattern of which files to look for. |
depth | The number of levels to recurse into subdirectories. 0 for ignoring subdirectories, -1 for a limitless recursion. |
priority | The priority these files have over others of the same name and type. Higher number = higher priority. 0 means blacklisted. |
changeID | If given, record the collective changes done here. |
Definition at line 497 of file resman.cpp.
References _baseDir, Common::FileList::addDirectory(), addResources(), Common::UString::c_str(), Common::UString::empty(), Common::FilePath::findSubDirectory(), Common::FileList::getSubListGlob(), and newChangeSet().
Referenced by registerDataBase().
void Aurora::ResourceManager::indexResourceFile | ( | const Common::UString & | file, |
uint32 | priority, | ||
Common::ChangeID * | changeID = 0 |
||
) |
Add a single file to the resource manager.
Relative to the base directory.
file | The file to add. |
priority | The priority these files have over others of the same name and type. Higher number = higher priority. 0 means blacklisted. |
changeID | If given, record the collective changes done here. |
Definition at line 480 of file resman.cpp.
References _baseDir, addResource(), Common::UString::c_str(), Common::UString::empty(), Common::FilePath::isRegularFile(), newChangeSet(), and Common::FilePath::normalize().
Referenced by registerDataBase().
|
private |
Definition at line 1083 of file resman.cpp.
References Aurora::ResourceManager::Change::_change, _changes, Common::ChangeID::getContent(), and Common::ChangeID::setContent().
Referenced by indexArchive(), indexResourceDir(), and indexResourceFile().
|
private |
Definition at line 866 of file resman.cpp.
References _typeAliases, Aurora::kFileTypeJPG, Aurora::kFileTypeJPG2, Aurora::kFileTypeMDA, Aurora::kFileTypeMDA2, Aurora::kFileTypeMDB, Aurora::kFileTypeMDB2, Aurora::kFileTypeMDX, Aurora::kFileTypeMDX2, Aurora::kFileTypeQST, Aurora::kFileTypeQST2, Aurora::kFileTypeSPT, Aurora::kFileTypeSPT2, Aurora::kFileTypeTXB, Aurora::kFileTypeTXB2, and Aurora::ResourceManager::Resource::type.
Referenced by addResource(), and indexArchive().
|
private |
Definition at line 296 of file resman.cpp.
References getResource(), and Aurora::ResourceManager::KnownArchive::resource.
Referenced by indexArchive(), and openKEYBIFs().
|
private |
Definition at line 367 of file resman.cpp.
References _knownArchives, findArchive(), Aurora::KEYFile::getBIFs(), Common::FilePath::getExtension(), Aurora::kArchiveBIF, and openArchiveStream().
Referenced by indexKEY().
void Aurora::ResourceManager::registerDataBase | ( | const Common::UString & | path | ) |
Register a path to be the data base.
If this is a directory, it will be indexed, non-recursively. If this is a file, it will be indexed as an archive.
The priority of files within the data base is always 1, the lowest priority.
All further games files and archives are assumed to be inside this directory or archive.
path | The path to a base data directory or archive. |
Definition at line 237 of file resman.cpp.
References _baseArchive, _baseDir, Common::UString::c_str(), Common::FilePath::canonicalize(), clearResources(), indexArchive(), indexResourceDir(), indexResourceFile(), Common::FilePath::isDirectory(), and Common::FilePath::isRegularFile().
void Aurora::ResourceManager::setCursorRemap | ( | const std::vector< Common::UString > & | remap | ) |
Set the array used to map cursor ID to cursor names.
Definition at line 233 of file resman.cpp.
References _cursorRemap.
void Aurora::ResourceManager::setHashAlgo | ( | Common::HashAlgo | algo | ) |
With which hash algorithm are/should the names be hashed?
Definition at line 226 of file resman.cpp.
References _hashAlgo, and _resources.
void Aurora::ResourceManager::setHasSmall | ( | bool | hasSmall | ) |
Do we have "small" files (compressed with Nintendo DS's LZSS algorithm)?
Definition at line 222 of file resman.cpp.
References _hasSmall.
void Aurora::ResourceManager::setRIMsAreERFs | ( | bool | rimsAreERFs | ) |
Are .rim/.rimp files actually ERF files?
Definition at line 205 of file resman.cpp.
References _archiveTypeTypes, Aurora::kArchiveERF, Aurora::kArchiveRIM, Aurora::kFileTypeRIM, and Aurora::kFileTypeRIMP.
Referenced by clear().
void Aurora::ResourceManager::undo | ( | Common::ChangeID & | changeID | ) |
Undo the changes done in the specified change ID.
Definition at line 529 of file resman.cpp.
References Aurora::ResourceManager::Change::_change, _changes, _openedArchives, _resources, Common::ChangeID::clear(), and Common::ChangeID::getContent().
|
private |
All valid archive types file types.
Definition at line 493 of file resman.h.
Referenced by getArchiveType(), ResourceManager(), and setRIMsAreERFs().
|
private |
The data base archive (if any), the archive the current game is in.
Definition at line 482 of file resman.h.
Referenced by clearResources(), getDataBase(), and registerDataBase().
|
private |
The data base directory (if any), the directory the current game is in.
Definition at line 480 of file resman.h.
Referenced by clearResources(), getDataBase(), hasResourceDir(), indexResourceDir(), indexResourceFile(), and registerDataBase().
|
private |
Changes produced by indexing the currently known resources.
Definition at line 491 of file resman.h.
Referenced by clearResources(), newChangeSet(), and undo().
|
private |
Cursor ID -> cursor name.
Definition at line 477 of file resman.h.
Referenced by clearResources(), indexArchive(), and setCursorRemap().
|
private |
With which hash algorithm are/should the names be hashed?
Definition at line 474 of file resman.h.
Referenced by clear(), getHash(), indexArchive(), and setHashAlgo().
|
private |
Do we have "small" files?
Definition at line 471 of file resman.h.
Referenced by addResource(), clear(), declareResource(), getRes(), indexArchive(), and setHasSmall().
|
private |
List of all known archives.
Definition at line 484 of file resman.h.
Referenced by checkResourceIsArchive(), clearResources(), findArchive(), and openKEYBIFs().
|
private |
List of currently used archives.
Definition at line 485 of file resman.h.
Referenced by clearResources(), indexArchive(), and undo().
|
private |
All currently known resources.
Definition at line 490 of file resman.h.
Referenced by addResource(), blacklist(), clearResources(), declareResource(), dumpResourcesList(), getAvailableResources(), getRes(), setHashAlgo(), and undo().
|
private |
All valid resource type file types.
Definition at line 494 of file resman.h.
Referenced by findResourceFile(), getAvailableResources(), getResource(), hasResource(), and ResourceManager().
The current type aliases, changing one type to another.
Definition at line 488 of file resman.h.
Referenced by addTypeAlias(), clear(), and normalizeType().