From 3b96c7fad54ff7f5000667be494e50e7ca11e69a Mon Sep 17 00:00:00 2001 From: David Corrales Date: Tue, 5 Jun 2007 21:02:35 +0000 Subject: Renamed methods in the FilesystemNode class to match the AbstractFSNode implementations. Also exposed the new methods (exists, isReadable and isWritable) in FilesystemNode. svn-id: r27113 --- engines/scumm/detection.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'engines/scumm') diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index f60908d3ed..217b257e5e 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -205,7 +205,7 @@ static bool testGame(const GameSettings *g, const DescMap &fileMD5Map, const Com // the first match is used. static bool searchFSNode(const FSList &fslist, const Common::String &name, FilesystemNode &result) { for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) { - if (!scumm_stricmp(file->name().c_str(), name.c_str())) { + if (!scumm_stricmp(file->getName().c_str(), name.c_str())) { result = *file; return true; } @@ -231,7 +231,7 @@ static Common::Language detectLanguage(const FSList &fslist, byte id) { FSList tmpList; if (searchFSNode(fslist, "RESOURCE", resDir) && resDir.isDirectory() - && resDir.listDir(tmpList, FilesystemNode::kListFilesOnly) + && resDir.getChildren(tmpList, FilesystemNode::kListFilesOnly) && searchFSNode(tmpList, filename, langFile)) { tmp.open(langFile); } @@ -328,7 +328,7 @@ static void detectGames(const FSList &fslist, Common::List &resu DetectorDesc d; d.node = *file; d.md5Entry = 0; - fileMD5Map[file->name()] = d; + fileMD5Map[file->getName()] = d; } } @@ -455,7 +455,7 @@ static bool testGame(const GameSettings *g, const DescMap &fileMD5Map, const Com Common::File tmp; if (!tmp.open(d.node)) { - warning("SCUMM detectGames: failed to open '%s' for read access", d.node.path().c_str()); + warning("SCUMM detectGames: failed to open '%s' for read access", d.node.getPath().c_str()); return false; } @@ -784,7 +784,7 @@ PluginError Engine_SCUMM_create(OSystem *syst, Engine **engine) { // Fetch the list of files in the current directory FSList fslist; FilesystemNode dir(ConfMan.get("path")); - if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) { + if (!dir.getChildren(fslist, FilesystemNode::kListFilesOnly)) { return kInvalidPathError; } -- cgit v1.2.3 From 720c974fafaca16b6e86f28ffc14c8c3aa574e15 Mon Sep 17 00:00:00 2001 From: David Corrales Date: Thu, 12 Jul 2007 17:58:15 +0000 Subject: Changed SaveFileManager::listSavegames() function to be engine agnostic. It now returns a list will the full paths of existing files that match a given regex. Additionally, modified the 5 engines which use the default manager (Agos, Queen, Saga, Scumm and Touche) to parse the filename list and mark the available saves bool array correctly. svn-id: r28046 --- engines/scumm/dialogs.cpp | 12 ++++++------ engines/scumm/saveload.cpp | 22 ++++++++++++++++++++-- 2 files changed, 26 insertions(+), 8 deletions(-) (limited to 'engines/scumm') diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp index 16fe72531b..85a72cb090 100644 --- a/engines/scumm/dialogs.cpp +++ b/engines/scumm/dialogs.cpp @@ -427,10 +427,10 @@ void SaveLoadChooser::updateInfos() { #pragma mark - Common::StringList generateSavegameList(ScummEngine *scumm, bool saveMode) { - // Get savegame names - Common::StringList l; + // Get savegame descriptions + Common::StringList descriptions; char name[32]; - uint i = saveMode ? 1 : 0; + uint i = saveMode ? 1 : 0; //the autosave is on slot #0 bool avail_saves[81]; scumm->listSavegames(avail_saves, ARRAYSIZE(avail_saves)); @@ -439,10 +439,10 @@ Common::StringList generateSavegameList(ScummEngine *scumm, bool saveMode) { scumm->getSavegameName(i, name); else name[0] = 0; - l.push_back(name); + descriptions.push_back(name); } - - return l; + + return descriptions; } MainMenuDialog::MainMenuDialog(ScummEngine *scumm) diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index 9d0d0ad654..3f638946c4 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -384,10 +384,28 @@ void ScummEngine::makeSavegameName(char *out, int slot, bool temporary) { } void ScummEngine::listSavegames(bool *marks, int num) { + assert(marks); + char prefix[256]; + char slot[2]; + int slotNum; + Common::StringList filenames; + makeSavegameName(prefix, 99, false); - prefix[strlen(prefix)-2] = 0; - _saveFileMan->listSavefiles(prefix, marks, num); + prefix[strlen(prefix)-2] = '*'; + prefix[strlen(prefix)-1] = 0; + memset(marks, false, num * sizeof(bool)); //assume no savegames for this title + filenames = _saveFileMan->listSavefiles(prefix); + + for(Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++){ + //Obtain the last 2 digits of the filename, since they correspond to the save slot + slot[0] = file->c_str()[file->size()-2]; + slot[1] = file->c_str()[file->size()-1]; + + slotNum = atoi(slot); + if(slotNum >= 0 && slotNum < num) + marks[slotNum] = true; //mark this slot as valid + } } bool ScummEngine::getSavegameName(int slot, char *desc) { -- cgit v1.2.3