diff options
Diffstat (limited to 'engines/lure/detection.cpp')
| -rw-r--r-- | engines/lure/detection.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/engines/lure/detection.cpp b/engines/lure/detection.cpp index 7dd1c77348..ccfa26fadc 100644 --- a/engines/lure/detection.cpp +++ b/engines/lure/detection.cpp @@ -26,6 +26,7 @@ #include "base/plugins.h" #include "common/advancedDetector.h" +#include "common/savefile.h" #include "lure/lure.h" @@ -184,9 +185,19 @@ public: return "Lure of the Temptress (C) Revolution"; } + virtual bool hasFeature(MetaEngineFeature f) const; virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const; + virtual SaveStateList listSaves(const char *target) const; }; +bool LureMetaEngine::hasFeature(MetaEngineFeature f) const { + return + (f == kSupportsRTL) || + (f == kSupportsListSaves) || + (f == kSupportsDirectLoad) || + (f == kSupportsDeleteSave); +} + bool LureMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const { const Lure::LureGameDescription *gd = (const Lure::LureGameDescription *)desc; if (gd) { @@ -195,6 +206,34 @@ bool LureMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common return gd != 0; } +SaveStateList LureMetaEngine::listSaves(const char *target) const { + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Common::StringList filenames; + Common::String saveDesc; + Common::String pattern = target; + pattern += ".???"; + + 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 3 digits of the filename, since they correspond to the save slot + int slotNum = atoi(file->c_str() + file->size() - 3); + + if (slotNum >= 0 && slotNum <= 999) { + Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str()); + if (in) { + saveDesc = Lure::getSaveName(in); + saveList.push_back(SaveStateDescriptor(slotNum, saveDesc, *file)); + delete in; + } + } + } + + return saveList; +} + #if PLUGIN_ENABLED_DYNAMIC(LURE) REGISTER_PLUGIN_DYNAMIC(LURE, PLUGIN_TYPE_ENGINE, LureMetaEngine); #else |
