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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Thu Jan 28 22:01:58 CET 2010


Revision: 47651
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47651&view=rev
Author:   m_kiewitz
Date:     2010-01-28 21:01:57 +0000 (Thu, 28 Jan 2010)

Log Message:
-----------
SCI: detecting hires for SCI2+ games, qfg4cd is sci2.1 but still 320x200

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

Modified: scummvm/trunk/engines/sci/resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/resource.cpp	2010-01-28 20:53:33 UTC (rev 47650)
+++ scummvm/trunk/engines/sci/resource.cpp	2010-01-28 21:01:57 UTC (rev 47651)
@@ -1859,6 +1859,35 @@
 	}
 }
 
+bool ResourceManager::detectHires() {
+	// SCI 1.1 and prior is never hires
+	if (getSciVersion() <= SCI_VERSION_1_1)
+		return false;
+
+#ifdef ENABLE_SCI32
+	for (int i = 0; i < 32768; i++) {
+		Resource *res = findResource(ResourceId(kResourceTypePic, i), 0);
+
+		if (res) {
+			if (READ_LE_UINT16(res->data) == 0x0e) {
+				// SCI32 picture
+				uint16 width = READ_LE_UINT16(res->data + 14);
+				uint16 height = READ_LE_UINT16(res->data + 16);
+				if ((width == 320) && ((height == 190) || (height == 200)))
+					return false;
+				if ((width >= 600) || (height >= 400))
+					return true;
+			}
+		}
+	}
+
+	warning("resMan: Couldn't detect hires");
+	return false;
+#else
+	error("no sci32 support");
+#endif
+}
+
 // Functions below are based on PD code by Brian Provinciano (SCI Studio)
 bool ResourceManager::hasOldScriptHeader() {
 	Resource *res = findResource(ResourceId(kResourceTypeScript, 0), 0);

Modified: scummvm/trunk/engines/sci/resource.h
===================================================================
--- scummvm/trunk/engines/sci/resource.h	2010-01-28 20:53:33 UTC (rev 47650)
+++ scummvm/trunk/engines/sci/resource.h	2010-01-28 21:01:57 UTC (rev 47651)
@@ -284,6 +284,8 @@
 	 */
 	void addNewGMPatch(Common::String gameId);
 
+	bool detectHires();
+
 protected:
 	// Maximum number of bytes to allow being allocated for resources
 	// Note: maxMemory will not be interpreted as a hard limit, only as a restriction

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2010-01-28 20:53:33 UTC (rev 47650)
+++ scummvm/trunk/engines/sci/sci.cpp	2010-01-28 21:01:57 UTC (rev 47651)
@@ -126,13 +126,19 @@
 	// Initialize graphics-related parts
 	Screen *screen = 0;
 
+	bool isHires = _resMan->detectHires();
+
 #ifdef ENABLE_SCI32
-	if (getSciVersion() >= SCI_VERSION_2_1)
-		screen = new Screen(_resMan, 640, 480, false);	// invokes initGraphics()
-	else
+	// If SCI2.1+ games are lowres (e.g. qfg4/cd), switch to upscaled hires mode
+	if ((!isHires) && (getSciVersion() >= SCI_VERSION_2_1))
+		upscaledHires = true;
 #endif
-		screen = new Screen(_resMan, 320, 200, upscaledHires);	// invokes initGraphics()
 
+	// invokes initGraphics()
+	if (isHires)
+		screen = new Screen(_resMan, 640, 480, false);
+	else
+		screen = new Screen(_resMan, 320, 200, upscaledHires);
 
 	SciPalette *palette = new SciPalette(_resMan, screen);
 	Cursor *cursor = new Cursor(_resMan, palette, screen);


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