[Scummvm-git-logs] scummvm master -> 599adef9d5e242c134080d93f6ba97eeef1beeff

sev- noreply at scummvm.org
Tue Apr 23 11:37:05 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
599adef9d5 ACHIEVEMENTS: Allow to override the default achievements platform


Commit: 599adef9d5e242c134080d93f6ba97eeef1beeff
    https://github.com/scummvm/scummvm/commit/599adef9d5e242c134080d93f6ba97eeef1beeff
Author: scemino (scemino74 at gmail.com)
Date: 2024-04-23T13:37:01+02:00

Commit Message:
ACHIEVEMENTS: Allow to override the default achievements platform

Changed paths:
    engines/metaengine.cpp
    engines/metaengine.h


diff --git a/engines/metaengine.cpp b/engines/metaengine.cpp
index 676bd952a47..96cb6c4923c 100644
--- a/engines/metaengine.cpp
+++ b/engines/metaengine.cpp
@@ -138,6 +138,17 @@ Common::KeymapArray MetaEngine::initKeymaps(const char *target) const {
 	return Keymap::arrayOf(engineKeyMap);
 }
 
+Common::AchievementsPlatform MetaEngine::getAchievementsPlatform(const Common::String &target) const {
+	Common::String extra = ConfMan.get("extra", target);
+	if (extra.contains("GOG")) {
+		return Common::GALAXY_ACHIEVEMENTS;
+	}
+	if (extra.contains("Steam")) {
+		return Common::STEAM_ACHIEVEMENTS;
+	}
+	return Common::UNK_ACHIEVEMENTS;
+}
+
 const Common::AchievementsInfo MetaEngine::getAchievementsInfo(const Common::String &target) const {
 	const Common::AchievementDescriptionList* achievementDescriptionList = getAchievementDescriptionList();
 	if (achievementDescriptionList == nullptr) {
@@ -146,13 +157,7 @@ const Common::AchievementsInfo MetaEngine::getAchievementsInfo(const Common::Str
 
 	Common::String gameId = ConfMan.get("gameid", target);
 
-	Common::AchievementsPlatform platform = Common::UNK_ACHIEVEMENTS;
-	Common::String extra = ConfMan.get("extra", target);
-	if (extra.contains("GOG")) {
-		platform = Common::GALAXY_ACHIEVEMENTS;
-	} else if (extra.contains("Steam")) {
-		platform = Common::STEAM_ACHIEVEMENTS;
-	}
+	const Common::AchievementsPlatform platform = getAchievementsPlatform(target);
 
 	// "(gameId, platform) -> result" search
 	Common::AchievementsInfo result;
@@ -403,7 +408,7 @@ SaveStateList MetaEngine::listSaves(const char *target, bool saveMode) const {
 	SaveStateDescriptor desc(this, autosaveSlot, dummyAutosave);
 	desc.setWriteProtectedFlag(true);
 	desc.setDeletableFlag(false);
-	
+
 	saveList.push_back(desc);
 	Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
 
diff --git a/engines/metaengine.h b/engines/metaengine.h
index 71bc6b3ec8d..c188601aa5a 100644
--- a/engines/metaengine.h
+++ b/engines/metaengine.h
@@ -493,6 +493,15 @@ public:
 		kSavesUseExtendedFormat
 	};
 
+	/**
+	 * Return the achievements platform to use for the specified target.
+	 *
+	 * @param target  Name of a config manager target.
+	 *
+	 * @return The achievements platform to use for an engine plugin and target.
+	 */
+	virtual Common::AchievementsPlatform getAchievementsPlatform(const Common::String &target) const;
+
 	/**
 	 * Return a list of achievement descriptions for the specified target.
 	 *




More information about the Scummvm-git-logs mailing list