[Scummvm-cvs-logs] scummvm master -> dc1c1d48d9aee7bbaca7f6643e46ec1228f3ac7f

whoozle whoozle at yandex.ru
Wed Jun 15 23:23:11 CEST 2011


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:
dc1c1d48d9 DREAMWEB: added savefiles enumeration


Commit: dc1c1d48d9aee7bbaca7f6643e46ec1228f3ac7f
    https://github.com/scummvm/scummvm/commit/dc1c1d48d9aee7bbaca7f6643e46ec1228f3ac7f
Author: Vladimir Menshakov (whoozle at yandex.ru)
Date: 2011-06-15T14:21:24-07:00

Commit Message:
DREAMWEB: added savefiles enumeration

Changed paths:
    engines/dreamweb/detection.cpp



diff --git a/engines/dreamweb/detection.cpp b/engines/dreamweb/detection.cpp
index 10f727f..fac2fb7 100644
--- a/engines/dreamweb/detection.cpp
+++ b/engines/dreamweb/detection.cpp
@@ -25,11 +25,13 @@
 
 #include "base/plugins.h"
 
-#include "engines/advancedDetector.h"
+#include "common/algorithm.h"
 #include "common/system.h"
 
 #include "dreamweb/dreamweb.h"
 
+#include "engines/advancedDetector.h"
+
 namespace DreamWeb {
 
 struct DreamWebGameDescription {
@@ -70,7 +72,14 @@ public:
 };
 
 bool DreamWebMetaEngine::hasFeature(MetaEngineFeature f) const {
-	return false;
+	switch(f) {
+	case kSupportsListSaves:
+	case kSupportsLoadingDuringStartup:
+	case kSupportsDeleteSave:
+		return true;
+	default:
+		return false;
+	}
 }
 
 bool DreamWeb::DreamWebEngine::hasFeature(EngineFeature f) const {
@@ -86,13 +95,29 @@ bool DreamWebMetaEngine::createInstance(OSystem *syst, Engine **engine, const AD
 }
 
 SaveStateList DreamWebMetaEngine::listSaves(const char *target) const {
-	//Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+	Common::StringArray files = saveFileMan->listSavefiles("DREAMWEB.D??");
+	Common::sort(files.begin(), files.end());
+
 	SaveStateList saveList;
+	for(uint i = 0; i < files.size(); ++i) {
+		const Common::String &file = files[i];
+		Common::InSaveFile *stream = saveFileMan->openForLoading(file);
+		if (!stream)
+			error("cannot open save file %s", file.c_str());
+		char name[13] = {};
+		stream->seek(0x61);
+		stream->read(name, sizeof(name) - 1);
+		delete stream;
+
+		SaveStateDescriptor sd(i, name);
+		saveList.push_back(sd);
+	}
 
 	return saveList;
 }
 
-int DreamWebMetaEngine::getMaximumSaveSlot() const { return 99; }
+int DreamWebMetaEngine::getMaximumSaveSlot() const { return 6; }
 
 void DreamWebMetaEngine::removeSaveState(const char *target, int slot) const {
 }






More information about the Scummvm-git-logs mailing list