diff options
author | lolbot-iichan | 2019-05-19 23:01:09 +0300 |
---|---|---|
committer | Filippos Karapetis | 2020-01-11 18:05:39 +0200 |
commit | b3901a3d57654685f81b31e25e32d6c1cc85c86e (patch) | |
tree | 85f76d13695a0c2e5e759596d96d2f1a21b13702 | |
parent | 197a9542646ba30b33901b135ee14892a801694b (diff) | |
download | scummvm-rg350-b3901a3d57654685f81b31e25e32d6c1cc85c86e.tar.gz scummvm-rg350-b3901a3d57654685f81b31e25e32d6c1cc85c86e.tar.bz2 scummvm-rg350-b3901a3d57654685f81b31e25e32d6c1cc85c86e.zip |
WINTERMUTE: Add FoxTail game&engine version properties
FoxTail requires Game to have 2 string options with engine build and
game package version.
BuildVersion is provided with detection tables
GameVersion is extracted from data.dcp and stored in a hashmap
-rw-r--r-- | engines/wintermute/base/base_file_manager.cpp | 15 | ||||
-rw-r--r-- | engines/wintermute/base/base_file_manager.h | 3 | ||||
-rw-r--r-- | engines/wintermute/base/base_game.cpp | 39 | ||||
-rw-r--r-- | engines/wintermute/base/file/base_package.cpp | 2 | ||||
-rw-r--r-- | engines/wintermute/base/file/base_package.h | 3 |
5 files changed, 60 insertions, 2 deletions
diff --git a/engines/wintermute/base/base_file_manager.cpp b/engines/wintermute/base/base_file_manager.cpp index dad8b43d65..6102c10725 100644 --- a/engines/wintermute/base/base_file_manager.cpp +++ b/engines/wintermute/base/base_file_manager.cpp @@ -300,7 +300,7 @@ bool BaseFileManager::registerPackages() { } } debugC(kWintermuteDebugFileAccess, "Registering %s %s", fileIt->getPath().c_str(), fileIt->getName().c_str()); - registerPackage((*fileIt), "", searchSignature); + registerPackage((*fileIt), fileName, searchSignature); } } @@ -311,7 +311,8 @@ bool BaseFileManager::registerPackages() { bool BaseFileManager::registerPackage(Common::FSNode file, const Common::String &filename, bool searchSignature) { PackageSet *pack = new PackageSet(file, filename, searchSignature); - _packages.add(file.getName(), pack, pack->getPriority() , true); + _packages.add(filename, pack, pack->getPriority() , true); + _versions[filename] = pack->getVersion(); return STATUS_OK; } @@ -348,6 +349,16 @@ Common::SeekableReadStream *BaseFileManager::openPkgFile(const Common::String &f return file; } +////////////////////////////////////////////////////////////////////////// +uint32 BaseFileManager::getPackageVersion(const Common::String &filename) { + Common::HashMap<Common::String, uint32>::iterator it = _versions.find(filename); + if (it != _versions.end()) { + return it->_value; + } + return 0; +} + +////////////////////////////////////////////////////////////////////////// bool BaseFileManager::hasFile(const Common::String &filename) { if (scumm_strnicmp(filename.c_str(), "savegame:", 9) == 0) { BasePersistenceManager pm(BaseEngine::instance().getGameTargetName()); diff --git a/engines/wintermute/base/base_file_manager.h b/engines/wintermute/base/base_file_manager.h index 85181f1f58..397e38cc3d 100644 --- a/engines/wintermute/base/base_file_manager.h +++ b/engines/wintermute/base/base_file_manager.h @@ -46,6 +46,7 @@ public: Common::SeekableReadStream *openFile(const Common::String &filename, bool absPathWarning = true, bool keepTrackOf = true); Common::WriteStream *openFileForWrite(const Common::String &filename); byte *readWholeFile(const Common::String &filename, uint32 *size = nullptr, bool mustExist = true); + uint32 getPackageVersion(const Common::String &filename); BaseFileManager(Common::Language lang, bool detectionMode = false); virtual ~BaseFileManager(); @@ -72,6 +73,8 @@ private: Common::Array<Common::SeekableReadStream *> _openFiles; Common::Language _language; Common::Archive *_resources; + Common::HashMap<Common::String, uint32> _versions; + // This class is intentionally not a subclass of Base, as it needs to be used by // the detector too, without launching the entire engine: }; diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index 2d30eb9bb5..a0659cac86 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -2405,6 +2405,45 @@ ScValue *BaseGame::scGetProperty(const Common::String &name) { } return _scValue; } + + ////////////////////////////////////////////////////////////////////////// + // [FoxTail] BuildVersion (RO) + // Used to display full game version at options.script in UpdateControls() + // Returns FoxTail engine version number as a dotted string + ////////////////////////////////////////////////////////////////////////// + else if (name == "BuildVersion") { + if (BaseEngine::instance().getTargetExecutable() == FOXTAIL_1_2_227) { + _scValue->setString("1.2.227"); + } else if (BaseEngine::instance().getTargetExecutable() == FOXTAIL_1_2_230) { + _scValue->setString("1.2.230"); + } else if (BaseEngine::instance().getTargetExecutable() == FOXTAIL_1_2_304) { + _scValue->setString("1.2.304"); + } else if (BaseEngine::instance().getTargetExecutable() == FOXTAIL_1_2_362) { + _scValue->setString("1.2.362"); + } else if (BaseEngine::instance().getTargetExecutable() == FOXTAIL_1_2_527) { + _scValue->setString("1.2.527"); + } else { + _scValue->setString("UNKNOWN"); + } + return _scValue; + } + + ////////////////////////////////////////////////////////////////////////// + // [FoxTail] GameVersion (RO) + // Used to display full game version at options.script in UpdateControls() + // Returns FoxTail version number as a string + ////////////////////////////////////////////////////////////////////////// + else if (name == "GameVersion") { + uint32 gameVersion = 0; + BaseFileManager *fileManager = BaseEngine::instance().getFileManager(); + if (fileManager) { + gameVersion = fileManager->getPackageVersion("data.dcp"); + } + char tmp[16]; + sprintf(tmp,"%u",gameVersion); + _scValue->setString(tmp); + return _scValue; + } #endif ////////////////////////////////////////////////////////////////////////// diff --git a/engines/wintermute/base/file/base_package.cpp b/engines/wintermute/base/file/base_package.cpp index 2ed27e2c32..3d67d02774 100644 --- a/engines/wintermute/base/file/base_package.cpp +++ b/engines/wintermute/base/file/base_package.cpp @@ -142,6 +142,8 @@ PackageSet::PackageSet(Common::FSNode file, const Common::String &filename, bool debugC(kWintermuteDebugFileAccess | kWintermuteDebugLog, " Warning: package file '%s' is outdated.", filename.c_str()); } _priority = hdr._priority; + _version = hdr._gameVersion; + // new in v2 if (hdr._packageVersion == PACKAGE_VERSION) { uint32 dirOffset; diff --git a/engines/wintermute/base/file/base_package.h b/engines/wintermute/base/file/base_package.h index 35976eb47b..578dc789fa 100644 --- a/engines/wintermute/base/file/base_package.h +++ b/engines/wintermute/base/file/base_package.h @@ -78,8 +78,11 @@ public: virtual Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const; int getPriority() const { return _priority; } + uint32 getVersion() const { return _version; } + private: byte _priority; + uint32 _version; Common::Array<BasePackage *> _packages; Common::HashMap<Common::String, Common::ArchiveMemberPtr> _files; Common::HashMap<Common::String, Common::ArchiveMemberPtr>::iterator _filesIter; |