From bbcf020457a19bf7fdbc758d5f878554058dbd08 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Sat, 17 Jul 2010 22:11:35 +0000 Subject: SCI: adding detection for SCI01 vocab inside a SCI0 game that's using the SCI0 vocab resource number, fixes pq2 japanese crashing on startup svn-id: r50970 --- engines/sci/parser/vocabulary.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'engines/sci/parser') diff --git a/engines/sci/parser/vocabulary.cpp b/engines/sci/parser/vocabulary.cpp index 7b115a815d..ad006b0ca8 100644 --- a/engines/sci/parser/vocabulary.cpp +++ b/engines/sci/parser/vocabulary.cpp @@ -85,6 +85,24 @@ bool Vocabulary::loadParserWords() { return false; // NOT critical: SCI1 games and some demos don't have one! } + if (_vocabVersion == kVocabularySCI0) { + if (resource->size < 26 * 2) { + warning("Invalid main vocabulary encountered: Much too small"); + return false; + } + // Check the alphabet-offset table for any content + int alphabetNr; + for (alphabetNr = 0; alphabetNr < 26; alphabetNr++) { + if (READ_LE_UINT16(resource->data + alphabetNr * 2)) + break; + } + // If all of them were empty, we are definitely seeing SCI01 vocab in disguise (e.g. pq2 japanese) + if (alphabetNr == 26) { + warning("SCI0: Found SCI01 vocabulary in disguise"); + _vocabVersion = kVocabularySCI1; + } + } + unsigned int seeker; if (_vocabVersion == kVocabularySCI1) seeker = 255 * 2; // vocab.900 starts with 255 16-bit pointers which we don't use -- cgit v1.2.3