aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/cine/detection.cpp15
-rw-r--r--gui/launcher.cpp4
2 files changed, 15 insertions, 4 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());
}
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 6af9791810..17fdbaddbb 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -968,12 +968,14 @@ void LauncherDialog::loadGame(int item) {
if (_loadDialog->delSave()) {
String filename = saveList[idx].filename();
printf("Deleting file: %s\n", filename.c_str());
- //saveFileMan->removeSavefile(filename.c_str());
+ saveFileMan->removeSavefile(filename.c_str());
}
// Load the savegame
else {
int slot = atoi(saveList[idx].save_slot().c_str());
+ const char *file = saveList[idx].filename().c_str();
printf("Loading slot: %d\n", slot);
+ printf("Loading file: %s\n", file);
ConfMan.setInt("save_slot", slot);
ConfMan.setActiveDomain(_domains[item]);
close();