[Scummvm-cvs-logs] SF.net SVN: scummvm:[33391] scummvm/branches/gsoc2008-rtl/engines/saga/ detection.cpp
cpage88 at users.sourceforge.net
cpage88 at users.sourceforge.net
Tue Jul 29 04:12:07 CEST 2008
Revision: 33391
http://scummvm.svn.sourceforge.net/scummvm/?rev=33391&view=rev
Author: cpage88
Date: 2008-07-29 02:12:07 +0000 (Tue, 29 Jul 2008)
Log Message:
-----------
Added --list-saves support for SAGA
Modified Paths:
--------------
scummvm/branches/gsoc2008-rtl/engines/saga/detection.cpp
Modified: scummvm/branches/gsoc2008-rtl/engines/saga/detection.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/saga/detection.cpp 2008-07-29 01:52:29 UTC (rev 33390)
+++ scummvm/branches/gsoc2008-rtl/engines/saga/detection.cpp 2008-07-29 02:12:07 UTC (rev 33391)
@@ -148,6 +148,7 @@
}
virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
+ virtual SaveStateList listSaves(const char *target) const;
};
bool SagaMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const {
@@ -158,6 +159,36 @@
return gd != 0;
}
+SaveStateList SagaMetaEngine::listSaves(const char *target) const {
+ Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+ Common::StringList filenames;
+ char saveDesc[SAVE_TITLE_SIZE];
+ Common::String pattern = target;
+ pattern += ".s??";
+
+ filenames = saveFileMan->listSavefiles(pattern.c_str());
+ sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
+
+ SaveStateList saveList;
+ for (Common::StringList::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);
+
+ if (slotNum >= 0 && slotNum <= 99) {
+ Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
+ if (in) {
+ for (int i = 0; i < 3; i++)
+ in->readUint32BE();
+ in->read(saveDesc, SAVE_TITLE_SIZE);
+ saveList.push_back(SaveStateDescriptor(slotNum, saveDesc, *file));
+ delete in;
+ }
+ }
+ }
+
+ return saveList;
+}
+
#if PLUGIN_ENABLED_DYNAMIC(SAGA)
REGISTER_PLUGIN_DYNAMIC(SAGA, PLUGIN_TYPE_ENGINE, SagaMetaEngine);
#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