aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2009-08-26 09:38:51 +0000
committerFilippos Karapetis2009-08-26 09:38:51 +0000
commitf128f49ea69d0d2bdd2571bdedb30b5195dfe28c (patch)
treec5a407bbd21382cc3963a9d7293690f827bdb48c
parent6e469002dd465fbf3d1fbccc0a186189b918df59 (diff)
downloadscummvm-rg350-f128f49ea69d0d2bdd2571bdedb30b5195dfe28c.tar.gz
scummvm-rg350-f128f49ea69d0d2bdd2571bdedb30b5195dfe28c.tar.bz2
scummvm-rg350-f128f49ea69d0d2bdd2571bdedb30b5195dfe28c.zip
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
-rw-r--r--engines/sci/resource.cpp12
1 files changed, 10 insertions, 2 deletions
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());