diff options
author | Johannes Schickel | 2008-05-31 20:48:41 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-05-31 20:48:41 +0000 |
commit | 4ef680abaf3c81b061090061a69ec5ff13d71ae5 (patch) | |
tree | 2c232ad9d434ae3ff55be98ab962287a34eb2b65 /engines/kyra/resource.h | |
parent | dd79ed10114d552ce9932331d9e4023af6e8dfa1 (diff) | |
download | scummvm-rg350-4ef680abaf3c81b061090061a69ec5ff13d71ae5.tar.gz scummvm-rg350-4ef680abaf3c81b061090061a69ec5ff13d71ae5.tar.bz2 scummvm-rg350-4ef680abaf3c81b061090061a69ec5ff13d71ae5.zip |
- Fixed possible invalid memory access in Resource::loadFileToBuf
- Reworked compressed installer files handling
- Updated HoF installer file code (thanks to _athrxx for that)
svn-id: r32439
Diffstat (limited to 'engines/kyra/resource.h')
-rw-r--r-- | engines/kyra/resource.h | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/engines/kyra/resource.h b/engines/kyra/resource.h index 90405690a4..167ccd7943 100644 --- a/engines/kyra/resource.h +++ b/engines/kyra/resource.h @@ -41,15 +41,6 @@ namespace Kyra { -struct InsHofArchive { - Common::String filename; - uint32 firstFile; - uint32 startOffset; - uint32 lastFile; - uint32 endOffset; - uint32 totalSize; -}; - struct ResFileEntry { Common::String parent; uint32 size; @@ -61,20 +52,21 @@ struct ResFileEntry { enum kType { kRaw = 0, kPak = 1, - kInsKyra = 2, - kInsHof = 3, - kInsMal = 4, - kTlk = 5, + kInsMal = 2, + kTlk = 3, kAutoDetect }; kType type; uint32 offset; +}; - int fileIndex; - uint32 compressedSize; +struct CompFileEntry { + uint32 size; + uint8 *data; }; typedef Common::HashMap<Common::String, ResFileEntry, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> ResFileMap; +typedef Common::HashMap<Common::String, CompFileEntry, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> CompFileMap; class Resource; class ResArchiveLoader { @@ -100,6 +92,14 @@ public: protected: }; +class CompArchiveLoader { +public: + virtual ~CompArchiveLoader() {} + + virtual bool checkForFiles() const = 0; + virtual bool loadFile(CompFileMap &loadTo) const = 0; +}; + class Resource { public: Resource(KyraEngine_v1 *vm); @@ -136,6 +136,15 @@ protected: LoaderList _loaders; ResFileMap _map; + typedef Common::List<Common::SharedPtr<CompArchiveLoader> > CompLoaderList; + typedef CompLoaderList::iterator CompLoaderIterator; + typedef CompLoaderList::const_iterator CCompLoaderIterator; + CompLoaderList _compLoaders; + CompFileMap _compFiles; + + void tryLoadCompFiles(); + void clearCompFileList(); + KyraEngine_v1 *_vm; }; @@ -376,3 +385,4 @@ private: + |