From 708b37898c17ca520e8b3ae92a2e458665c7bd81 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 29 May 2010 15:01:33 +0000 Subject: [PATCH] Fixed regression in SCI2-SCI21 games from commit 49308 svn-id: r49309 --- engines/sci/resource.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index d336cbab386..ab46fa3abd2 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -1926,6 +1926,10 @@ reg_t ResourceManager::findGameObject(bool addSci11ScriptOffset) { if (getSciVersion() >= SCI_VERSION_1_1 && addSci11ScriptOffset) offset += script->size; + // TODO: Investigate why this is needed for SCI2+ games + if (getSciVersion() >= SCI_VERSION_2) + offset += 1; + return make_reg(1, offset); } @@ -1941,8 +1945,14 @@ Common::String ResourceManager::findSierraGameId() { nameSelector += 5; } + int16 gameObjectOffset = findGameObject(false).offset; + + // Compensate for the odd offsets of SCI2+ games + if (getSciVersion() >= SCI_VERSION_2) + gameObjectOffset -= 1; + // Seek to the name selector of the first export - byte *seeker = heap->data + READ_UINT16(heap->data + findGameObject(false).offset + nameSelector * 2); + byte *seeker = heap->data + READ_UINT16(heap->data + gameObjectOffset + nameSelector * 2); Common::String sierraId; sierraId += (const char *)seeker;