aboutsummaryrefslogtreecommitdiff
path: root/engines/cine/detection.cpp
diff options
context:
space:
mode:
authorChristopher Page2008-08-15 19:44:17 +0000
committerChristopher Page2008-08-15 19:44:17 +0000
commit7e49b2e8a1ab7a856795bffdd1cee44ab5d114e9 (patch)
tree4d3a1559bd2984d2c35d10ebba3388a1afa11740 /engines/cine/detection.cpp
parentad5b550df8d428a0e7b94e681c63d73422620adc (diff)
downloadscummvm-rg350-7e49b2e8a1ab7a856795bffdd1cee44ab5d114e9.tar.gz
scummvm-rg350-7e49b2e8a1ab7a856795bffdd1cee44ab5d114e9.tar.bz2
scummvm-rg350-7e49b2e8a1ab7a856795bffdd1cee44ab5d114e9.zip
Fixes for Cine engine loading from launcher
svn-id: r33914
Diffstat (limited to 'engines/cine/detection.cpp')
-rw-r--r--engines/cine/detection.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp
index 28a8404d28..7fb13fb7c3 100644
--- a/engines/cine/detection.cpp
+++ b/engines/cine/detection.cpp
@@ -554,14 +554,23 @@ bool CineMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common
SaveStateList CineMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
SaveStateList saveList;
+
+ Common::String pattern = target;
+ pattern += ".?";
+ Common::StringList filenames = saveFileMan->listSavefiles(pattern.c_str());
+ sort(filenames.begin(), filenames.end());
+ Common::StringList::const_iterator file = filenames.begin();
+
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 {
+ // Obtain the last digit of the filename, since they correspond to the save slot
+ int slotNum = atoi(file->c_str() + file->size() - 1);
+
uint pos = 0;
do {
ch = in->readByte();
@@ -575,8 +584,8 @@ SaveStateList CineMetaEngine::listSaves(const char *target) const {
}
} while (ch >= 32 && !in->eos());
if (saveDesc[0] != 0) {
- saveList.push_back(SaveStateDescriptor(slotNum, Common::String(saveDesc), filename));
- slotNum++;
+ saveList.push_back(SaveStateDescriptor(slotNum, Common::String(saveDesc), *file));
+ file++;
}
} while (!in->eos());
}