aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk/detection.cpp
diff options
context:
space:
mode:
authorBastien Bouclet2016-09-15 14:34:48 +0200
committerBastien Bouclet2019-11-03 11:43:00 +0100
commit3d34c3e5c0736c32bb88d5e4465fc815d97a3dc3 (patch)
tree44c6bf01c359d0f1f6dcbd88fbdf68f97e74636c /engines/mohawk/detection.cpp
parentae9f764c7ac4fcc418ca7182163f4e9646f4bc31 (diff)
downloadscummvm-rg350-3d34c3e5c0736c32bb88d5e4465fc815d97a3dc3.tar.gz
scummvm-rg350-3d34c3e5c0736c32bb88d5e4465fc815d97a3dc3.tar.bz2
scummvm-rg350-3d34c3e5c0736c32bb88d5e4465fc815d97a3dc3.zip
MOHAWK: Stop relying on the target to detect the current game
The target is user defined and not may not contain the game name
Diffstat (limited to 'engines/mohawk/detection.cpp')
-rw-r--r--engines/mohawk/detection.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/engines/mohawk/detection.cpp b/engines/mohawk/detection.cpp
index bc7f6cda38..96b68af120 100644
--- a/engines/mohawk/detection.cpp
+++ b/engines/mohawk/detection.cpp
@@ -23,6 +23,7 @@
#include "base/plugins.h"
#include "engines/advancedDetector.h"
+#include "common/config-manager.h"
#include "common/savefile.h"
#include "common/system.h"
#include "common/textconsole.h"
@@ -260,11 +261,12 @@ SaveStateList MohawkMetaEngine::listSavesForPrefix(const char *prefix, const cha
}
SaveStateList MohawkMetaEngine::listSaves(const char *target) const {
+ Common::String gameId = ConfMan.get("gameid", target);
SaveStateList saveList;
// Loading games is only supported in Myst/Riven currently.
#ifdef ENABLE_MYST
- if (strstr(target, "myst")) {
+ if (gameId == "myst") {
saveList = listSavesForPrefix("myst", "mys");
for (SaveStateList::iterator save = saveList.begin(); save != saveList.end(); ++save) {
@@ -276,7 +278,7 @@ SaveStateList MohawkMetaEngine::listSaves(const char *target) const {
}
#endif
#ifdef ENABLE_RIVEN
- if (strstr(target, "riven")) {
+ if (gameId == "riven") {
saveList = listSavesForPrefix("riven", "rvn");
for (SaveStateList::iterator save = saveList.begin(); save != saveList.end(); ++save) {
@@ -292,28 +294,31 @@ SaveStateList MohawkMetaEngine::listSaves(const char *target) const {
}
void MohawkMetaEngine::removeSaveState(const char *target, int slot) const {
+ Common::String gameId = ConfMan.get("gameid", target);
// Removing saved games is only supported in Myst/Riven currently.
#ifdef ENABLE_MYST
- if (strstr(target, "myst")) {
+ if (gameId == "myst") {
Mohawk::MystGameState::deleteSave(slot);
}
#endif
#ifdef ENABLE_RIVEN
- if (strstr(target, "riven")) {
+ if (gameId == "riven") {
Mohawk::RivenSaveLoad::deleteSave(slot);
}
#endif
}
SaveStateDescriptor MohawkMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
+ Common::String gameId = ConfMan.get("gameid", target);
+
#ifdef ENABLE_MYST
- if (strstr(target, "myst")) {
+ if (gameId == "myst") {
return Mohawk::MystGameState::querySaveMetaInfos(slot);
}
#endif
#ifdef ENABLE_RIVEN
- if (strstr(target, "riven")) {
+ if (gameId == "riven") {
return Mohawk::RivenSaveLoad::querySaveMetaInfos(slot);
} else
#endif