aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Page2008-07-29 19:01:17 +0000
committerChristopher Page2008-07-29 19:01:17 +0000
commita1e3d416fe3e77b5ceff7bea43b8bb0453290e5a (patch)
tree32ab358ea9b3c58b54217b54033c99dc8250f8b0
parent50b7e5aa0d7f7df3b750ed683a9e5fed83b91ce7 (diff)
downloadscummvm-rg350-a1e3d416fe3e77b5ceff7bea43b8bb0453290e5a.tar.gz
scummvm-rg350-a1e3d416fe3e77b5ceff7bea43b8bb0453290e5a.tar.bz2
scummvm-rg350-a1e3d416fe3e77b5ceff7bea43b8bb0453290e5a.zip
Added --list-saves support for CINE
svn-id: r33422
-rw-r--r--engines/cine/detection.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp
index 8c940bcfd4..899e4c4754 100644
--- a/engines/cine/detection.cpp
+++ b/engines/cine/detection.cpp
@@ -499,6 +499,7 @@ public:
}
virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
+ virtual SaveStateList listSaves(const char *target) const;
};
bool CineMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const {
@@ -509,6 +510,41 @@ bool CineMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common
return gd != 0;
}
+SaveStateList CineMetaEngine::listSaves(const char *target) const {
+ Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+ SaveStateList saveList;
+ Common::String filename = target;
+ filename += ".dir";
+ Common::InSaveFile *in = saveFileMan->openForLoading(filename.c_str());
+ if (in) {
+ int8 ch;
+ int slotNum = 0;
+ char saveDesc[20];
+ do {
+ uint pos = 0;
+ do {
+ ch = in->readByte();
+ if (pos < (sizeof(saveDesc) - 1)) {
+ if (ch < 32 || in->eos()) {
+ saveDesc[pos++] = '\0';
+ }
+ else if (ch >= 32) {
+ saveDesc[pos++] = ch;
+ }
+ }
+ } while (ch >= 32 && !in->eos());
+ if (saveDesc[0] != 0) {
+ saveList.push_back(SaveStateDescriptor(slotNum, Common::String(saveDesc), filename));
+ slotNum++;
+ }
+ } while (!in->eos());
+ }
+
+ delete in;
+
+ return saveList;
+}
+
#if PLUGIN_ENABLED_DYNAMIC(CINE)
REGISTER_PLUGIN_DYNAMIC(CINE, PLUGIN_TYPE_ENGINE, CineMetaEngine);
#else