[Scummvm-cvs-logs] SF.net SVN: scummvm:[34263] scummvm/trunk/engines/tinsel

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Sep 1 23:13:12 CEST 2008


Revision: 34263
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34263&view=rev
Author:   fingolfin
Date:     2008-09-01 21:13:11 +0000 (Mon, 01 Sep 2008)

Log Message:
-----------
TINSEL: Enabled listSaves support

Modified Paths:
--------------
    scummvm/trunk/engines/tinsel/detection.cpp
    scummvm/trunk/engines/tinsel/saveload.cpp
    scummvm/trunk/engines/tinsel/tinsel.cpp
    scummvm/trunk/engines/tinsel/tinsel.h

Modified: scummvm/trunk/engines/tinsel/detection.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/detection.cpp	2008-09-01 21:06:32 UTC (rev 34262)
+++ scummvm/trunk/engines/tinsel/detection.cpp	2008-09-01 21:13:11 UTC (rev 34263)
@@ -29,6 +29,7 @@
 #include "common/file.h"
 
 #include "tinsel/tinsel.h"
+#include "tinsel/savescn.h"	// needed by TinselMetaEngine::listSaves
 
 
 namespace Tinsel {
@@ -309,13 +310,42 @@
 	}
 
 	virtual const char *getCopyright() const {
+		// FIXME: Bad copyright string.
+		// Should be something like "Tinsel (C) Psygnosis" or so... ???
 		return "Tinsel Engine";
 	}
 
 	virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
 
+	virtual bool hasFeature(MetaEngineFeature f) const;	
+	virtual SaveStateList listSaves(const char *target) const;
 };
 
+bool TinselMetaEngine::hasFeature(MetaEngineFeature f) const {
+	return
+		(f == kSupportsListSaves);
+}
+
+namespace Tinsel {
+extern int getList(Common::SaveFileManager *saveFileMan, const Common::String &target);
+}
+
+SaveStateList TinselMetaEngine::listSaves(const char *target) const {
+	int numStates = Tinsel::getList(g_system->getSavefileManager(), target);
+
+	SaveStateList saveList;
+	for (int i = 0; i < numStates; i++) {
+		SaveStateDescriptor sd(i,
+				Tinsel::ListEntry(i, Tinsel::LE_DESC),
+				Tinsel::ListEntry(i, Tinsel::LE_NAME));
+		// TODO: Also add savedFiles[i].dateTime to the SaveStateDescriptor
+		saveList.push_back(sd);
+	}
+
+	return saveList;
+}
+
+
 bool TinselMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const {
 	const Tinsel::TinselGameDescription *gd = (const Tinsel::TinselGameDescription *)desc;
 	if (gd) {

Modified: scummvm/trunk/engines/tinsel/saveload.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/saveload.cpp	2008-09-01 21:06:32 UTC (rev 34262)
+++ scummvm/trunk/engines/tinsel/saveload.cpp	2008-09-01 21:13:11 UTC (rev 34263)
@@ -246,16 +246,11 @@
  * Store the file details, ordered by time, in savedFiles[] and return
  * the number of files found).
  */
-int getList(void) {
-	// No change since last call?
-	// TODO/FIXME: Just always reload this data? Be careful about slow downs!!!
-	if (!NeedLoad)
-		return numSfiles;
-
+int getList(Common::SaveFileManager *saveFileMan, const Common::String &target) {
 	int i;
 
-	const Common::String pattern = _vm->getSavegamePattern();
-	Common::StringList files = _vm->getSaveFileMan()->listSavefiles(pattern.c_str());
+	const Common::String pattern = target +  ".???";
+	Common::StringList files = saveFileMan->listSavefiles(pattern.c_str());
 
 	numSfiles = 0;
 
@@ -264,7 +259,7 @@
 			break;
 
 		const Common::String &fname = *file;
-		Common::InSaveFile *f = _vm->getSaveFileMan()->openForLoading(fname.c_str());
+		Common::InSaveFile *f = saveFileMan->openForLoading(fname.c_str());
 		if (f == NULL) {
 			continue;
 		}
@@ -304,7 +299,16 @@
 	return numSfiles;
 }
 
+int getList(void) {
+	// No change since last call?
+	// TODO/FIXME: Just always reload this data? Be careful about slow downs!!!
+	if (!NeedLoad)
+		return numSfiles;
 
+	return getList(_vm->getSaveFileMan(), _vm->getTargetName());
+}
+
+
 char *ListEntry(int i, letype which) {
 	if (i == -1)
 		i = numSfiles;

Modified: scummvm/trunk/engines/tinsel/tinsel.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/tinsel.cpp	2008-09-01 21:06:32 UTC (rev 34262)
+++ scummvm/trunk/engines/tinsel/tinsel.cpp	2008-09-01 21:13:11 UTC (rev 34263)
@@ -710,10 +710,6 @@
 	return 0;
 }
 
-Common::String TinselEngine::getSavegamePattern() const {
-	return _targetName + ".???";
-}
-
 Common::String TinselEngine::getSavegameFilename(int16 saveNum) const {
 	char filename[256];
 	snprintf(filename, 256, "%s.%03d", getTargetName().c_str(), saveNum);

Modified: scummvm/trunk/engines/tinsel/tinsel.h
===================================================================
--- scummvm/trunk/engines/tinsel/tinsel.h	2008-09-01 21:06:32 UTC (rev 34262)
+++ scummvm/trunk/engines/tinsel/tinsel.h	2008-09-01 21:13:11 UTC (rev 34263)
@@ -127,7 +127,6 @@
 
 public:
 	const Common::String getTargetName() const { return _targetName; }
-	Common::String getSavegamePattern() const;
 	Common::String getSavegameFilename(int16 saveNum) const;
 	Common::SaveFileManager *getSaveFileMan() { return _saveFileMan; }
 	Graphics::Surface &screen() { return _screenSurface; }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list