aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2010-06-08 21:15:53 +0000
committerMartin Kiewitz2010-06-08 21:15:53 +0000
commit6474eaa1b293b24db51d2a14ef345c7c853a26e1 (patch)
treee4f402b7c3df0a2a628fc7b3b5e53ae56128f16b /engines
parent9304b5fbeb4cb3d181d96be6da34073fc5851939 (diff)
downloadscummvm-rg350-6474eaa1b293b24db51d2a14ef345c7c853a26e1.tar.gz
scummvm-rg350-6474eaa1b293b24db51d2a14ef345c7c853a26e1.tar.bz2
scummvm-rg350-6474eaa1b293b24db51d2a14ef345c7c853a26e1.zip
SCI: check for SOL header in audio36 patches
svn-id: r49520
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/resource.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index dda03e6063..307b4e888e 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -1072,15 +1072,17 @@ void ResourceManager::processPatch(ResourceSource *source, ResourceType resource
Common::SeekableReadStream *fileStream = 0;
Resource *newrsc;
ResourceId resId = ResourceId(resourceType, resourceNr, tuple);
+ ResourceType checkForType = resourceType;
byte patchType, patchDataOffset;
int fsize;
+ uint32 audio36Header = 0;
// base36 encoded patches (i.e. audio36 and sync36) have the same type as their non-base36 encoded counterparts
- if (resourceType == kResourceTypeAudio36)
- resourceType = kResourceTypeAudio;
+ if (checkForType == kResourceTypeAudio36)
+ checkForType = kResourceTypeAudio;
- if (resourceType == kResourceTypeSync36)
- resourceType = kResourceTypeSync;
+ if (checkForType == kResourceTypeSync36)
+ checkForType = kResourceTypeSync;
if (source->resourceFile) {
fileStream = source->resourceFile->createReadStream();
@@ -1101,10 +1103,22 @@ void ResourceManager::processPatch(ResourceSource *source, ResourceType resource
patchType = fileStream->readByte() & 0x7F;
patchDataOffset = fileStream->readByte();
+ if (resourceType == kResourceTypeAudio36) {
+ audio36Header = fileStream->readUint32BE();
+ }
+
delete fileStream;
- if (patchType != resourceType) {
+ if (patchType != checkForType) {
debug("Patching %s failed - resource type mismatch", source->location_name.c_str());
+ return;
+ }
+
+ if (resourceType == kResourceTypeAudio36) {
+ if (audio36Header != MKID_BE('SOL\x00')) {
+ debug("Patching %s failed - audio36 patch doesn't have SOL header", source->location_name.c_str());
+ return;
+ }
}
// Fixes SQ5/German, patch file special case logic taken from SCI View disassembly