aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/detection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sword25/detection.cpp')
-rw-r--r--engines/sword25/detection.cpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/engines/sword25/detection.cpp b/engines/sword25/detection.cpp
index e210f4d27c..3900df2fcf 100644
--- a/engines/sword25/detection.cpp
+++ b/engines/sword25/detection.cpp
@@ -24,10 +24,12 @@
*/
#include "base/plugins.h"
-
+#include "common/savefile.h"
+#include "common/system.h"
#include "engines/advancedDetector.h"
#include "sword25/sword25.h"
+#include "sword25/kernel/persistenceservice.h"
namespace Sword25 {
uint32 Sword25Engine::getGameFlags() const { return _gameDescription->flags; }
@@ -68,7 +70,7 @@ static const ADGameDescription gameDescriptions[] = {
AD_TABLE_END_MARKER
};
-} // end of namespace Sword25
+} // End of namespace Sword25
static const char *directoryGlobs[] = {
"system", // Used by extracted dats
@@ -113,6 +115,9 @@ public:
}
virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
+ virtual bool hasFeature(MetaEngineFeature f) const;
+ virtual int getMaximumSaveSlot() const { return Sword25::PersistenceService::getSlotCount(); }
+ virtual SaveStateList listSaves(const char *target) const;
};
bool Sword25MetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
@@ -122,6 +127,31 @@ bool Sword25MetaEngine::createInstance(OSystem *syst, Engine **engine, const ADG
return desc != 0;
}
+bool Sword25MetaEngine::hasFeature(MetaEngineFeature f) const {
+ return
+ (f == kSupportsListSaves);
+}
+
+SaveStateList Sword25MetaEngine::listSaves(const char *target) const {
+ Common::String pattern = target;
+ pattern = pattern + ".???";
+ SaveStateList saveList;
+
+ Sword25::PersistenceService ps;
+ Sword25::setGameTarget(target);
+
+ ps.reloadSlots();
+
+ for (uint i = 0; i < ps.getSlotCount(); ++i) {
+ if (ps.isSlotOccupied(i)) {
+ Common::String desc = ps.getSavegameDescription(i);
+ saveList.push_back(SaveStateDescriptor(i, desc));
+ }
+ }
+
+ return saveList;
+}
+
#if PLUGIN_ENABLED_DYNAMIC(SWORD25)
REGISTER_PLUGIN_DYNAMIC(SWORD25, PLUGIN_TYPE_ENGINE, Sword25MetaEngine);
#else