[Scummvm-cvs-logs] scummvm master -> 22aaf995ed4f5131ae9cf6753d228718a96293f3

bluegr bluegr at gmail.com
Sat Oct 18 15:12:27 CEST 2014


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

Summary:
17a77ff69c SCI: Fix some typos, and remove some redundant curly braces
fe3ed8ded2 SCI: Rename the version of addAppropriateSources() used in detection
4736c490e1 SCI: Separate the rest of the detection-only functions
22aaf995ed SCI: Hopefully fix bug #6718 in LSL6 Polish


Commit: 17a77ff69ced1c04e0520336c14e05fbf993108d
    https://github.com/scummvm/scummvm/commit/17a77ff69ced1c04e0520336c14e05fbf993108d
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-10-18T16:03:48+03:00

Commit Message:
SCI: Fix some typos, and remove some redundant curly braces

Changed paths:
    engines/sci/detection.cpp



diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index 4f28738..245b564 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -563,9 +563,8 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
 
 
 	// If these files aren't found, it can't be SCI
-	if (!foundResMap && !foundRes000) {
+	if (!foundResMap && !foundRes000)
 		return 0;
-	}
 
 	ResourceManager resMan;
 	resMan.addAppropriateSources(fslist);
@@ -575,19 +574,17 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
 #ifndef ENABLE_SCI32
 	// Is SCI32 compiled in? If not, and this is a SCI32 game,
 	// stop here
-	if (getSciVersion() >= SCI_VERSION_2) {
-		return (const ADGameDescription *)&s_fallbackDesc;
-	}
+	if (getSciVersion() >= SCI_VERSION_2)
+		return 0;
 #endif
 
 	ViewType gameViews = resMan.getViewType();
 
 	// Have we identified the game views? If not, stop here
-	// Can't be SCI (or unsupported SCI views). Pinball Creep by sierra also uses resource.map/resource.000 files
-	//  but doesnt share sci format at all, if we dont return 0 here we will detect this game as SCI
-	if (gameViews == kViewUnknown) {
+	// Can't be SCI (or unsupported SCI views). Pinball Creep by Sierra also uses resource.map/resource.000 files
+	// but doesn't share SCI format at all
+	if (gameViews == kViewUnknown)
 		return 0;
-	}
 
 	// Set the platform to Amiga if the game is using Amiga views
 	if (gameViews == kViewAmiga)
@@ -597,9 +594,8 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
 	Common::String sierraGameId = resMan.findSierraGameId();
 
 	// If we don't have a game id, the game is not SCI
-	if (sierraGameId.empty()) {
+	if (sierraGameId.empty())
 		return 0;
-	}
 
 	Common::String gameId = convertSierraGameId(sierraGameId, &s_fallbackDesc.flags, resMan);
 	strncpy(s_fallbackGameIdBuf, gameId.c_str(), sizeof(s_fallbackGameIdBuf) - 1);


Commit: fe3ed8ded270510a6233a2ca2376befeceeed0e4
    https://github.com/scummvm/scummvm/commit/fe3ed8ded270510a6233a2ca2376befeceeed0e4
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-10-18T16:03:49+03:00

Commit Message:
SCI: Rename the version of addAppropriateSources() used in detection

Changed paths:
    engines/sci/detection.cpp
    engines/sci/resource.cpp
    engines/sci/resource.h



diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index 245b564..7176a18 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -567,7 +567,7 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
 		return 0;
 
 	ResourceManager resMan;
-	resMan.addAppropriateSources(fslist);
+	resMan.addAppropriateSourcesForDetection(fslist);
 	resMan.init(true);
 	// TODO: Add error handling.
 
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 17195c1..f690f03 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -88,9 +88,6 @@ const char *getSciVersionDesc(SciVersion version) {
 
 //////////////////////////////////////////////////////////////////////
 
-
-#undef SCI_REQUIRE_RESOURCE_FILES
-
 //#define SCI_VERBOSE_RESMAN 1
 
 static const char *const s_errorDescriptions[] = {
@@ -639,7 +636,7 @@ int ResourceManager::addAppropriateSources() {
 	return 1;
 }
 
-int ResourceManager::addAppropriateSources(const Common::FSList &fslist) {
+int ResourceManager::addAppropriateSourcesForDetection(const Common::FSList &fslist) {
 	ResourceSource *map = 0;
 	Common::Array<ResourceSource *> sci21Maps;
 
@@ -890,7 +887,7 @@ void ResourceManager::init(bool initFromFallbackDetector) {
 	debugC(1, kDebugLevelResMan, "resMan: Detected volume version %d: %s", _volVersion, versionDescription(_volVersion));
 
 	if ((_mapVersion == kResVersionUnknown) && (_volVersion == kResVersionUnknown)) {
-		warning("Volume and map version not detected, assuming that this is not a sci game");
+		warning("Volume and map version not detected, assuming that this is not a SCI game");
 		_viewType = kViewUnknown;
 		return;
 	}
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index e90f52a..8260ddb 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -314,8 +314,15 @@ public:
 	 */
 	void init(bool initFromFallbackDetector = false);
 
+	/**
+	 * Adds all of the resource files for a game
+	 */
 	int addAppropriateSources();
-	int addAppropriateSources(const Common::FSList &fslist);	// TODO: Switch from FSList to Common::Archive?
+
+	/**
+	 * Similar to the function above, only called from the fallback detector
+	 */
+	int addAppropriateSourcesForDetection(const Common::FSList &fslist);	// TODO: Switch from FSList to Common::Archive?
 
 	/**
 	 * Looks up a resource's data.


Commit: 4736c490e1d3182f58db8a51b400f96b9559dad8
    https://github.com/scummvm/scummvm/commit/4736c490e1d3182f58db8a51b400f96b9559dad8
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-10-18T16:03:49+03:00

Commit Message:
SCI: Separate the rest of the detection-only functions

This should fix bug #6717 - "SCI fallback detection assert failure"

Changed paths:
    engines/sci/detection.cpp
    engines/sci/resource.cpp
    engines/sci/resource.h
    engines/sci/sci.h



diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index 7176a18..85ff1c0 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -568,13 +568,13 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
 
 	ResourceManager resMan;
 	resMan.addAppropriateSourcesForDetection(fslist);
-	resMan.init(true);
+	resMan.initForDetection();
 	// 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)
+	if (getSciVersionForDetection() >= SCI_VERSION_2)
 		return 0;
 #endif
 
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index f690f03..d155792 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -55,6 +55,11 @@ SciVersion getSciVersion() {
 	return s_sciVersion;
 }
 
+SciVersion getSciVersionForDetection() {
+	assert(!g_sci);
+	return s_sciVersion;
+}
+
 const char *getSciVersionDesc(SciVersion version) {
 	switch (version) {
 	case SCI_VERSION_NONE:
@@ -855,7 +860,7 @@ void ResourceManager::freeResourceSources() {
 ResourceManager::ResourceManager() {
 }
 
-void ResourceManager::init(bool initFromFallbackDetector) {
+void ResourceManager::init() {
 	_memoryLocked = 0;
 	_memoryLRU = 0;
 	_LRU.clear();
@@ -894,18 +899,17 @@ void ResourceManager::init(bool initFromFallbackDetector) {
 
 	scanNewSources();
 
-	if (!initFromFallbackDetector) {
-		if (!addAudioSources()) {
-			// FIXME: This error message is not always correct.
-			// OTOH, it is nice to be able to detect missing files/sources
-			// So we should definitely fix addAudioSources so this error
-			// only pops up when necessary. Disabling for now.
-			//error("Somehow I can't seem to find the sound files I need (RESOURCE.AUD/RESOURCE.SFX), aborting");
-		}
-		addScriptChunkSources();
-		scanNewSources();
+	if (!addAudioSources()) {
+		// FIXME: This error message is not always correct.
+		// OTOH, it is nice to be able to detect missing files/sources
+		// So we should definitely fix addAudioSources so this error
+		// only pops up when necessary. Disabling for now.
+		//error("Somehow I can't seem to find the sound files I need (RESOURCE.AUD/RESOURCE.SFX), aborting");
 	}
 
+	addScriptChunkSources();
+	scanNewSources();
+
 	detectSciVersion();
 
 	debugC(1, kDebugLevelResMan, "resMan: Detected %s", getSciVersionDesc(getSciVersion()));
@@ -940,6 +944,22 @@ void ResourceManager::init(bool initFromFallbackDetector) {
 	}
 }
 
+void ResourceManager::initForDetection() {
+	assert(!g_sci);
+
+	_memoryLocked = 0;
+	_memoryLRU = 0;
+	_LRU.clear();
+	_resMap.clear();
+	_audioMapSCI1 = NULL;
+
+	_mapVersion = detectMapVersion();
+	_volVersion = detectVolVersion();
+
+	scanNewSources();
+	detectSciVersion();
+}
+
 ResourceManager::~ResourceManager() {
 	// freeing resources
 	ResourceMap::iterator itr = _resMap.begin();
@@ -1642,6 +1662,9 @@ int ResourceManager::readResourceMapSCI1(ResourceSource *map) {
 	do {
 		type = fileStream->readByte() & 0x1F;
 		resMap[type].wOffset = fileStream->readUint16LE();
+		if (fileStream->eos())
+			return SCI_ERROR_RESMAP_NOT_FOUND;
+
 		resMap[prevtype].wSize = (resMap[type].wOffset
 		                          - resMap[prevtype].wOffset) / nEntrySize;
 		prevtype = type;
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index 8260ddb..62f3c58 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -312,7 +312,12 @@ public:
 	/**
 	 * Initializes the resource manager.
 	 */
-	void init(bool initFromFallbackDetector = false);
+	void init();
+
+	/**
+	 * Similar to the function above, only called from the fallback detector
+	 */
+	void initForDetection();
 
 	/**
 	 * Adds all of the resource files for a game
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index 48bc481..2377386 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -429,6 +429,12 @@ extern SciEngine *g_sci;
 SciVersion getSciVersion();
 
 /**
+ * Same as above, but this version doesn't assert on unknown SCI versions.
+ * Only used by the fallback detector
+ */
+SciVersion getSciVersionForDetection();
+
+/**
  * Convenience function converting an SCI version into a human-readable string.
  */
 const char *getSciVersionDesc(SciVersion version);


Commit: 22aaf995ed4f5131ae9cf6753d228718a96293f3
    https://github.com/scummvm/scummvm/commit/22aaf995ed4f5131ae9cf6753d228718a96293f3
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-10-18T16:03:50+03:00

Commit Message:
SCI: Hopefully fix bug #6718 in LSL6 Polish

View flags are mainly used by LB2. The flag in the LSL6 view seems to
be garbage, so we ignore it

Changed paths:
    engines/sci/graphics/view.cpp



diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index f3f352e..a88546e 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -283,6 +283,7 @@ void GfxView::initData(GuiResourceId resourceId) {
 			_isScaleable = false;
 			break;
 		case 0x40:
+		case 0x4F:	// LSL6 Polish, seems to be garbage - bug #6718
 		case 0:
 			break; // don't do anything, we already have _isScaleable set
 		default:






More information about the Scummvm-git-logs mailing list