[Scummvm-cvs-logs] SF.net SVN: scummvm:[47588] scummvm/trunk/engines/sci

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Wed Jan 27 05:26:28 CET 2010


Revision: 47588
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47588&view=rev
Author:   mthreepwood
Date:     2010-01-27 04:26:28 +0000 (Wed, 27 Jan 2010)

Log Message:
-----------
Improve support for the SCI2.1/SCI3 file naming scheme. Multiple maps can be used and have to be matched up with their volume counterparts. Adding detection for the Phantasmagoria Demo too.

Modified Paths:
--------------
    scummvm/trunk/engines/sci/detection.cpp
    scummvm/trunk/engines/sci/detection_tables.h
    scummvm/trunk/engines/sci/resource.cpp
    scummvm/trunk/engines/sci/resource.h

Modified: scummvm/trunk/engines/sci/detection.cpp
===================================================================
--- scummvm/trunk/engines/sci/detection.cpp	2010-01-27 03:37:56 UTC (rev 47587)
+++ scummvm/trunk/engines/sci/detection.cpp	2010-01-27 04:26:28 UTC (rev 47588)
@@ -211,7 +211,7 @@
 		Common::String filename = file->getName();
 		filename.toLowercase();
 
-		if (filename.contains("resource.map") || filename.contains("resmap.000")) {
+		if (filename.contains("resource.map") || filename.contains("resmap.00")) {
 			// HACK: resource.map is located in the same directory as the other resource files,
 			// therefore add the directory here, so that the game files can be opened later on
 			// We now add the parent directory temporary to our SearchMan so the engine code

Modified: scummvm/trunk/engines/sci/detection_tables.h
===================================================================
--- scummvm/trunk/engines/sci/detection_tables.h	2010-01-27 03:37:56 UTC (rev 47587)
+++ scummvm/trunk/engines/sci/detection_tables.h	2010-01-27 04:26:28 UTC (rev 47588)
@@ -1819,6 +1819,14 @@
 		//{"ressci.007", 0, "3aae6559aa1df273bc542d5ac6330d75", 25859038},
 		{NULL, 0, NULL, 0}},
 		Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH	},
+		
+	// Phantasmagoria - English DOS Demo
+	// Executable scanning reports "2.100.002"
+	{"phantasmagoria", "Demo", {
+		{"resmap.001", 0, "416138651ea828219ca454cae18341a3", 11518},
+		{"ressci.001", 0, "3aae6559aa1df273bc542d5ac6330d75", 65844612},
+		{NULL, 0, NULL, 0}},
+		Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH	},
 
 #ifdef ENABLE_SCI3_GAMES
 	// Phantasmagoria 2 - English Windows (from jvprat)

Modified: scummvm/trunk/engines/sci/resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/resource.cpp	2010-01-27 03:37:56 UTC (rev 47587)
+++ scummvm/trunk/engines/sci/resource.cpp	2010-01-27 04:26:28 UTC (rev 47588)
@@ -114,7 +114,7 @@
 
 // Resource source list management
 
-ResourceSource *ResourceManager::addExternalMap(const char *file_name) {
+ResourceSource *ResourceManager::addExternalMap(const char *file_name, int volume_nr) {
 	ResourceSource *newsrc = new ResourceSource();
 
 	newsrc->source_type = kSourceExtMap;
@@ -122,6 +122,7 @@
 	newsrc->resourceFile = 0;
 	newsrc->scanned = false;
 	newsrc->associated_map = NULL;
+	newsrc->volume_number = volume_nr;
 
 	_sources.push_back(newsrc);
 	return newsrc;
@@ -135,6 +136,7 @@
 	newsrc->resourceFile = mapFile;
 	newsrc->scanned = false;
 	newsrc->associated_map = NULL;
+	newsrc->volume_number = 0;
 
 	_sources.push_back(newsrc);
 	return newsrc;
@@ -380,37 +382,56 @@
 }
 
 int ResourceManager::addAppropriateSources() {
-	ResourceSource *map;
+	Common::ArchiveMemberList files;
 
-	if (Common::File::exists("RESOURCE.MAP"))
-		map = addExternalMap("RESOURCE.MAP");
-#ifdef ENABLE_SCI32
-	else if (Common::File::exists("RESMAP.000"))
-		map = addExternalMap("RESMAP.000");
-	else if (Common::File::exists("RESMAP.001"))
-		map = addExternalMap("RESMAP.001");
-#endif
-	else
-		return 0;
+	if (Common::File::exists("RESOURCE.MAP")) {
+		// SCI0-SCI2 file naming scheme
+		ResourceSource *map = addExternalMap("RESOURCE.MAP");
 
+		SearchMan.listMatchingMembers(files, "RESOURCE.0??");
 
-	Common::ArchiveMemberList files;
-	SearchMan.listMatchingMembers(files, "RESOURCE.0??");
+		for (Common::ArchiveMemberList::const_iterator x = files.begin(); x != files.end(); ++x) {
+			const Common::String name = (*x)->getName();
+			const char *dot = strrchr(name.c_str(), '.');
+			int number = atoi(dot + 1);
 
+			addSource(map, kSourceVolume, name.c_str(), number);
+		}
 #ifdef ENABLE_SCI32
-	SearchMan.listMatchingMembers(files, "RESSCI.0??");
-#endif
+	} else {
+		// SCI2.1-SCI3 file naming scheme
+		Common::ArchiveMemberList mapFiles;
+		SearchMan.listMatchingMembers(mapFiles, "RESMAP.0??");
+		SearchMan.listMatchingMembers(files, "RESSCI.0??");
 
-	for (Common::ArchiveMemberList::const_iterator x = files.begin(); x != files.end(); ++x) {
-		const Common::String name = (*x)->getName();
-		const char *dot = strrchr(name.c_str(), '.');
-		int number = atoi(dot + 1);
+		// We need to have the same number of maps as resource archives
+		if (mapFiles.empty() || files.empty() || mapFiles.size() != files.size())
+			return 0;
 
-		addSource(map, kSourceVolume, name.c_str(), number);
+		Common::ArchiveMemberList::const_iterator fileIterator = files.begin();
+		Common::ArchiveMemberList::const_iterator mapIterator = mapFiles.begin();
+
+		while (fileIterator != files.end()) {
+			Common::String mapName = (*mapIterator)->getName();
+			Common::String resName = (*fileIterator)->getName();
+
+			const char *dot = strrchr(mapName.c_str(), '.');
+			int number = atoi(dot + 1);
+
+			addSource(addExternalMap(mapName.c_str(), number), kSourceVolume, resName.c_str(), number);
+			++fileIterator;
+			++mapIterator;
+		}
 	}
+#else
+	} else
+		return 0;
+#endif
+
 	addPatchDir(".");
 	if (Common::File::exists("MESSAGE.MAP"))
 		addSource(addExternalMap("MESSAGE.MAP"), kSourceVolume, "RESOURCE.MSG", 0);
+
 	return 1;
 }
 
@@ -425,6 +446,8 @@
 		Common::String filename = file->getName();
 		filename.toLowercase();
 
+		// TODO: Load the SCI2.1+ maps (resmap.*) in concurrence with the volumes to
+		// get the proper volume numbers from the maps.
 		if (filename.contains("resource.map") || filename.contains("resmap.000")) {
 			map = addExternalMap(file);
 			break;
@@ -1211,7 +1234,12 @@
 				res = new Resource;
 				_resMap.setVal(resId, res);
 				res->id = resId;
-				res->source = getVolume(map, volume_nr);
+				
+				// NOTE: We add the map's volume number here to the specified volume number
+				// for SCI2.1 and SCI3 maps that are not RESMAP.000. The RESMAP.* files' numbers
+				// need to be used in concurrence with the volume specified in the map to get
+				// the actual resource file.
+				res->source = getVolume(map, volume_nr + map->volume_number);
 				res->file_offset = off;
 			}
 		}

Modified: scummvm/trunk/engines/sci/resource.h
===================================================================
--- scummvm/trunk/engines/sci/resource.h	2010-01-27 03:37:56 UTC (rev 47587)
+++ scummvm/trunk/engines/sci/resource.h	2010-01-27 04:26:28 UTC (rev 47588)
@@ -333,9 +333,10 @@
 	/**
 	 * Add an external (i.e., separate file) map resource to the resource manager's list of sources.
 	 * @param file_name	 The name of the volume to add
+	 * @param volume_nr  The volume number the map starts at, 0 for <SCI2.1
 	 * @return		A pointer to the added source structure, or NULL if an error occurred.
 	 */
-	ResourceSource *addExternalMap(const char *file_name);
+	ResourceSource *addExternalMap(const char *file_name, int volume_nr = 0);
 
 	ResourceSource *addExternalMap(const Common::FSNode *mapFile);
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list