[Scummvm-cvs-logs] SF.net SVN: scummvm:[34495] scummvm/trunk

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Thu Sep 11 21:47:46 CEST 2008


Revision: 34495
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34495&view=rev
Author:   lordhoto
Date:     2008-09-11 19:47:45 +0000 (Thu, 11 Sep 2008)

Log Message:
-----------
Committed my patch #2105593 "Launcher/MetaEngine: Finnished removeSaveState".

Modified Paths:
--------------
    scummvm/trunk/engines/agi/detection.cpp
    scummvm/trunk/engines/kyra/detection.cpp
    scummvm/trunk/engines/lure/detection.cpp
    scummvm/trunk/engines/metaengine.h
    scummvm/trunk/engines/parallaction/detection.cpp
    scummvm/trunk/engines/queen/queen.cpp
    scummvm/trunk/engines/saga/detection.cpp
    scummvm/trunk/engines/scumm/detection.cpp
    scummvm/trunk/engines/sword2/sword2.cpp
    scummvm/trunk/engines/touche/detection.cpp
    scummvm/trunk/gui/launcher.cpp

Modified: scummvm/trunk/engines/agi/detection.cpp
===================================================================
--- scummvm/trunk/engines/agi/detection.cpp	2008-09-11 15:35:56 UTC (rev 34494)
+++ scummvm/trunk/engines/agi/detection.cpp	2008-09-11 19:47:45 UTC (rev 34495)
@@ -2125,6 +2125,7 @@
 	virtual bool hasFeature(MetaEngineFeature f) const;
 	virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
 	virtual SaveStateList listSaves(const char *target) const;
+	virtual void removeSaveState(const char *target, int slot) const;
 	
 	const Common::ADGameDescription *fallbackDetect(const Common::FSList *fslist) const;
 };
@@ -2189,6 +2190,16 @@
 	return saveList;
 }
 
+void AgiMetaEngine::removeSaveState(const char *target, int slot) const {
+	char extension[6];
+	snprintf(extension, sizeof(extension), ".%03d", slot);
+
+	Common::String filename = target;
+	filename += extension;
+
+	g_system->getSavefileManager()->removeSavefile(filename.c_str());
+}
+
 const Common::ADGameDescription *AgiMetaEngine::fallbackDetect(const Common::FSList *fslist) const {
 	typedef Common::HashMap<Common::String, int32> IntMap;
 	IntMap allFiles;

Modified: scummvm/trunk/engines/kyra/detection.cpp
===================================================================
--- scummvm/trunk/engines/kyra/detection.cpp	2008-09-11 15:35:56 UTC (rev 34494)
+++ scummvm/trunk/engines/kyra/detection.cpp	2008-09-11 19:47:45 UTC (rev 34495)
@@ -1067,6 +1067,7 @@
 	bool hasFeature(MetaEngineFeature f) const;
 	bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
 	SaveStateList listSaves(const char *target) const;
+	void removeSaveState(const char *target, int slot) const;
 };
 
 bool KyraMetaEngine::hasFeature(MetaEngineFeature f) const {
@@ -1147,6 +1148,16 @@
 	return saveList;
 }
 
+void KyraMetaEngine::removeSaveState(const char *target, int slot) const {
+	char extension[6];
+	snprintf(extension, sizeof(extension), ".%03d", slot);
+
+	Common::String filename = target;
+	filename += extension;
+
+	g_system->getSavefileManager()->removeSavefile(filename.c_str());
+}
+
 #if PLUGIN_ENABLED_DYNAMIC(KYRA)
 	REGISTER_PLUGIN_DYNAMIC(KYRA, PLUGIN_TYPE_ENGINE, KyraMetaEngine);
 #else

Modified: scummvm/trunk/engines/lure/detection.cpp
===================================================================
--- scummvm/trunk/engines/lure/detection.cpp	2008-09-11 15:35:56 UTC (rev 34494)
+++ scummvm/trunk/engines/lure/detection.cpp	2008-09-11 19:47:45 UTC (rev 34495)
@@ -188,6 +188,7 @@
 	virtual bool hasFeature(MetaEngineFeature f) const;
 	virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
 	virtual SaveStateList listSaves(const char *target) const;
+	virtual void removeSaveState(const char *target, int slot) const;
 };
 
 bool LureMetaEngine::hasFeature(MetaEngineFeature f) const {
@@ -234,6 +235,16 @@
 	return saveList;
 }
 
+void LureMetaEngine::removeSaveState(const char *target, int slot) const {
+	char extension[6];
+	snprintf(extension, sizeof(extension), ".%03d", slot);
+
+	Common::String filename = target;
+	filename += extension;
+
+	g_system->getSavefileManager()->removeSavefile(filename.c_str());
+}
+
 #if PLUGIN_ENABLED_DYNAMIC(LURE)
 	REGISTER_PLUGIN_DYNAMIC(LURE, PLUGIN_TYPE_ENGINE, LureMetaEngine);
 #else

Modified: scummvm/trunk/engines/metaengine.h
===================================================================
--- scummvm/trunk/engines/metaengine.h	2008-09-11 15:35:56 UTC (rev 34494)
+++ scummvm/trunk/engines/metaengine.h	2008-09-11 19:47:45 UTC (rev 34495)
@@ -101,12 +101,10 @@
 	 * For most engines this just amounts to calling _saveFileMan->removeSaveFile().  
 	 * Engines which keep an index file will also update it accordingly.
 	 *
+	 * @param target	name of a config manager target
 	 * @param slot		slot number of the save state to be removed
-	 *
-	 * @todo  This method is currently never called. Rather, LauncherDialog::loadGame
-	 *        directly calls _saveFileMan->removeSaveFile() if kSupportsDeleteSave is set.
 	 */
-	virtual void removeSaveState(int slot) const {};
+	virtual void removeSaveState(const char *target, int slot) const {};
 
 	
 	/** @name MetaEngineFeature flags */

Modified: scummvm/trunk/engines/parallaction/detection.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/detection.cpp	2008-09-11 15:35:56 UTC (rev 34494)
+++ scummvm/trunk/engines/parallaction/detection.cpp	2008-09-11 19:47:45 UTC (rev 34495)
@@ -246,6 +246,7 @@
 	virtual bool hasFeature(MetaEngineFeature f) const;
 	virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
 	virtual SaveStateList listSaves(const char *target) const;
+	virtual void removeSaveState(const char *target, int slot) const;
 };
 
 bool ParallactionMetaEngine::hasFeature(MetaEngineFeature f) const {
@@ -302,6 +303,16 @@
 	return saveList;
 }
 
+void ParallactionMetaEngine::removeSaveState(const char *target, int slot) const {
+	char extension[6];
+	snprintf(extension, sizeof(extension), ".0%02d", slot);
+
+	Common::String filename = target;
+	filename += extension;
+
+	g_system->getSavefileManager()->removeSavefile(filename.c_str());
+}
+
 #if PLUGIN_ENABLED_DYNAMIC(PARALLACTION)
 	REGISTER_PLUGIN_DYNAMIC(PARALLACTION, PLUGIN_TYPE_ENGINE, ParallactionMetaEngine);
 #else

Modified: scummvm/trunk/engines/queen/queen.cpp
===================================================================
--- scummvm/trunk/engines/queen/queen.cpp	2008-09-11 15:35:56 UTC (rev 34494)
+++ scummvm/trunk/engines/queen/queen.cpp	2008-09-11 19:47:45 UTC (rev 34495)
@@ -65,6 +65,7 @@
 	virtual GameDescriptor findGame(const char *gameid) const;
 	virtual GameList detectGames(const Common::FSList &fslist) const;
 	virtual SaveStateList listSaves(const char *target) const;
+	virtual void removeSaveState(const char *target, int slot) const;
 
 	virtual PluginError createInstance(OSystem *syst, Engine **engine) const;
 };
@@ -161,6 +162,16 @@
 	return saveList;
 }
 
+void QueenMetaEngine::removeSaveState(const char *target, int slot) const {
+	char extension[6];
+	snprintf(extension, sizeof(extension), ".s%02d", slot);
+
+	Common::String filename = target;
+	filename += extension;
+
+	g_system->getSavefileManager()->removeSavefile(filename.c_str());
+}
+
 PluginError QueenMetaEngine::createInstance(OSystem *syst, Engine **engine) const {
 	assert(engine);
 	*engine = new Queen::QueenEngine(syst);

Modified: scummvm/trunk/engines/saga/detection.cpp
===================================================================
--- scummvm/trunk/engines/saga/detection.cpp	2008-09-11 15:35:56 UTC (rev 34494)
+++ scummvm/trunk/engines/saga/detection.cpp	2008-09-11 19:47:45 UTC (rev 34495)
@@ -150,6 +150,7 @@
 	virtual bool hasFeature(MetaEngineFeature f) const;
 	virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
 	virtual SaveStateList listSaves(const char *target) const;
+	virtual void removeSaveState(const char *target, int slot) const;
 };
 
 bool SagaMetaEngine::hasFeature(MetaEngineFeature f) const {
@@ -198,6 +199,16 @@
 	return saveList;
 }
 
+void SagaMetaEngine::removeSaveState(const char *target, int slot) const {
+	char extension[6];
+	snprintf(extension, sizeof(extension), ".s%02d", slot);
+
+	Common::String filename = target;
+	filename += extension;
+
+	g_system->getSavefileManager()->removeSavefile(filename.c_str());
+}
+
 #if PLUGIN_ENABLED_DYNAMIC(SAGA)
 	REGISTER_PLUGIN_DYNAMIC(SAGA, PLUGIN_TYPE_ENGINE, SagaMetaEngine);
 #else

Modified: scummvm/trunk/engines/scumm/detection.cpp
===================================================================
--- scummvm/trunk/engines/scumm/detection.cpp	2008-09-11 15:35:56 UTC (rev 34494)
+++ scummvm/trunk/engines/scumm/detection.cpp	2008-09-11 19:47:45 UTC (rev 34495)
@@ -682,6 +682,7 @@
 	virtual PluginError createInstance(OSystem *syst, Engine **engine) const;
 
 	virtual SaveStateList listSaves(const char *target) const;
+	virtual void removeSaveState(const char *target, int slot) const;
 };
 
 bool ScummMetaEngine::hasFeature(MetaEngineFeature f) const {
@@ -975,6 +976,16 @@
 	return saveList;
 }
 
+void ScummMetaEngine::removeSaveState(const char *target, int slot) const {
+	char extension[6];
+	snprintf(extension, sizeof(extension), ".s%02d", slot);
+
+	Common::String filename = target;
+	filename += extension;
+
+	g_system->getSavefileManager()->removeSavefile(filename.c_str());
+}
+
 #if PLUGIN_ENABLED_DYNAMIC(SCUMM)
 	REGISTER_PLUGIN_DYNAMIC(SCUMM, PLUGIN_TYPE_ENGINE, ScummMetaEngine);
 #else

Modified: scummvm/trunk/engines/sword2/sword2.cpp
===================================================================
--- scummvm/trunk/engines/sword2/sword2.cpp	2008-09-11 15:35:56 UTC (rev 34494)
+++ scummvm/trunk/engines/sword2/sword2.cpp	2008-09-11 19:47:45 UTC (rev 34495)
@@ -85,6 +85,7 @@
 	virtual GameDescriptor findGame(const char *gameid) const;
 	virtual GameList detectGames(const Common::FSList &fslist) const;
 	virtual SaveStateList listSaves(const char *target) const;
+	virtual void removeSaveState(const char *target, int slot) const;
 
 	virtual PluginError createInstance(OSystem *syst, Engine **engine) const;
 };
@@ -196,6 +197,16 @@
 	return saveList;
 }
 
+void Sword2MetaEngine::removeSaveState(const char *target, int slot) const {
+	char extension[6];
+	snprintf(extension, sizeof(extension), ".%03d", slot);
+
+	Common::String filename = target;
+	filename += extension;
+
+	g_system->getSavefileManager()->removeSavefile(filename.c_str());
+}
+
 PluginError Sword2MetaEngine::createInstance(OSystem *syst, Engine **engine) const {
 	assert(syst);
 	assert(engine);

Modified: scummvm/trunk/engines/touche/detection.cpp
===================================================================
--- scummvm/trunk/engines/touche/detection.cpp	2008-09-11 15:35:56 UTC (rev 34494)
+++ scummvm/trunk/engines/touche/detection.cpp	2008-09-11 19:47:45 UTC (rev 34495)
@@ -139,6 +139,7 @@
 	virtual bool hasFeature(MetaEngineFeature f) const;
 	virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
 	virtual SaveStateList listSaves(const char *target) const;
+	virtual void removeSaveState(const char *target, int slot) const;
 };
 
 bool ToucheMetaEngine::hasFeature(MetaEngineFeature f) const {
@@ -208,6 +209,16 @@
 	return saveList;
 }
 
+void ToucheMetaEngine::removeSaveState(const char *target, int slot) const {
+	char extension[5];
+	snprintf(extension, sizeof(extension), ".%d", slot);
+
+	Common::String filename = target;
+	filename += extension;
+
+	g_system->getSavefileManager()->removeSavefile(filename.c_str());
+}
+
 #if PLUGIN_ENABLED_DYNAMIC(TOUCHE)
 	REGISTER_PLUGIN_DYNAMIC(TOUCHE, PLUGIN_TYPE_ENGINE, ToucheMetaEngine);
 #else

Modified: scummvm/trunk/gui/launcher.cpp
===================================================================
--- scummvm/trunk/gui/launcher.cpp	2008-09-11 15:35:56 UTC (rev 34494)
+++ scummvm/trunk/gui/launcher.cpp	2008-09-11 19:47:45 UTC (rev 34495)
@@ -940,7 +940,6 @@
 }
 
 void LauncherDialog::loadGame(int item) {
-	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
 	String gameId = ConfMan.get("gameid", _domains[item]);
 	if (gameId.empty())
 		gameId = _domains[item];
@@ -956,8 +955,7 @@
 		bool delSupport = (*plugin)->hasFeature(MetaEngine::kSupportsDeleteSave);
 
 		if ((*plugin)->hasFeature(MetaEngine::kSupportsListSaves) && 
-			(*plugin)->hasFeature(MetaEngine::kSupportsDirectLoad)) 
-		{
+			(*plugin)->hasFeature(MetaEngine::kSupportsDirectLoad)) {
 			do {
 				Common::StringList saveNames = generateSavegameList(item, plugin);
 				_loadDialog->setList(saveNames);
@@ -971,14 +969,12 @@
 						MessageDialog alert("Do you really want to delete this savegame?", 
 									"Delete", "Cancel");
 						if (alert.runModal() == GUI::kMessageOK) {
-							saveFileMan->removeSavefile(filename.c_str());
-						  	if ((saveList.size() - 1) == 0) {
-								//ConfMan.setInt("save_slot", -1);
-							}
+							(*plugin)->removeSaveState(description.c_str(), atoi(saveList[idx].save_slot().c_str()));
+						  	/*if ((saveList.size() - 1) == 0) {
+								ConfMan.setInt("save_slot", -1);
+							}*/
 						}
-					}
-					// Load the savegame
-					else {
+					} else { // Load the savegame
 						int slot = atoi(saveList[idx].save_slot().c_str());
 						//const char *file = saveList[idx].filename().c_str();
 						//printf("Loading slot: %d\n", slot);
@@ -988,8 +984,7 @@
 						close();
 					}
 				}
-			}
-			while (_loadDialog->delSave());
+			} while (_loadDialog->delSave());
 		} else {
 			MessageDialog dialog
 				("Sorry, this game does not yet support loading games from the launcher.", "OK");


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