[Scummvm-cvs-logs] SF.net SVN: scummvm:[52788] scummvm/branches/branch-1-2-0/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sat Sep 18 11:46:07 CEST 2010


Revision: 52788
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52788&view=rev
Author:   thebluegr
Date:     2010-09-18 09:46:06 +0000 (Sat, 18 Sep 2010)

Log Message:
-----------
SCI: Some changes to the fallback detector

Added more graceful handling of the case where SCI32 isn't built in and the
user tries to detect or start a SCI32 game

Modified Paths:
--------------
    scummvm/branches/branch-1-2-0/engines/sci/detection.cpp
    scummvm/branches/branch-1-2-0/engines/sci/resource.cpp
    scummvm/branches/branch-1-2-0/engines/sci/resource_audio.cpp

Modified: scummvm/branches/branch-1-2-0/engines/sci/detection.cpp
===================================================================
--- scummvm/branches/branch-1-2-0/engines/sci/detection.cpp	2010-09-17 22:40:53 UTC (rev 52787)
+++ scummvm/branches/branch-1-2-0/engines/sci/detection.cpp	2010-09-18 09:46:06 UTC (rev 52788)
@@ -516,6 +516,15 @@
 	resMan->init();
 	// TODO: Add error handling.
 
+#ifndef ENABLE_SCI32
+	// Is SCI32 compiled in? If not, and this is a SCI32 game,
+	// stop here
+	if (getSciVersion() >= SCI_VERSION_2) {
+		delete resMan;
+		return (const ADGameDescription *)&s_fallbackDesc;
+	}
+#endif
+
 	ViewType gameViews = resMan->getViewType();
 
 	// Have we identified the game views? If not, stop here
@@ -526,15 +535,6 @@
 		return 0;
 	}
 
-#ifndef ENABLE_SCI32
-	// Is SCI32 compiled in? If not, and this is a SCI32 game,
-	// stop here
-	if (getSciVersion() >= SCI_VERSION_2) {
-		delete resMan;
-		return (const ADGameDescription *)&s_fallbackDesc;
-	}
-#endif
-
 	// EGA views
 	if (gameViews == kViewEga && s_fallbackDesc.platform != Common::kPlatformAmiga)
 		s_fallbackDesc.extra = "EGA";

Modified: scummvm/branches/branch-1-2-0/engines/sci/resource.cpp
===================================================================
--- scummvm/branches/branch-1-2-0/engines/sci/resource.cpp	2010-09-17 22:40:53 UTC (rev 52787)
+++ scummvm/branches/branch-1-2-0/engines/sci/resource.cpp	2010-09-18 09:46:06 UTC (rev 52788)
@@ -142,7 +142,6 @@
 	kResourceTypeTranslation                                                              // 0x14
 };
 
-#ifdef ENABLE_SCI32
 // TODO: 12 should be "Wave", but SCI seems to just store it in Audio resources
 static const ResourceType s_resTypeMapSci21[] = {
 	kResourceTypeView, kResourceTypePic, kResourceTypeScript, kResourceTypeText,          // 0x00-0x03
@@ -152,7 +151,6 @@
 	kResourceTypeMap, kResourceTypeHeap, kResourceTypeChunk, kResourceTypeAudio36,        // 0x10-0x13
 	kResourceTypeSync36, kResourceTypeTranslation, kResourceTypeRobot, kResourceTypeVMD   // 0x14-0x17
 };
-#endif
 
 ResourceType ResourceManager::convertResType(byte type) {
 	type &= 0x7f;
@@ -163,7 +161,6 @@
 			return s_resTypeMapSci0[type];
 	} else {
 		// SCI2.1+
-#ifdef ENABLE_SCI32
 		if (type < ARRAYSIZE(s_resTypeMapSci21)) {
 			// LSL6 hires doesn't have the chunk resource type, to match
 			// the resource types of the lowres version, thus we use the
@@ -173,9 +170,6 @@
 			else
 				return s_resTypeMapSci21[type];
 		}
-#else
-		error("SCI32 support not compiled in");
-#endif
 	}
 
 	return kResourceTypeInvalid;
@@ -853,7 +847,16 @@
 		debugC(1, kDebugLevelResMan, "resMan: Detected Amiga graphic resources");
 		break;
 	default:
+#ifdef ENABLE_SCI32
 		error("resMan: Couldn't determine view type");
+#else
+		if (getSciVersion() >= SCI_VERSION_2) {
+			// SCI support isn't built in, thus the view type won't be determined for
+			// SCI2+ games. This will be handled further up, so throw no error here
+		} else {
+			error("resMan: Couldn't determine view type");
+		}
+#endif
 	}
 
 #ifdef ENABLE_SCI32
@@ -1946,7 +1949,18 @@
 	s_sciVersion = SCI_VERSION_0_EARLY;
 	bool oldDecompressors = true;
 
-	ResourceCompression viewCompression = getViewCompression();
+	ResourceCompression viewCompression;
+#ifdef ENABLE_SCI32	
+	viewCompression = getViewCompression();
+#else
+	if (_volVersion == kResVersionSci32) {
+		// SCI32 support isn't built in, thus view detection will fail
+		viewCompression = kCompUnknown;
+	} else {
+		viewCompression = getViewCompression();
+	}
+#endif
+
 	if (viewCompression != kCompLZW) {
 		// If it's a different compression type from kCompLZW, the game is probably
 		// SCI_VERSION_1_EGA or later. If the views are uncompressed, it is
@@ -1967,8 +1981,18 @@
 		// SCI1.1 VGA views
 		_viewType = kViewVga11;
 	} else {
+#ifdef ENABLE_SCI32
 		// Otherwise we detect it from a view
 		_viewType = detectViewType();
+#else
+		if (_volVersion == kResVersionSci32 && viewCompression == kCompUnknown) {
+			// A SCI32 game, but SCI32 support is disabled. Force the view type
+			// to kViewVga11, as we can't read from the game's resource files
+			_viewType = kViewVga11;
+		} else {
+			_viewType = detectViewType();
+		}
+#endif
 	}
 	
 	if (_volVersion == kResVersionSci11Mac) {

Modified: scummvm/branches/branch-1-2-0/engines/sci/resource_audio.cpp
===================================================================
--- scummvm/branches/branch-1-2-0/engines/sci/resource_audio.cpp	2010-09-17 22:40:53 UTC (rev 52787)
+++ scummvm/branches/branch-1-2-0/engines/sci/resource_audio.cpp	2010-09-18 09:46:06 UTC (rev 52788)
@@ -273,6 +273,13 @@
 // w syncAscSize (iff seq has bit 6 set)
 
 int ResourceManager::readAudioMapSCI11(ResourceSource *map) {
+#ifndef ENABLE_SCI32
+	// SCI32 support is not built in. Check if this is a SCI32 game
+	// and if it is abort here.
+	if (_volVersion == kResVersionSci32)
+		return SCI_ERROR_RESMAP_NOT_FOUND;
+#endif
+
 	uint32 offset = 0;
 	Resource *mapRes = findResource(ResourceId(kResourceTypeMap, map->_volumeNumber), false);
 


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