From f128f49ea69d0d2bdd2571bdedb30b5195dfe28c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 26 Aug 2009 09:38:51 +0000 Subject: If a resource map entry can't be read, retry with the volume version instead, if it's different than the map version svn-id: r43755 --- engines/sci/resource.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 9943ae0ae1..7a41a526ac 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -1023,12 +1023,20 @@ int ResourceManager::readResourceMapSCI0(ResourceSource *map) { // adding a new resource if (_resMap.contains(resId) == false) { res = new Resource; - res->file_offset = offset & (((~bMask) << 24) | 0xFFFFFF); - res->id = resId; res->source = getVolume(map, offset >> bShift); if (!res->source) { warning("Could not get volume for resource %d, VolumeID %d", id, offset >> bShift); + if (_mapVersion != _volVersion) { + warning("Retrying with the detected volume version instead"); + warning("Map version was: %d, retrying with: %d", _mapVersion, _volVersion); + _mapVersion = _volVersion; + bMask = (_mapVersion == kResVersionSci1Middle) ? 0xF0 : 0xFC; + bShift = (_mapVersion == kResVersionSci1Middle) ? 28 : 26; + res->source = getVolume(map, offset >> bShift); + } } + res->file_offset = offset & (((~bMask) << 24) | 0xFFFFFF); + res->id = resId; _resMap.setVal(resId, res); } } while (!file.eos()); -- cgit v1.2.3