From 742521c20db68e965761ba9309bb0a3dea379217 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Sun, 22 Jul 2012 07:24:48 +0200 Subject: WINTERMUTE: Redo base_file_manager, to use FSLists for registering/opening packages. This is helpfull for consistency between registering and lookup, and allows for explicit removal/adding of sub_paths for the engine. But most importantly it keeps the loading consistent and non-duplicated for detection. --- engines/wintermute/base/base_file_manager.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'engines/wintermute/base/base_file_manager.h') diff --git a/engines/wintermute/base/base_file_manager.h b/engines/wintermute/base/base_file_manager.h index 469108bee8..78e6cb737f 100644 --- a/engines/wintermute/base/base_file_manager.h +++ b/engines/wintermute/base/base_file_manager.h @@ -32,6 +32,7 @@ #include "engines/wintermute/base/file/base_file_entry.h" #include "common/archive.h" #include "common/str.h" +#include "common/fs.h" namespace Common { class File; @@ -41,39 +42,38 @@ namespace WinterMute { class BaseFile; class BaseFileManager: BaseClass { public: - bool findPackageSignature(Common::File *f, uint32 *offset); + bool findPackageSignature(Common::SeekableReadStream *f, uint32 *offset); bool cleanup(); bool setBasePath(const Common::String &path); bool restoreCurrentDir(); char *_basePath; - bool getFullPath(const Common::String &filename, char *fullname); Common::SeekableReadStream *openFileRaw(const Common::String &filename); bool closeFile(Common::SeekableReadStream *File); bool hasFile(const Common::String &filename); Common::SeekableReadStream *openFile(const Common::String &filename, bool absPathWarning = true, bool keepTrackOf = true); BaseFileEntry *getPackageEntry(const Common::String &filename); - Common::File *openSingleFile(const Common::String &name); Common::File *openPackage(const Common::String &name); + bool registerPackages(const Common::FSList &fslist); bool registerPackages(); bool initPaths(); bool reloadPaths(); typedef enum { PATH_PACKAGE, PATH_SINGLE } TPathType; - bool addPath(TPathType type, const Common::String &path); + bool addPath(TPathType type, const Common::FSNode &path); bool requestCD(int cd, char *packageFile, const char *filename); Common::SeekableReadStream *loadSaveGame(const Common::String &filename); bool saveFile(const Common::String &filename, byte *buffer, uint32 bufferSize, bool compressed = false, byte *prefixBuffer = NULL, uint32 prefixSize = 0); byte *readWholeFile(const Common::String &filename, uint32 *size = NULL, bool mustExist = true); BaseFileManager(BaseGame *inGame = NULL); virtual ~BaseFileManager(); - Common::Array _singlePaths; - Common::Array _packagePaths; +// Common::FSList _singlePaths; + Common::FSList _packagePaths; Common::Array _packages; Common::Array _openFiles; - Common::HashMap _files; private: + bool registerPackage(Common::SeekableReadStream *stream, const Common::String &filename = "", bool searchSignature = false); bool registerPackage(const Common::String &filename, bool searchSignature = false); Common::HashMap::iterator _filesIter; bool isValidPackage(const AnsiString &fileName) const; -- cgit v1.2.3