aboutsummaryrefslogtreecommitdiff
path: root/engines/sword2
diff options
context:
space:
mode:
authorMax Horn2007-02-11 13:02:50 +0000
committerMax Horn2007-02-11 13:02:50 +0000
commitf31d438a64611fa5a0372f8cada56e817f8b6bb4 (patch)
treec18bbfc70d92083de439ccb14061a6bb45525e81 /engines/sword2
parentbeef3b3a87e69efac610e0bb094fdfbee9af1f57 (diff)
downloadscummvm-rg350-f31d438a64611fa5a0372f8cada56e817f8b6bb4.tar.gz
scummvm-rg350-f31d438a64611fa5a0372f8cada56e817f8b6bb4.tar.bz2
scummvm-rg350-f31d438a64611fa5a0372f8cada56e817f8b6bb4.zip
SWORD2: Enhance the detector to recurse into the 'clusters' directory, making it possible to detect & run BS2 from (a straight copy of) the CD
svn-id: r25490
Diffstat (limited to 'engines/sword2')
-rw-r--r--engines/sword2/sword2.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp
index f0f87cc370..fb162aae62 100644
--- a/engines/sword2/sword2.cpp
+++ b/engines/sword2/sword2.cpp
@@ -84,6 +84,7 @@ GameDescriptor Engine_SWORD2_findGameID(const char *gameid) {
GameList Engine_SWORD2_detectGames(const FSList &fslist) {
GameList detectedGames;
const Sword2::GameSettings *g;
+ FSList::const_iterator file;
// TODO: It would be nice if we had code here which distinguishes
// between the 'sword2' and 'sword2demo' targets. The current code
@@ -91,7 +92,7 @@ GameList Engine_SWORD2_detectGames(const FSList &fslist) {
for (g = Sword2::sword2_settings; g->gameid; ++g) {
// Iterate over all files in the given directory
- for (FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
+ for (file = fslist.begin(); file != fslist.end(); ++file) {
if (!file->isDirectory()) {
const char *fileName = file->name().c_str();
@@ -103,6 +104,30 @@ GameList Engine_SWORD2_detectGames(const FSList &fslist) {
}
}
}
+
+
+ if (detectedGames.empty()) {
+ // Nothing found -- try to recurse into the 'clusters' subdirectory,
+ // present e.g. if the user copied the data straight from CD.
+ for (file = fslist.begin(); file != fslist.end(); ++file) {
+ if (file->isDirectory()) {
+ const char *fileName = file->name().c_str();
+
+ if (0 == scumm_stricmp("clusters", fileName)) {
+ FSList recList;
+ if (file->listDir(recList, FilesystemNode::kListAll)) {
+ GameList recGames(Engine_SWORD2_detectGames(recList));
+ if (!recGames.empty()) {
+ detectedGames.push_back(recGames);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+
return detectedGames;
}
@@ -112,7 +137,7 @@ PluginError Engine_SWORD2_create(OSystem *syst, Engine **engine) {
FSList fslist;
FilesystemNode dir(ConfMan.get("path"));
- if (!dir.listDir(fslist, FilesystemNode::kListFilesOnly)) {
+ if (!dir.listDir(fslist, FilesystemNode::kListAll)) {
return kInvalidPathError;
}