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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sun Nov 9 17:13:34 CET 2008


Revision: 34963
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34963&view=rev
Author:   thebluegr
Date:     2008-11-09 16:13:34 +0000 (Sun, 09 Nov 2008)

Log Message:
-----------
- The GMM save dialog is now working for all engines which support the appropriate features
- Added a new method to the MetaEngine class, getMaximumSaveSlot(), and implemented it in all engines for which the listSavefiles() method is implemented (it goes together with the listSavefiles method). It is used to fill the unused save slots in the save/load dialogs of each engine, so that the user can create new save games in empty slots
- Unified the save/load dialog list numbering in the GMM load/save screens and in the load screen of the main menu (before a game is started)

Modified Paths:
--------------
    scummvm/trunk/engines/agi/detection.cpp
    scummvm/trunk/engines/agos/detection.cpp
    scummvm/trunk/engines/cine/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/saga/detection.cpp
    scummvm/trunk/engines/scumm/detection.cpp
    scummvm/trunk/engines/tinsel/detection.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-11-09 16:03:45 UTC (rev 34962)
+++ scummvm/trunk/engines/agi/detection.cpp	2008-11-09 16:13:34 UTC (rev 34963)
@@ -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 int getMaximumSaveSlot() const;
 	virtual void removeSaveState(const char *target, int slot) const;
 	
 	const Common::ADGameDescription *fallbackDetect(const Common::FSList &fslist) const;
@@ -2193,6 +2194,8 @@
 	return saveList;
 }
 
+int AgiMetaEngine::getMaximumSaveSlot() const { return 999; }
+
 void AgiMetaEngine::removeSaveState(const char *target, int slot) const {
 	char extension[6];
 	snprintf(extension, sizeof(extension), ".%03d", slot);

Modified: scummvm/trunk/engines/agos/detection.cpp
===================================================================
--- scummvm/trunk/engines/agos/detection.cpp	2008-11-09 16:03:45 UTC (rev 34962)
+++ scummvm/trunk/engines/agos/detection.cpp	2008-11-09 16:13:34 UTC (rev 34963)
@@ -114,6 +114,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 int getMaximumSaveSlot() const;
 };
 
 bool AgosMetaEngine::hasFeature(MetaEngineFeature f) const {
@@ -191,6 +192,8 @@
 	return saveList;
 }
 
+int AgosMetaEngine::getMaximumSaveSlot() const { return 999; }
+
 #if PLUGIN_ENABLED_DYNAMIC(AGOS)
 	REGISTER_PLUGIN_DYNAMIC(AGOS, PLUGIN_TYPE_ENGINE, AgosMetaEngine);
 #else

Modified: scummvm/trunk/engines/cine/detection.cpp
===================================================================
--- scummvm/trunk/engines/cine/detection.cpp	2008-11-09 16:03:45 UTC (rev 34962)
+++ scummvm/trunk/engines/cine/detection.cpp	2008-11-09 16:13:34 UTC (rev 34963)
@@ -536,6 +536,7 @@
 	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;
+	virtual int getMaximumSaveSlot() const;
 };
 
 bool CineMetaEngine::hasFeature(MetaEngineFeature f) const {
@@ -601,6 +602,8 @@
 	return saveList;
 }
 
+int CineMetaEngine::getMaximumSaveSlot() const { return 9; }
+
 #if PLUGIN_ENABLED_DYNAMIC(CINE)
 	REGISTER_PLUGIN_DYNAMIC(CINE, PLUGIN_TYPE_ENGINE, CineMetaEngine);
 #else

Modified: scummvm/trunk/engines/kyra/detection.cpp
===================================================================
--- scummvm/trunk/engines/kyra/detection.cpp	2008-11-09 16:03:45 UTC (rev 34962)
+++ scummvm/trunk/engines/kyra/detection.cpp	2008-11-09 16:13:34 UTC (rev 34963)
@@ -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;
+	virtual int getMaximumSaveSlot() const;
 	void removeSaveState(const char *target, int slot) const;
 	SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
 };
@@ -1162,6 +1163,8 @@
 	return saveList;
 }
 
+int KyraMetaEngine::getMaximumSaveSlot() const { return 999; }
+
 void KyraMetaEngine::removeSaveState(const char *target, int slot) const {
 	// Slot 0 can't be deleted, it's for restarting the game(s)
 	if (slot == 0)

Modified: scummvm/trunk/engines/lure/detection.cpp
===================================================================
--- scummvm/trunk/engines/lure/detection.cpp	2008-11-09 16:03:45 UTC (rev 34962)
+++ scummvm/trunk/engines/lure/detection.cpp	2008-11-09 16:13:34 UTC (rev 34963)
@@ -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 int getMaximumSaveSlot() const;
 	virtual void removeSaveState(const char *target, int slot) const;
 };
 
@@ -239,6 +240,8 @@
 	return saveList;
 }
 
+int LureMetaEngine::getMaximumSaveSlot() const { return 999; }
+
 void LureMetaEngine::removeSaveState(const char *target, int slot) const {
 	char extension[6];
 	snprintf(extension, sizeof(extension), ".%03d", slot);

Modified: scummvm/trunk/engines/metaengine.h
===================================================================
--- scummvm/trunk/engines/metaengine.h	2008-11-09 16:03:45 UTC (rev 34962)
+++ scummvm/trunk/engines/metaengine.h	2008-11-09 16:13:34 UTC (rev 34963)
@@ -125,6 +125,13 @@
 		return SaveStateDescriptor();
 	}
 
+	/**
+	 * Gets the maximum save slot that the engine supports
+	 */
+	virtual int getMaximumSaveSlot() const {
+		return 0;
+	}
+
 	/** @name MetaEngineFeature flags */
 	//@{
 	

Modified: scummvm/trunk/engines/parallaction/detection.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/detection.cpp	2008-11-09 16:03:45 UTC (rev 34962)
+++ scummvm/trunk/engines/parallaction/detection.cpp	2008-11-09 16:13:34 UTC (rev 34963)
@@ -247,6 +247,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 int getMaximumSaveSlot() const;
 	virtual void removeSaveState(const char *target, int slot) const;
 };
 
@@ -308,6 +309,8 @@
 	return saveList;
 }
 
+int ParallactionMetaEngine::getMaximumSaveSlot() const { return 99; }
+
 void ParallactionMetaEngine::removeSaveState(const char *target, int slot) const {
 	char extension[6];
 	snprintf(extension, sizeof(extension), ".0%02d", slot);

Modified: scummvm/trunk/engines/saga/detection.cpp
===================================================================
--- scummvm/trunk/engines/saga/detection.cpp	2008-11-09 16:03:45 UTC (rev 34962)
+++ scummvm/trunk/engines/saga/detection.cpp	2008-11-09 16:13:34 UTC (rev 34963)
@@ -151,6 +151,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 int getMaximumSaveSlot() const;
 	virtual void removeSaveState(const char *target, int slot) const;
 };
 
@@ -200,23 +201,15 @@
 				in->read(saveDesc, SAVE_TITLE_SIZE);
 				saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
 				delete in;
-			} else {
-				// handle gaps
-				*saveDesc = 0;
-				saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
 			}
 		}
 	}
 
-	// Fill the rest of the list with empty slots
-	*saveDesc = 0;			
-	for (int i = slotNum + 1; i <= 99; i++) {
-		saveList.push_back(SaveStateDescriptor(i, saveDesc));
-	}
-
 	return saveList;
 }
 
+int SagaMetaEngine::getMaximumSaveSlot() const { return 99; }
+
 void SagaMetaEngine::removeSaveState(const char *target, int slot) const {
 	char extension[6];
 	snprintf(extension, sizeof(extension), ".s%02d", slot);

Modified: scummvm/trunk/engines/scumm/detection.cpp
===================================================================
--- scummvm/trunk/engines/scumm/detection.cpp	2008-11-09 16:03:45 UTC (rev 34962)
+++ scummvm/trunk/engines/scumm/detection.cpp	2008-11-09 16:13:34 UTC (rev 34963)
@@ -685,6 +685,7 @@
 	virtual Common::Error createInstance(OSystem *syst, Engine **engine) const;
 
 	virtual SaveStateList listSaves(const char *target) const;
+	virtual int getMaximumSaveSlot() const;
 	virtual void removeSaveState(const char *target, int slot) const;
 	virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
 };
@@ -961,6 +962,8 @@
 	extern bool getSavegameName(Common::InSaveFile *in, Common::String &desc, int heversion);
 }
 
+int ScummMetaEngine::getMaximumSaveSlot() const { return 99; }
+
 SaveStateList ScummMetaEngine::listSaves(const char *target) const {
 	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
 	Common::StringList filenames;

Modified: scummvm/trunk/engines/tinsel/detection.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/detection.cpp	2008-11-09 16:03:45 UTC (rev 34962)
+++ scummvm/trunk/engines/tinsel/detection.cpp	2008-11-09 16:13:34 UTC (rev 34963)
@@ -343,6 +343,7 @@
 
 	virtual bool hasFeature(MetaEngineFeature f) const;	
 	virtual SaveStateList listSaves(const char *target) const;
+	virtual int getMaximumSaveSlot() const;
 };
 
 bool TinselMetaEngine::hasFeature(MetaEngineFeature f) const {
@@ -367,6 +368,7 @@
 	return saveList;
 }
 
+int TinselMetaEngine::getMaximumSaveSlot() const { return 999; }
 
 bool TinselMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const {
 	const Tinsel::TinselGameDescription *gd = (const Tinsel::TinselGameDescription *)desc;

Modified: scummvm/trunk/engines/touche/detection.cpp
===================================================================
--- scummvm/trunk/engines/touche/detection.cpp	2008-11-09 16:03:45 UTC (rev 34962)
+++ scummvm/trunk/engines/touche/detection.cpp	2008-11-09 16:13:34 UTC (rev 34963)
@@ -140,6 +140,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 int getMaximumSaveSlot() const;
 	virtual void removeSaveState(const char *target, int slot) const;
 };
 
@@ -214,6 +215,8 @@
 	return saveList;
 }
 
+int ToucheMetaEngine::getMaximumSaveSlot() const { return 99; }
+
 void ToucheMetaEngine::removeSaveState(const char *target, int slot) const {
 	char extension[5];
 	snprintf(extension, sizeof(extension), ".%d", slot);

Modified: scummvm/trunk/gui/launcher.cpp
===================================================================
--- scummvm/trunk/gui/launcher.cpp	2008-11-09 16:03:45 UTC (rev 34962)
+++ scummvm/trunk/gui/launcher.cpp	2008-11-09 16:13:34 UTC (rev 34963)
@@ -483,7 +483,7 @@
 
 	// Add choice list
 	_list = new GUI::ListWidget(this, "ScummSaveLoad.List");
-	_list->setNumberingMode(GUI::kListNumberingOff);
+	setSaveMode(false);
 	
 	_gfxWidget = new GUI::GraphicsWidget(this, 0, 0, 10, 10);
 
@@ -541,7 +541,7 @@
 
 void SaveLoadChooser::setSaveMode(bool saveMode) {
 	_list->setEditable(saveMode);
-	_list->setNumberingMode(saveMode ? GUI::kListNumberingOne : GUI::kListNumberingZero);
+	_list->setNumberingMode(GUI::kListNumberingOne);
 }
 
 void SaveLoadChooser::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
@@ -738,10 +738,18 @@
 void SaveLoadChooser::updateSaveList() {
 	_saveList = (*_plugin)->listSaves(_target.c_str());
 
+	int curSlot = 0;
 	StringList saveNames;
 	for (SaveStateList::const_iterator x = _saveList.begin(); x != _saveList.end(); ++x) {
 		saveNames.push_back(x->description());
+		curSlot++;
 	}
+
+	// Fill the rest of the save slots with empty saves
+	Common::String emptyDesc;
+	for (int i = curSlot + 1; i <= (*_plugin)->getMaximumSaveSlot(); i++)
+		saveNames.push_back(emptyDesc);
+
 	_list->setList(saveNames);
 }
 


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