aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2010-01-28 21:01:57 +0000
committerMartin Kiewitz2010-01-28 21:01:57 +0000
commit9e511e0751f0324bc424b75e02d25a3a3a095053 (patch)
tree96cf124d61e7f57fc3a2b6b0e99331e0512526a0
parent3c46bc33aae7783361882e85cb0cb3653af3ede8 (diff)
downloadscummvm-rg350-9e511e0751f0324bc424b75e02d25a3a3a095053.tar.gz
scummvm-rg350-9e511e0751f0324bc424b75e02d25a3a3a095053.tar.bz2
scummvm-rg350-9e511e0751f0324bc424b75e02d25a3a3a095053.zip
SCI: detecting hires for SCI2+ games, qfg4cd is sci2.1 but still 320x200
svn-id: r47651
-rw-r--r--engines/sci/resource.cpp29
-rw-r--r--engines/sci/resource.h2
-rw-r--r--engines/sci/sci.cpp14
3 files changed, 41 insertions, 4 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index f620e1cb3f..d31a3656ef 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -1859,6 +1859,35 @@ void ResourceManager::detectSciVersion() {
}
}
+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);
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index e8e6bd832d..661b954256 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -284,6 +284,8 @@ public:
*/
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
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 6977348c36..d6c2c0bf46 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -126,13 +126,19 @@ Common::Error SciEngine::run() {
// 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);