diff options
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/features.cpp | 12 | ||||
-rw-r--r-- | engines/sci/engine/kernel32.cpp | 7 |
2 files changed, 19 insertions, 0 deletions
diff --git a/engines/sci/engine/features.cpp b/engines/sci/engine/features.cpp index f0abdde694..fee6e69da7 100644 --- a/engines/sci/engine/features.cpp +++ b/engines/sci/engine/features.cpp @@ -405,6 +405,18 @@ SciVersion GameFeatures::detectGfxFunctionsType() { #ifdef ENABLE_SCI32 bool GameFeatures::autoDetectSci21KernelType() { + // First, check if the Sound object is loaded + reg_t soundObjAddr = _segMan->findObjectByName("Sound"); + if (soundObjAddr.isNull()) { + // Usually, this means that the Sound object isn't loaded yet. + // This case doesn't occur in early SCI2.1 games, and we've only + // seen it happen in the RAMA demo, thus we can assume that the + // game is using a SCI2.1 table + warning("autoDetectSci21KernelType(): Sound object not loaded, assuming a SCI2.1 table"); + _sci21KernelType = SCI_VERSION_2_1; + return true; + } + // Look up the script address reg_t addr = getDetectionAddr("Sound", SELECTOR(play)); diff --git a/engines/sci/engine/kernel32.cpp b/engines/sci/engine/kernel32.cpp index 564e0b76c3..2d492eb3ee 100644 --- a/engines/sci/engine/kernel32.cpp +++ b/engines/sci/engine/kernel32.cpp @@ -463,6 +463,13 @@ reg_t kArray(EngineState *s, int argc, reg_t *argv) { return argv[1]; } case 6: { // Cpy + if (s->_segMan->getSegmentObj(argv[1].segment)->getType() != SEG_TYPE_ARRAY || + s->_segMan->getSegmentObj(argv[3].segment)->getType() != SEG_TYPE_ARRAY) { + // Happens in the RAMA demo + warning("kArray(Cpy): Request to copy a segment which isn't an array, ignoring"); + return NULL_REG; + } + SciArray<reg_t> *array1 = s->_segMan->lookupArray(argv[1]); SciArray<reg_t> *array2 = s->_segMan->lookupArray(argv[3]); uint32 index1 = argv[2].toUint16(); |