[Scummvm-cvs-logs] scummvm master -> 5b2e90504c210dbffcdfc8eafbdc84635de79134

zeldin marcus at mc.pp.se
Sun Jul 17 21:08:37 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
5b2e90504c DC: Directory handling fixes


Commit: 5b2e90504c210dbffcdfc8eafbdc84635de79134
    https://github.com/scummvm/scummvm/commit/5b2e90504c210dbffcdfc8eafbdc84635de79134
Author: Marcus Comstedt (marcus at mc.pp.se)
Date: 2011-07-17T11:59:07-07:00

Commit Message:
DC: Directory handling fixes

* Include directory nodes in FSList sent to detectGames
  - This is required for correct detection of toon.
* Don't add / at the end of directories found in getChildren
  - It looks like that behaviour was removed from posix-fs a long
    time ago, and now there's apparently code depending on directories
    _not_ having a / at the end of their name...
* Treat games detected in subdirs as duplicates
  - This is a workaround for a detection bug in toon; it will incorrectly
    detect the game in the MISC subdirectory as well.
* Don't avoid directories called "install" in the game selector
  - I don't know if the original reason for ignoring "install" is still
    valid, but the code for doing do so was broken anyway.

Changed paths:
    backends/platform/dc/dc-fs.cpp
    backends/platform/dc/selector.cpp



diff --git a/backends/platform/dc/dc-fs.cpp b/backends/platform/dc/dc-fs.cpp
index ac709f6..c46f9df 100644
--- a/backends/platform/dc/dc-fs.cpp
+++ b/backends/platform/dc/dc-fs.cpp
@@ -124,7 +124,7 @@ bool RoninCDDirectoryNode::getChildren(AbstractFSList &myList, ListMode mode, bo
 			if (mode == Common::FSNode::kListFilesOnly)
 				continue;
 
-			myList.push_back(new RoninCDDirectoryNode(newPath+"/"));
+			myList.push_back(new RoninCDDirectoryNode(newPath));
 		} else {
 			// Honor the chosen mode
 			if (mode == Common::FSNode::kListDirectoriesOnly)
diff --git a/backends/platform/dc/selector.cpp b/backends/platform/dc/selector.cpp
index 859f2a4..339e5df 100644
--- a/backends/platform/dc/selector.cpp
+++ b/backends/platform/dc/selector.cpp
@@ -185,12 +185,24 @@ static void makeDefIcon(Icon &icon)
   icon.load(scummvm_icon, sizeof(scummvm_icon));
 }
 
+static bool sameOrSubdir(const char *dir1, const char *dir2)
+{
+  int l1 = strlen(dir1), l2 = strlen(dir2);
+  if (l1<=l2)
+    return !strcmp(dir1, dir2);
+  else
+    return !memcmp(dir1, dir2, l2);
+}
+
 static bool uniqueGame(const char *base, const char *dir,
 		       Common::Language lang, Common::Platform plf,
 		       Game *games, int cnt)
 {
   while (cnt--)
-    if (!strcmp(dir, games->dir) &&
+    if (/*Don't detect the same game in a subdir,
+	  this is a workaround for the detector bug in toon... */
+	sameOrSubdir(dir, games->dir) &&
+	/*!strcmp(dir, games->dir) &&*/
 	!stricmp(base, games->filename_base) &&
 	lang == games->language &&
 	plf == games->platform)
@@ -237,19 +249,24 @@ static int findGames(Game *games, int max, bool use_ini)
   }
 
   while ((curr_game < max || use_ini) && curr_dir < num_dirs) {
-    strncpy(dirs[curr_dir].name, dirs[curr_dir].node.getPath().c_str(), 252);
-    dirs[curr_dir].name[251] = '\0';
+    strncpy(dirs[curr_dir].name, dirs[curr_dir].node.getPath().c_str(), 251);
+    dirs[curr_dir].name[250] = '\0';
+    if (!dirs[curr_dir].name[0] ||
+	dirs[curr_dir].name[strlen(dirs[curr_dir].name)-1] != '/')
+      strcat(dirs[curr_dir].name, "/");
     dirs[curr_dir].deficon[0] = '\0';
     Common::FSList files, fslist;
     dirs[curr_dir++].node.getChildren(fslist, Common::FSNode::kListAll);
     for (Common::FSList::const_iterator entry = fslist.begin(); entry != fslist.end();
 	 ++entry) {
       if (entry->isDirectory()) {
-	if (!use_ini && num_dirs < MAX_DIR &&
-	    strcasecmp(entry->getDisplayName().c_str(), "install")) {
+	if (!use_ini && num_dirs < MAX_DIR) {
 	  dirs[num_dirs].node = *entry;
 	  num_dirs++;
 	}
+	/* Toonstruck detector needs directories to be present too */
+	if(!use_ini)
+	  files.push_back(*entry);
       } else
 	if (isIcon(*entry))
 	  strcpy(dirs[curr_dir-1].deficon, entry->getDisplayName().c_str());






More information about the Scummvm-git-logs mailing list