25 #ifndef AURORA_RESMAN_H 26 #define AURORA_RESMAN_H 43 class SeekableReadStream;
318 const std::vector<FileType> &types,
FileType *foundType = 0)
const;
507 std::vector<KnownArchive *> &archives, std::vector<KEYDataFile *> &keyData);
557 #define ResMan ::Aurora::ResourceManager::instance() 559 #endif // AURORA_RESMAN_H
uint32 getResourceSize(const Resource &res) const
ChangeSetList::iterator _change
FileTypeList _resourceTypeTypes[kResourceMAX]
All valid resource type file types.
Class and macro for implementing singletons.
bool hasResourceDir(const Common::UString &dir)
Does a specific directory, relative to the base directory, exist?
void addResources(const Common::FileList &files, Change *change, uint32 priority)
Source source
Where can the resource be found?
std::list< OpenedArchive > OpenedArchives
List of all opened archive files.
ResourceMap::iterator hashIt
A class holding an UTF-8 string.
KnownArchiveChanges knownArchives
Source
Where a resource can be found.
void setHasSmall(bool hasSmall)
Do we have "small" files (compressed with Nintendo DS's LZSS algorithm)?
FileType type
The resource's type.
KnownArchive * known
The information we know about this archive.
Common::SeekableReadStream * openArchiveStream(const KnownArchive &archive) const
uint32 archiveIndex
Index into the archive.
const Resource * getRes(uint64 hash) const
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.
A set of changes produced by a manager operation.
std::pair< KnownArchives *, KnownArchives::iterator > KnownArchiveChange
A change produced by adding an archive.
std::list< ResourceChange > ResourceChanges
std::vector< Common::UString > _cursorRemap
Cursor ID -> cursor name.
A change produced by indexing archive resources.
std::set< FileType > FileTypeSet
KnownArchives _knownArchives[kArchiveMAX]
List of all known archives.
void clear()
Clear all resource information.
void dumpResourcesList(const Common::UString &fileName) const
Dump a list of all resources into a file.
std::list< Resource > ResourceList
List of resources, sorted by priority.
ChangeSetList _changes
Changes produced by indexing the currently known resources.
Archive * archive
The actual archive.
bool isSmall
Is this a "small" (compressed Nintendo DS) file?
void setCursorRemap(const std::vector< Common::UString > &remap)
Set the array used to map cursor ID to cursor names.
void indexKEY(Common::SeekableReadStream *stream, uint32 priority, Change *change)
bool normalizeType(Resource &resource)
Generic template base class for implementing the singleton design pattern.
OpenedArchive * parent
Is this archive is found in another archive, this is the "parent" archive.
Common::HashAlgo _hashAlgo
With which hash algorithm are/should the names be hashed?
void addResource(Resource &resource, uint64 hash, Change *change)
Helper class to represent an undoable change.
void registerDataBase(const Common::UString &path)
Register a path to be the data base.
std::list< OpenedArchive * > children
If this archive contains other archives, these are the opened "children" archives.
OpenedArchiveChanges openedArchives
FileTypeSet _archiveTypeTypes[kArchiveMAX]
All valid archive types file types.
void blacklist(const Common::UString &name, FileType type)
Blacklist a specific resource.
Common::UString findResourceFile(const Common::UString &name, FileType type) const
Find and return the absolute filesystem file behind a resource.
bool _hasSmall
Do we have "small" files?
std::map< FileType, FileType > _typeAliases
The current type aliases, changing one type to another.
bool hasResource(uint64 hash) const
Does a specific resource exist?
ArchiveType getArchiveType(FileType type) const
std::list< KnownArchiveChange > KnownArchiveChanges
HashAlgo
The algorithm used for hashing.
Low-level type definitions to handle fixed width types portably.
void indexArchive(const Common::UString &file, uint32 priority, Common::ChangeID *changeID=0)
Add all the resources of an archive to the resource manager.
Common::ChangeContent * clone() const
Common::UString getArchiveName(const Resource &resource) const
ResourceChanges resources
Common::UString name
The resource's name.
uint64 getHash(const Common::UString &name, FileType type) const
ResourceMap _resources
All currently known resources.
std::list< KnownArchive > KnownArchives
List of all known archive files.
bool hasArchive(const Common::UString &file)
Does a specific archive exist?
std::map< uint64, ResourceList > ResourceMap
Map over resources, indexed by their hashed name.
Basic type definitions to handle files used in BioWare's Aurora engine.
KnownArchive * findArchive(const Common::UString &file)
Common::UString path
The file's path.
void indexResourceFile(const Common::UString &file, uint32 priority, Common::ChangeID *changeID=0)
Add a single file to the resource manager.
OpenedArchive * opened
The opened archive, if it was.
Common::SeekableReadStream * getResource(uint64 hash, FileType *type=0) const
Return a resource.
uint32 openKEYBIFs(Common::SeekableReadStream *keyStream, std::vector< KnownArchive *> &archives, std::vector< KEYDataFile *> &keyData)
Change(ChangeSetList::iterator change)
A class representing an undoable change.
std::list< ChangeSet > ChangeSetList
std::list< OpenedArchiveChange > OpenedArchiveChanges
bool operator<(const Resource &right) const
FileType
Various file types used by the Aurora engine and found in archives.
Common::UString name
The archive's name.
uint32 priority
The resource's priority over others with the same name and type.
Common::UString _baseArchive
The data base archive (if any), the archive the current game is in.
Resource * resource
The resource this archive is.
An abstract file archive.
const Common::UString & getDataBase() const
Return the path of the currently registered base data directory or archive.
A resource manager holding information about and handling all request for all resources usable by the...
std::pair< KnownArchives *, KnownArchives::iterator > selfArchive
The archive this resource itself is.
void undo(Common::ChangeID &changeID)
Undo the changes done in the specified change ID.
void setRIMsAreERFs(bool rimsAreERFs)
Are .rim/.rimp files actually ERF files?
void addTypeAlias(FileType alias, FileType realType)
Add an alias for one file type to another.
Common::UString _baseDir
The data base directory (if any), the directory the current game is in.
Common::SeekableReadStream * getArchiveResource(const Resource &res, bool tryNoCopy=false) const
std::vector< FileType > FileTypeList
OpenedArchives _openedArchives
List of currently used archives.
ArchiveType type
The archive's type.
Interface for a seekable & readable data stream.
void getAvailableResources(FileType type, std::list< ResourceID > &list) const
Return a list of all available resources of the specified type.
void declareResource(const Common::UString &name, FileType type)
Declare the name of a specific resource.
OpenedArchives::iterator OpenedArchiveChange
A change produced by indexing/opening an archive.
void setHashAlgo(Common::HashAlgo algo)
With which hash algorithm are/should the names be hashed?
bool checkResourceIsArchive(Resource &resource, Change *change)
Change * newChangeSet(Common::ChangeID &changeID)
ResourceList::iterator resIt
void checkHashCollision(const Resource &resource, ResourceMap::const_iterator resList)
OpenedArchive * archive
Pointer to the opened archive.