aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2010-09-18 09:47:18 +0000
committerFilippos Karapetis2010-09-18 09:47:18 +0000
commit928bcdbe094767fefb7c415e098d7d9e47bc078d (patch)
tree3a091612c3a4451b0f6e4a12a078f67993d494b6 /engines
parent1e9e8cd64a97ade7d8f9ff891e511d47b98da70d (diff)
downloadscummvm-rg350-928bcdbe094767fefb7c415e098d7d9e47bc078d.tar.gz
scummvm-rg350-928bcdbe094767fefb7c415e098d7d9e47bc078d.tar.bz2
scummvm-rg350-928bcdbe094767fefb7c415e098d7d9e47bc078d.zip
SCI: Some changes to the fallback detector (sync with branch 1.2.0)
Added more graceful handling of the case where SCI32 isn't built in and the user tries to detect or start a SCI32 game svn-id: r52789
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/detection.cpp18
-rw-r--r--engines/sci/resource.cpp38
-rw-r--r--engines/sci/resource_audio.cpp7
3 files changed, 47 insertions, 16 deletions
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index fbef406ee7..1944be3358 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -516,6 +516,15 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl
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 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const Common::FSList &fsl
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";
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 2f380d3bba..beb8e50c2c 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -142,7 +142,6 @@ static const ResourceType s_resTypeMapSci0[] = {
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 @@ static const ResourceType s_resTypeMapSci21[] = {
kResourceTypeMap, kResourceTypeHeap, kResourceTypeChunk, kResourceTypeAudio36, // 0x10-0x13
kResourceTypeSync36, kResourceTypeTranslation, kResourceTypeRobot, kResourceTypeVMD // 0x14-0x17
};
-#endif
ResourceType ResourceManager::convertResType(byte type) {
type &= 0x7f;
@@ -163,7 +161,6 @@ ResourceType ResourceManager::convertResType(byte type) {
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 @@ ResourceType ResourceManager::convertResType(byte type) {
else
return s_resTypeMapSci21[type];
}
-#else
- error("SCI32 support not compiled in");
-#endif
}
return kResourceTypeInvalid;
@@ -853,7 +847,16 @@ void ResourceManager::init() {
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 @@ void ResourceManager::detectSciVersion() {
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 @@ void ResourceManager::detectSciVersion() {
// 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) {
diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp
index 4217ed1000..d690ecaad7 100644
--- a/engines/sci/resource_audio.cpp
+++ b/engines/sci/resource_audio.cpp
@@ -273,6 +273,13 @@ void ResourceManager::removeAudioResource(ResourceId resId) {
// 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);