[Scummvm-cvs-logs] SF.net SVN: scummvm:[33395] scummvm/branches/gsoc2008-rtl/engines/sword1/ sword1.cpp

cpage88 at users.sourceforge.net cpage88 at users.sourceforge.net
Tue Jul 29 06:51:23 CEST 2008


Revision: 33395
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33395&view=rev
Author:   cpage88
Date:     2008-07-29 04:51:23 +0000 (Tue, 29 Jul 2008)

Log Message:
-----------
Added --list-saves support for SWORD1

Modified Paths:
--------------
    scummvm/branches/gsoc2008-rtl/engines/sword1/sword1.cpp

Modified: scummvm/branches/gsoc2008-rtl/engines/sword1/sword1.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/sword1/sword1.cpp	2008-07-29 04:06:10 UTC (rev 33394)
+++ scummvm/branches/gsoc2008-rtl/engines/sword1/sword1.cpp	2008-07-29 04:51:23 UTC (rev 33395)
@@ -32,6 +32,7 @@
 #include "common/fs.h"
 #include "common/timer.h"
 #include "common/events.h"
+#include "common/savefile.h"
 #include "common/system.h"
 
 #include "engines/metaengine.h"
@@ -97,6 +98,7 @@
 	virtual GameList getSupportedGames() const;
 	virtual GameDescriptor findGame(const char *gameid) const;
 	virtual GameList detectGames(const FSList &fslist) const;
+	virtual SaveStateList listSaves(const char *target) const;
 
 	virtual PluginError createInstance(OSystem *syst, Engine **engine) const;
 };
@@ -187,6 +189,39 @@
 	return kNoError;
 }
 
+SaveStateList SwordMetaEngine::listSaves(const char *target) const {
+	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+	SaveStateList saveList;
+	Common::InSaveFile *in = saveFileMan->openForLoading("SAVEGAME.INF");
+	if (in) {
+		uint8 stop;
+		char saveDesc[32];
+		int slotNum = 0;
+		do {
+			uint pos = 0;
+			do {
+				stop = in->readByte();
+				if (pos < (sizeof(saveDesc) - 1)) { 	
+					if ((stop == 10) || (stop == 255) || (in->eos())) {
+						saveDesc[pos++] = '\0';
+					}
+					else if (stop >= 32) {
+						saveDesc[pos++] = stop;
+					}
+				}
+			} while ((stop != 10) && (stop != 255) && (!in->eos()));
+			if (saveDesc[0] != 0) {
+				saveList.push_back(SaveStateDescriptor(slotNum, saveDesc, "SAVEGAME.INF"));
+				slotNum++;
+			}
+		} while ((stop != 255) && (!in->eos()));
+	}
+	
+	delete in;
+		
+	return saveList;
+}
+
 #if PLUGIN_ENABLED_DYNAMIC(SWORD1)
 	REGISTER_PLUGIN_DYNAMIC(SWORD1, PLUGIN_TYPE_ENGINE, SwordMetaEngine);
 #else


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