diff options
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/features.cpp | 9 | ||||
-rw-r--r-- | engines/sci/resource.cpp | 13 | ||||
-rw-r--r-- | engines/sci/resource.h | 2 |
3 files changed, 18 insertions, 6 deletions
diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp index 66bd9da8ec..97eec38caf 100644 --- a/engines/sci/engine/features.cpp +++ b/engines/sci/engine/features.cpp @@ -138,12 +138,9 @@ bool GameFeatures::autoDetectSoundType() { SciVersion GameFeatures::detectDoSoundType() { if (_doSoundType == SCI_VERSION_NONE) { if (getSciVersion() == SCI_VERSION_0_EARLY) { - // This game is using early SCI0 sound code (different headers than - // SCI0 late) - if (g_sci->getGameId() == GID_LSL2) - _doSoundType = SCI_VERSION_0_LATE; - else - _doSoundType = SCI_VERSION_0_EARLY; + // Almost all of the SCI0EARLY games use different sound resources than + // SCI0LATE. Although the last SCI0EARLY game (lsl2) uses SCI0LATE resources + _doSoundType = g_sci->getResMan()->detectEarlySound() ? SCI_VERSION_0_EARLY : SCI_VERSION_0_LATE; #ifdef ENABLE_SCI32 } else if (getSciVersion() >= SCI_VERSION_2_1) { _doSoundType = SCI_VERSION_2_1; diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 3b787cc673..4aff273610 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -2148,6 +2148,19 @@ bool ResourceManager::detectForPaletteMergingForSci11() { return false; } +// is called on SCI0EARLY games to make sure that sound resources are in fact also SCI0EARLY +bool ResourceManager::detectEarlySound() { + Resource *res = findResource(ResourceId(kResourceTypeSound, 1), 0); + if (res) { + if (res->size >= 0x22) { + if (READ_LE_UINT16(res->data + 0x1f) == 0) // channel 15 voice count + play mask is 0 in SCI0LATE + if (res->data[0x21] == 0) // last byte right before actual data is 0 as well + return false; // these 2 bytes are + } + } + return true; +} + // 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 62968a231e..53c00f6ec0 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -345,6 +345,8 @@ public: bool detectFontExtended(); // Detects, if SCI1.1 game uses palette merging bool detectForPaletteMergingForSci11(); + // Detects, if SCI0EARLY game also has SCI0EARLY sound resources + bool detectEarlySound(); /** * Finds the internal Sierra ID of the current game from script 0. |