[Scummvm-cvs-logs] SF.net SVN: scummvm:[47773] scummvm/trunk/engines/sci/resource.cpp

waltervn at users.sourceforge.net waltervn at users.sourceforge.net
Sun Jan 31 20:44:51 CET 2010


Revision: 47773
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47773&view=rev
Author:   waltervn
Date:     2010-01-31 19:44:40 +0000 (Sun, 31 Jan 2010)

Log Message:
-----------
SCI: Add support for early audio map files.

Modified Paths:
--------------
    scummvm/trunk/engines/sci/resource.cpp

Modified: scummvm/trunk/engines/sci/resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/resource.cpp	2010-01-31 18:49:59 UTC (rev 47772)
+++ scummvm/trunk/engines/sci/resource.cpp	2010-01-31 19:44:40 UTC (rev 47773)
@@ -1410,17 +1410,24 @@
 }
 
 // AUDIOnnn.MAP contains 10-byte entries:
+// Early format:
+// w 5 bits resource type and 11 bits resource number
+// dw 7 bits volume number and 25 bits offset
+// dw size
+// Later format:
 // w nEntry
 // dw offset+volume (as in resource.map)
 // dw size
 // ending with 10 0xFFs
-
 int ResourceManager::readAudioMapSCI1(ResourceSource *map, bool unload) {
 	Common::File file;
 
 	if (!file.open(map->location_name))
 		return SCI_ERROR_RESMAP_NOT_FOUND;
 
+	bool oldFormat = (file.readUint16LE() >> 11) == kResourceTypeAudio;
+	file.seek(0);
+
 	while (1) {
 		uint16 n = file.readUint16LE();
 		uint32 offset = file.readUint32LE();
@@ -1434,9 +1441,17 @@
 		if (n == 0xffff)
 			break;
 
-		byte volume_nr = offset >> 28; // most significant 4 bits
-		offset &= 0x0fffffff; // least significant 28 bits
+		byte volume_nr;
 
+		if (oldFormat) {
+			n &= 0x07ff; // Mask out resource type
+			volume_nr = offset >> 25; // most significant 7 bits
+			offset &= 0x01ffffff; // least significant 25 bits
+		} else {
+			volume_nr = offset >> 28; // most significant 4 bits
+			offset &= 0x0fffffff; // least significant 28 bits
+		}
+
 		ResourceSource *src = getVolume(map, volume_nr);
 
 		if (src) {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list