diff options
Diffstat (limited to 'backends/saves/default')
-rw-r--r-- | backends/saves/default/default-saves.cpp | 22 | ||||
-rw-r--r-- | backends/saves/default/default-saves.h | 3 |
2 files changed, 8 insertions, 17 deletions
diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp index 8cda56ded9..2219d1c9dc 100644 --- a/backends/saves/default/default-saves.cpp +++ b/backends/saves/default/default-saves.cpp @@ -180,29 +180,19 @@ Common::InSaveFile *DefaultSaveFileManager::openForLoading(const char *filename) return wrapInSaveFile(sf); } -void DefaultSaveFileManager::listSavefiles(const char *prefix , bool *marks, int num) { +Common::StringList DefaultSaveFileManager::listSavefiles(const char *regex) { FilesystemNode savePath(getSavePath()); FSList savefiles; - Common::String search(prefix); - search = search + '*'; //match all files that start with the given prefix. += causes a strange bug. + Common::StringList results; + Common::String search(regex); - assert(marks); - memset(marks, false, num * sizeof(bool)); //assume no savegames for this title - if(savePath.lookupFile(savefiles, savePath, search, false, true)) { - char slot[2]; - int slotNum; for(FSList::const_iterator file = savefiles.begin(); file != savefiles.end(); file++) { - //TODO: check if this is the behavior for all engines - //Obtain the last 2 digits of the filename, since they correspond to the save slot - slot[0] = file->getName()[file->getName().size()-2]; - slot[1] = file->getName()[file->getName().size()-1]; - - slotNum = atoi(slot); - if(slotNum >= 0 && slotNum < num) - marks[slotNum] = true; //mark this slot as valid + results.push_back(file->getPath()); } } + + return results; } #endif // !defined(DISABLE_DEFAULT_SAVEFILEMANAGER) diff --git a/backends/saves/default/default-saves.h b/backends/saves/default/default-saves.h index a3e2037a5c..4b525cabc8 100644 --- a/backends/saves/default/default-saves.h +++ b/backends/saves/default/default-saves.h @@ -28,12 +28,13 @@ #include "common/stdafx.h" #include "common/savefile.h" +#include "common/str.h" class DefaultSaveFileManager : public Common::SaveFileManager { public: virtual Common::OutSaveFile *openForSaving(const char *filename); virtual Common::InSaveFile *openForLoading(const char *filename); - virtual void listSavefiles(const char *prefix, bool *marks, int num); + virtual Common::StringList listSavefiles(const char *regex); }; #endif |