[Scummvm-git-logs] scummvm master -> 541a8704d657e57f7b2ef798adb55b92ebc82a9d
bluegr
noreply at scummvm.org
Wed Nov 30 21:29:40 UTC 2022
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
6506e59064 ENGINES: Add getMD5Bytes to the base MetaEngineDetection class
541a8704d6 GLK: Implement GlkMetaEngineDetection::getMD5Bytes()
Commit: 6506e590646d0bdbaa5f1b00cad472244d968f3e
https://github.com/scummvm/scummvm/commit/6506e590646d0bdbaa5f1b00cad472244d968f3e
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2022-11-30T23:29:37+02:00
Commit Message:
ENGINES: Add getMD5Bytes to the base MetaEngineDetection class
Changed paths:
base/commandLine.cpp
engines/advancedDetector.h
engines/glk/detection.cpp
engines/glk/detection.h
engines/metaengine.h
engines/scumm/detection.cpp
engines/sky/detection.cpp
diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 099c01c41e9..d1699f4a6a1 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -1822,22 +1822,17 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
if (command == "md5" && settings.contains("md5-engine")) {
Common::String engineID = settings["md5-engine"];
- if (engineID == "scumm") {
- // Hardcoding value as scumm doesn't use AdvancedMetaEngineDetection
- md5Length = 1024 * 1024;
- } else {
- const Plugin *plugin = EngineMan.findPlugin(engineID);
- if (!plugin) {
- warning("'%s' is an invalid engine ID. Use the --list-engines command to list supported engine IDs", engineID.c_str());
- return true;
- }
- const AdvancedMetaEngineDetection* advEnginePtr = dynamic_cast<AdvancedMetaEngineDetection*>(&(plugin->get<MetaEngineDetection>()));
- if (advEnginePtr == nullptr) {
- warning("The requested engine (%s) doesn't support MD5-based detection", engineID.c_str());
- return true;
- }
- md5Length = (int32)advEnginePtr->getMD5Bytes();
+ const Plugin *plugin = EngineMan.findPlugin(engineID);
+ if (!plugin) {
+ warning("'%s' is an invalid engine ID. Use the --list-engines command to list supported engine IDs", engineID.c_str());
+ return true;
+ }
+
+ md5Length = plugin->get<MetaEngineDetection>().getMD5Bytes();
+ if (!md5Length) {
+ warning("The requested engine (%s) doesn't support MD5-based detection", engineID.c_str());
+ return true;
}
}
diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h
index 6d083010979..1f8bcdb22a3 100644
--- a/engines/advancedDetector.h
+++ b/engines/advancedDetector.h
@@ -367,7 +367,7 @@ public:
static Common::StringArray getPathsFromEntry(const ADGameDescription *g);
- uint getMD5Bytes() const { return _md5Bytes; }
+ uint getMD5Bytes() const override final { return _md5Bytes; }
protected:
/**
diff --git a/engines/glk/detection.cpp b/engines/glk/detection.cpp
index 24cea551133..c92dd71ae55 100644
--- a/engines/glk/detection.cpp
+++ b/engines/glk/detection.cpp
@@ -230,4 +230,9 @@ void GlkMetaEngineDetection::detectClashes() const {
#endif
}
+uint GlkMetaEngineDetection::getMD5Bytes() const {
+ // TODO: Implement this properly
+ return 0;
+}
+
REGISTER_PLUGIN_STATIC(GLK_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, GlkMetaEngineDetection);
diff --git a/engines/glk/detection.h b/engines/glk/detection.h
index 50c9728f1ea..025c0b43167 100644
--- a/engines/glk/detection.h
+++ b/engines/glk/detection.h
@@ -67,6 +67,8 @@ public:
* Calls each sub-engine in turn to ensure no game Id accidentally shares the same Id
*/
void detectClashes() const;
+
+ uint getMD5Bytes() const override;
};
namespace Glk {
diff --git a/engines/metaengine.h b/engines/metaengine.h
index 231413c363a..a1810d805bf 100644
--- a/engines/metaengine.h
+++ b/engines/metaengine.h
@@ -163,6 +163,9 @@ public:
*/
virtual DetectedGames detectGames(const Common::FSList &fslist, uint32 skipADFlags = 0, bool skipIncomplete = false) = 0;
+ /** Returns the number of bytes used for MD5-based detection, or 0 if not supported. */
+ virtual uint getMD5Bytes() const = 0;
+
/**
* The default version of this method will just parse the options string from
* the config manager. However it also allows the meta engine to post process
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index 1ea3ed1eb2c..25fa8ba5a03 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -84,6 +84,10 @@ public:
PlainGameDescriptor findGame(const char *gameid) const override;
DetectedGames detectGames(const Common::FSList &fslist, uint32 /*skipADFlags*/, bool /*skipIncomplete*/) override;
+ uint getMD5Bytes() const override {
+ return 1024 * 1024;
+ }
+
Common::String parseAndCustomizeGuiOptions(const Common::String &optionsString, const Common::String &domain) const override;
};
diff --git a/engines/sky/detection.cpp b/engines/sky/detection.cpp
index 452b4b1cda4..390019b4807 100644
--- a/engines/sky/detection.cpp
+++ b/engines/sky/detection.cpp
@@ -66,6 +66,10 @@ public:
PlainGameList getSupportedGames() const override;
PlainGameDescriptor findGame(const char *gameid) const override;
DetectedGames detectGames(const Common::FSList &fslist, uint32 /*skipADFlags*/, bool /*skipIncomplete*/) override;
+
+ uint getMD5Bytes() const override {
+ return 0;
+ }
};
const char *SkyMetaEngineDetection::getEngineName() const {
Commit: 541a8704d657e57f7b2ef798adb55b92ebc82a9d
https://github.com/scummvm/scummvm/commit/541a8704d657e57f7b2ef798adb55b92ebc82a9d
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-11-30T23:29:37+02:00
Commit Message:
GLK: Implement GlkMetaEngineDetection::getMD5Bytes()
Changed paths:
engines/glk/detection.cpp
diff --git a/engines/glk/detection.cpp b/engines/glk/detection.cpp
index c92dd71ae55..cc2f3932298 100644
--- a/engines/glk/detection.cpp
+++ b/engines/glk/detection.cpp
@@ -231,8 +231,7 @@ void GlkMetaEngineDetection::detectClashes() const {
}
uint GlkMetaEngineDetection::getMD5Bytes() const {
- // TODO: Implement this properly
- return 0;
+ return 5000;
}
REGISTER_PLUGIN_STATIC(GLK_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, GlkMetaEngineDetection);
More information about the Scummvm-git-logs
mailing list