[Scummvm-cvs-logs] scummvm master -> 6544a05bf83ceea3dbde9bfa2bfdd1e8f001d25d

bluegr md5 at scummvm.org
Thu Apr 19 10:01:40 CEST 2012


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
9e5015e631 DRASCULA: added list saves support
9c70954f64 DRASCULA: listSaves handles unsynced save index
6544a05bf8 Merge pull request #228 from upthorn/master


Commit: 9e5015e631ed070b6a500fac1734b6a4e8c04fea
    https://github.com/scummvm/scummvm/commit/9e5015e631ed070b6a500fac1734b6a4e8c04fea
Author: upthorn (upthorn at gmail.com)
Date: 2012-04-15T11:09:15-07:00

Commit Message:
DRASCULA: added list saves support

Added kSupportsListSaves to DrasculaMetaEngine::hasFeature
Added working listSaves to DrasculaMetaEngine

Changed paths:
    engines/drascula/detection.cpp



diff --git a/engines/drascula/detection.cpp b/engines/drascula/detection.cpp
index 3310ac0..07f1634 100644
--- a/engines/drascula/detection.cpp
+++ b/engines/drascula/detection.cpp
@@ -23,6 +23,7 @@
 #include "base/plugins.h"
 
 #include "engines/advancedDetector.h"
+#include "engines/savestate.h"
 #include "common/file.h"
 
 #include "drascula/drascula.h"
@@ -271,6 +272,59 @@ public:
 		_guioptions = GUIO2(GUIO_NOMIDI, GUIO_NOLAUNCHLOAD);
 	}
 
+	virtual bool hasFeature(MetaEngineFeature f) const {
+		return (f == kSupportsListSaves);
+	}
+
+	virtual SaveStateList listSaves(const char *target) const {
+		Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+		Common::String pattern = Common::String::format("%s??", target);
+
+		// Get list of savefiles for target game
+		Common::StringArray filenames = saveFileMan->listSavefiles(pattern);
+		Common::Array<int> slots;
+		for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
+		
+			// Obtain the last 2 digits of the filename, since they correspond to the save slot
+			int slotNum = atoi(file->c_str() + file->size() - 2);
+
+			// Ensure save slot is within valid range
+			if (slotNum >= 1 && slotNum <= 10) {
+				slots.push_back(slotNum);
+			}
+		}
+
+		// Sort save slot ids
+		Common::sort<int>(slots.begin(), slots.end());
+
+		// Load save index
+		Common::String fileEpa = Common::String::format("%s.epa", target);
+		Common::InSaveFile *epa = saveFileMan->openForLoading(fileEpa); 
+
+		// Get savegame names from index
+		Common::String saveDesc;
+		SaveStateList saveList;
+		int line = 1;
+		for (size_t i = 0; i < slots.size(); i++) {
+
+			// ignore lines corresponding to unused saveslots
+			for (; line < slots[i]; line++) 
+				epa->readLine(); 
+
+			// copy the name in the line corresponding to the save slot and truncate to 22 characters
+			saveDesc = Common::String(epa->readLine().c_str(), 22);
+
+			// increment line number to keep it in sync with slot number
+			line++;	
+			
+			// Insert savegame name into list
+			saveList.push_back(SaveStateDescriptor(slots[i], saveDesc));
+		}
+		delete epa;
+
+		return saveList;
+	}
+
 	virtual const char *getName() const {
 		return "Drascula";
 	}


Commit: 9c70954f648d86863e260d0b174afd8749319338
    https://github.com/scummvm/scummvm/commit/9c70954f648d86863e260d0b174afd8749319338
Author: upthorn (upthorn at gmail.com)
Date: 2012-04-16T13:52:36-07:00

Commit Message:
DRASCULA: listSaves handles unsynced save index

This is a situation that would occur when a user copies drscula save
files from one device to another, without copying the corresponding
index, or copies the index without all corresponding save files.

Changed paths:
    engines/drascula/detection.cpp



diff --git a/engines/drascula/detection.cpp b/engines/drascula/detection.cpp
index 07f1634..6e38d49 100644
--- a/engines/drascula/detection.cpp
+++ b/engines/drascula/detection.cpp
@@ -306,7 +306,6 @@ public:
 		SaveStateList saveList;
 		int line = 1;
 		for (size_t i = 0; i < slots.size(); i++) {
-
 			// ignore lines corresponding to unused saveslots
 			for (; line < slots[i]; line++) 
 				epa->readLine(); 
@@ -314,6 +313,10 @@ public:
 			// copy the name in the line corresponding to the save slot and truncate to 22 characters
 			saveDesc = Common::String(epa->readLine().c_str(), 22);
 
+			// handle cases where the save directory and save index are detectably out of sync
+			if (saveDesc == "*") 
+				saveDesc = "No name specified.";
+
 			// increment line number to keep it in sync with slot number
 			line++;	
 			


Commit: 6544a05bf83ceea3dbde9bfa2bfdd1e8f001d25d
    https://github.com/scummvm/scummvm/commit/6544a05bf83ceea3dbde9bfa2bfdd1e8f001d25d
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-04-19T01:01:16-07:00

Commit Message:
Merge pull request #228 from upthorn/master

DrasculaMetaEngine: added list saves support

Changed paths:
    engines/drascula/detection.cpp









More information about the Scummvm-git-logs mailing list