aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk/detection.cpp
diff options
context:
space:
mode:
authorBastien Bouclet2016-02-22 08:31:02 +0100
committerBastien Bouclet2016-02-22 08:44:55 +0100
commit7044996cd530d1e0efa6a521be85c07111eb76df (patch)
treede7fd824bf1425aa1a3e5359a0312797234ede57 /engines/mohawk/detection.cpp
parent6f56f2efe129e55d7ac5cf35378dd385d3f0547b (diff)
downloadscummvm-rg350-7044996cd530d1e0efa6a521be85c07111eb76df.tar.gz
scummvm-rg350-7044996cd530d1e0efa6a521be85c07111eb76df.tar.bz2
scummvm-rg350-7044996cd530d1e0efa6a521be85c07111eb76df.zip
MOHAWK: Add support for the ScummVM save metadata features
The metadata is saved in a separate file to keep compatibility with the original engine saves.
Diffstat (limited to 'engines/mohawk/detection.cpp')
-rw-r--r--engines/mohawk/detection.cpp41
1 files changed, 35 insertions, 6 deletions
diff --git a/engines/mohawk/detection.cpp b/engines/mohawk/detection.cpp
index 926c296257..986b35c85e 100644
--- a/engines/mohawk/detection.cpp
+++ b/engines/mohawk/detection.cpp
@@ -35,6 +35,7 @@
#ifdef ENABLE_MYST
#include "mohawk/myst.h"
+#include "mohawk/myst_state.h"
#endif
#ifdef ENABLE_RIVEN
@@ -184,13 +185,18 @@ public:
virtual SaveStateList listSaves(const char *target) const;
virtual int getMaximumSaveSlot() const { return 999; }
virtual void removeSaveState(const char *target, int slot) const;
+ virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
};
bool MohawkMetaEngine::hasFeature(MetaEngineFeature f) const {
return
(f == kSupportsListSaves)
|| (f == kSupportsLoadingDuringStartup)
- || (f == kSupportsDeleteSave);
+ || (f == kSupportsDeleteSave)
+ || (f == kSavesSupportMetaInfo)
+ || (f == kSavesSupportThumbnail)
+ || (f == kSavesSupportCreationDate)
+ || (f == kSavesSupportPlayTime);
}
SaveStateList MohawkMetaEngine::listSaves(const char *target) const {
@@ -198,12 +204,15 @@ SaveStateList MohawkMetaEngine::listSaves(const char *target) const {
SaveStateList saveList;
// Loading games is only supported in Myst/Riven currently.
+#ifdef ENABLE_MYST
if (strstr(target, "myst")) {
- filenames = g_system->getSavefileManager()->listSavefiles("*.mys");
+ filenames = Mohawk::MystGameState::generateSaveGameList();
for (uint32 i = 0; i < filenames.size(); i++)
saveList.push_back(SaveStateDescriptor(i, filenames[i]));
- } else if (strstr(target, "riven")) {
+ } else
+#endif
+ if (strstr(target, "riven")) {
filenames = g_system->getSavefileManager()->listSavefiles("*.rvn");
for (uint32 i = 0; i < filenames.size(); i++)
@@ -215,15 +224,35 @@ SaveStateList MohawkMetaEngine::listSaves(const char *target) const {
void MohawkMetaEngine::removeSaveState(const char *target, int slot) const {
// Removing saved games is only supported in Myst/Riven currently.
+#ifdef ENABLE_MYST
if (strstr(target, "myst")) {
- Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles("*.mys");
- g_system->getSavefileManager()->removeSavefile(filenames[slot].c_str());
- } else if (strstr(target, "riven")) {
+ Common::StringArray filenames = Mohawk::MystGameState::generateSaveGameList();
+ Mohawk::MystGameState::deleteSave(filenames[slot]);
+ } else
+#endif
+ if (strstr(target, "riven")) {
Common::StringArray filenames = g_system->getSavefileManager()->listSavefiles("*.rvn");
g_system->getSavefileManager()->removeSavefile(filenames[slot].c_str());
}
}
+SaveStateDescriptor MohawkMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
+#ifdef ENABLE_MYST
+ if (strstr(target, "myst")) {
+ Common::StringArray filenames = Mohawk::MystGameState::generateSaveGameList();
+
+ if (slot >= (int) filenames.size()) {
+ return SaveStateDescriptor();
+ }
+
+ return Mohawk::MystGameState::querySaveMetaInfos(filenames[slot]);
+ } else
+#endif
+ {
+ return SaveStateDescriptor();
+ }
+}
+
bool MohawkMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
const Mohawk::MohawkGameDescription *gd = (const Mohawk::MohawkGameDescription *)desc;