[Scummvm-cvs-logs] SF.net SVN: scummvm:[33422] scummvm/branches/gsoc2008-rtl/engines/cine/ detection.cpp

cpage88 at users.sourceforge.net cpage88 at users.sourceforge.net
Tue Jul 29 21:01:18 CEST 2008


Revision: 33422
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33422&view=rev
Author:   cpage88
Date:     2008-07-29 19:01:17 +0000 (Tue, 29 Jul 2008)

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

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

Modified: scummvm/branches/gsoc2008-rtl/engines/cine/detection.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/cine/detection.cpp	2008-07-29 17:58:39 UTC (rev 33421)
+++ scummvm/branches/gsoc2008-rtl/engines/cine/detection.cpp	2008-07-29 19:01:17 UTC (rev 33422)
@@ -499,6 +499,7 @@
 	}
 
 	virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
+	virtual SaveStateList listSaves(const char *target) const;
 };
 
 bool CineMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const {
@@ -509,6 +510,41 @@
 	return gd != 0;
 }
 
+SaveStateList CineMetaEngine::listSaves(const char *target) const {
+	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+	SaveStateList saveList;
+	Common::String filename = target;
+	filename += ".dir";
+	Common::InSaveFile *in = saveFileMan->openForLoading(filename.c_str());
+	if (in) {
+		int8 ch;
+		int slotNum = 0;
+		char saveDesc[20];
+		do {
+			uint pos = 0;
+			do {
+				ch = in->readByte();
+				if (pos < (sizeof(saveDesc) - 1)) {
+					if (ch < 32 || in->eos()) {
+						saveDesc[pos++] = '\0';
+					} 
+					else if (ch >= 32) {
+						saveDesc[pos++] = ch;
+					}
+				}
+			} while (ch >= 32 && !in->eos());
+			if (saveDesc[0] != 0) {
+				saveList.push_back(SaveStateDescriptor(slotNum, Common::String(saveDesc), filename));
+				slotNum++;
+			}
+		} while (!in->eos());
+	}
+
+	delete in;
+
+	return saveList;
+}
+
 #if PLUGIN_ENABLED_DYNAMIC(CINE)
 	REGISTER_PLUGIN_DYNAMIC(CINE, PLUGIN_TYPE_ENGINE, CineMetaEngine);
 #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