diff options
| -rw-r--r-- | engines/agi/detection.cpp | 11 | ||||
| -rw-r--r-- | engines/kyra/detection.cpp | 11 | ||||
| -rw-r--r-- | engines/lure/detection.cpp | 11 | ||||
| -rw-r--r-- | engines/metaengine.h | 6 | ||||
| -rw-r--r-- | engines/parallaction/detection.cpp | 11 | ||||
| -rw-r--r-- | engines/queen/queen.cpp | 11 | ||||
| -rw-r--r-- | engines/saga/detection.cpp | 11 | ||||
| -rw-r--r-- | engines/scumm/detection.cpp | 11 | ||||
| -rw-r--r-- | engines/sword2/sword2.cpp | 11 | ||||
| -rw-r--r-- | engines/touche/detection.cpp | 11 | ||||
| -rw-r--r-- | gui/launcher.cpp | 19 | 
11 files changed, 108 insertions, 16 deletions
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp index 9caf09fd28..2b2d7e080b 100644 --- a/engines/agi/detection.cpp +++ b/engines/agi/detection.cpp @@ -2125,6 +2125,7 @@ public:  	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 @@ SaveStateList AgiMetaEngine::listSaves(const char *target) const {  	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; diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp index c19db16d36..ccddbeb64c 100644 --- a/engines/kyra/detection.cpp +++ b/engines/kyra/detection.cpp @@ -1067,6 +1067,7 @@ public:  	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 @@ SaveStateList KyraMetaEngine::listSaves(const char *target) const {  	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 diff --git a/engines/lure/detection.cpp b/engines/lure/detection.cpp index ccfa26fadc..163d095243 100644 --- a/engines/lure/detection.cpp +++ b/engines/lure/detection.cpp @@ -188,6 +188,7 @@ public:  	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 @@ SaveStateList LureMetaEngine::listSaves(const char *target) const {  	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 diff --git a/engines/metaengine.h b/engines/metaengine.h index bf640815a6..b6fa21fd5f 100644 --- a/engines/metaengine.h +++ b/engines/metaengine.h @@ -101,12 +101,10 @@ public:  	 * 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 */ diff --git a/engines/parallaction/detection.cpp b/engines/parallaction/detection.cpp index aae17d32e1..d2444c642e 100644 --- a/engines/parallaction/detection.cpp +++ b/engines/parallaction/detection.cpp @@ -246,6 +246,7 @@ public:  	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 @@ SaveStateList ParallactionMetaEngine::listSaves(const char *target) const {  	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 diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp index a73eedaf4f..6cdd020b8f 100644 --- a/engines/queen/queen.cpp +++ b/engines/queen/queen.cpp @@ -65,6 +65,7 @@ public:  	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 @@ SaveStateList QueenMetaEngine::listSaves(const char *target) const {  	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); diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp index cc9ba34cdc..a31e9b755a 100644 --- a/engines/saga/detection.cpp +++ b/engines/saga/detection.cpp @@ -150,6 +150,7 @@ public:  	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 @@ SaveStateList SagaMetaEngine::listSaves(const char *target) const {  	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 diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index 2a6e0c0b10..1062e77114 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -682,6 +682,7 @@ public:  	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 @@ SaveStateList ScummMetaEngine::listSaves(const char *target) const {  	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 diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp index 390db0d275..dc884eaacb 100644 --- a/engines/sword2/sword2.cpp +++ b/engines/sword2/sword2.cpp @@ -85,6 +85,7 @@ public:  	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 @@ SaveStateList Sword2MetaEngine::listSaves(const char *target) const {  	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); diff --git a/engines/touche/detection.cpp b/engines/touche/detection.cpp index 89655ac9ab..bbc605ba46 100644 --- a/engines/touche/detection.cpp +++ b/engines/touche/detection.cpp @@ -139,6 +139,7 @@ public:  	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 @@ SaveStateList ToucheMetaEngine::listSaves(const char *target) const {  	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 diff --git a/gui/launcher.cpp b/gui/launcher.cpp index b85b34e3d4..7656e467e7 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -940,7 +940,6 @@ void LauncherDialog::editGame(int item) {  }  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 @@ void LauncherDialog::loadGame(int item) {  		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 @@ void LauncherDialog::loadGame(int item) {  						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 @@ void LauncherDialog::loadGame(int item) {  						close();  					}  				} -			} -			while (_loadDialog->delSave()); +			} while (_loadDialog->delSave());  		} else {  			MessageDialog dialog  				("Sorry, this game does not yet support loading games from the launcher.", "OK");  | 
