aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/resource.h
diff options
context:
space:
mode:
authorJohannes Schickel2008-08-20 14:30:40 +0000
committerJohannes Schickel2008-08-20 14:30:40 +0000
commit430977e438794b85808d3df8f2876b6faf46fc25 (patch)
tree052019718c3872b066ecc5772d8e66ba0fca03f4 /engines/kyra/resource.h
parent9138128f5cee660184ce57b645644d341241918a (diff)
downloadscummvm-rg350-430977e438794b85808d3df8f2876b6faf46fc25.tar.gz
scummvm-rg350-430977e438794b85808d3df8f2876b6faf46fc25.tar.bz2
scummvm-rg350-430977e438794b85808d3df8f2876b6faf46fc25.zip
Committed patch #2055831 "KYRA: ResFileEntry parent cache optimization".
svn-id: r34055
Diffstat (limited to 'engines/kyra/resource.h')
-rw-r--r--engines/kyra/resource.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h
index d43f730e6b..5ecbd145fe 100644
--- a/engines/kyra/resource.h
+++ b/engines/kyra/resource.h
@@ -43,6 +43,9 @@ namespace Kyra {
struct ResFileEntry {
Common::String parent;
+ mutable ResFileEntry *parentEntry; // Cache to avoid lookup by string in the map
+ // No smart invalidation is needed because the map is cleared globally
+ // or expanded but no element is ever removed
uint32 size;
bool preload;
@@ -128,9 +131,11 @@ public:
bool loadFileToBuf(const char *file, void *buf, uint32 maxSize);
protected:
void checkFile(const Common::String &file);
- bool isAccessable(const Common::String &file);
+ bool isAccessible(const Common::String &file);
+ bool isAccessible(const ResFileEntry *fileEntry);
void detectFileTypes();
+ void detectFileType(const Common::String &filename, ResFileEntry *fileEntry);
void initializeLoaders();
const ResArchiveLoader *getLoader(ResFileEntry::kType type) const;
@@ -140,6 +145,9 @@ protected:
LoaderList _loaders;
ResFileMap _map;
+ ResFileEntry *getParentEntry(const ResFileEntry *entry) const;
+ ResFileEntry *getParentEntry(const Common::String &filename) const;
+
typedef Common::List<Common::SharedPtr<CompArchiveLoader> > CompLoaderList;
typedef CompLoaderList::iterator CompLoaderIterator;
typedef CompLoaderList::const_iterator CCompLoaderIterator;