[Scummvm-cvs-logs] SF.net SVN: scummvm:[33777] scummvm/trunk/engines/kyra

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Mon Aug 11 16:47:53 CEST 2008


Revision: 33777
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33777&view=rev
Author:   athrxx
Date:     2008-08-11 14:47:50 +0000 (Mon, 11 Aug 2008)

Log Message:
-----------
LOL: add support for floppy installer files
(startup will fail nonethelesse since we have different pak file names)

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/detection.cpp
    scummvm/trunk/engines/kyra/lol.cpp
    scummvm/trunk/engines/kyra/resource.cpp

Modified: scummvm/trunk/engines/kyra/detection.cpp
===================================================================
--- scummvm/trunk/engines/kyra/detection.cpp	2008-08-11 13:12:32 UTC (rev 33776)
+++ scummvm/trunk/engines/kyra/detection.cpp	2008-08-11 14:47:50 UTC (rev 33777)
@@ -67,11 +67,14 @@
 #define KYRA3_CD_FAN_FLAGS(x, y) FLAGS_FAN(x, y, false, false, true, false, true, false, Kyra::GI_KYRA3)
 
 #define LOL_CD_FLAGS FLAGS(false, false, true, false, false, false, Kyra::GI_LOL)
+#define LOL_FLOPPY_FLAGS FLAGS(false, false, false, false, false, false, Kyra::GI_LOL)
+#define LOL_FLOPPY_CMP_FLAGS FLAGS(false, false, false, false, false, true, Kyra::GI_LOL)
 #define LOL_PC98_FLAGS FLAGS(false, false, false, false, false, false, Kyra::GI_LOL)
 #define LOL_PC98_SJIS_FLAGS FLAGS(false, false, false, true, false, false, Kyra::GI_LOL)
 #define LOL_DEMO_FLAGS FLAGS(true, false, false, false, false, false, Kyra::GI_KYRA2)
 
 const KYRAGameDescription adGameDescs[] = {
+	/* disable these targets until they get supported
 	{
 		{
 			"kyra1",
@@ -83,6 +86,7 @@
 		},
 		KYRA1_FLOPPY_CMP_FLAGS
 	},
+
 	{
 		{
 			"kyra1",
@@ -94,6 +98,8 @@
 		},
 		KYRA1_FLOPPY_CMP_FLAGS
 	},
+	*/
+
 	{
 		{
 			"kyra1",
@@ -696,7 +702,7 @@
 		KYRA3_CD_FAN_FLAGS(Common::ES_ESP, Common::EN_ANY)
 	},
 
-	// Itlian fan translation, see fr#2003504 "KYRA: add support for Italian version of Kyrandia 2&3"
+	// Italian fan translation, see fr#2003504 "KYRA: add support for Italian version of Kyrandia 2&3"
 	{
 		{
 			"kyra3",
@@ -839,12 +845,28 @@
 		},
 		LOL_CD_FLAGS
 	},
-	
-	/*{
+
+	{
 		{
 			"lol",
 			0,
 			{
+				{ "WESTWOOD.1", 0, "3c61cb7de5b2ec452f5851f5075207ee", -1 },
+				{ 0, 0, 0, 0 }
+			},
+			Common::DE_DEU,
+			Common::kPlatformPC,
+			Common::ADGF_NO_FLAGS
+		},
+		LOL_FLOPPY_CMP_FLAGS
+	},
+
+	/* disable these targets until they get supported
+	{
+		{
+			"lol",
+			0,
+			{
 				{ "GENERAL.PAK", 0, "3fe6539b9b09084c0984eaf7170464e9", -1 },
 				{ "MUS.PAK", 0, "008dc69d8cbcdb6bae30e270fab26e76", -1 },
 				{ 0, 0, 0, 0 }

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2008-08-11 13:12:32 UTC (rev 33776)
+++ scummvm/trunk/engines/kyra/lol.cpp	2008-08-11 14:47:50 UTC (rev 33777)
@@ -259,11 +259,14 @@
 		"xxx/intro9.pak"
 	};
 
-	char filename[32];
+	char filepath[32];
+	char *filename = filepath;
 	for (uint i = 0; i < ARRAYSIZE(fileList); ++i) {
 		strcpy(filename, fileList[i]);
 		memcpy(filename, _languageExt[_lang], 3);
-
+		if (!_flags.isTalkie)
+			filename += 4;		
+		
 		if (load) {
 			if (!_res->loadPakFile(filename))
 				error("Couldn't load file: '%s'", filename);

Modified: scummvm/trunk/engines/kyra/resource.cpp
===================================================================
--- scummvm/trunk/engines/kyra/resource.cpp	2008-08-11 13:12:32 UTC (rev 33776)
+++ scummvm/trunk/engines/kyra/resource.cpp	2008-08-11 14:47:50 UTC (rev 33777)
@@ -103,6 +103,9 @@
 
 		return true;
 	} else if (_vm->game() == GI_LOL) {
+		if (_vm->gameFlags().useInstallerPackage)
+			tryLoadCompFiles();
+
 		return true;
 	}
 
@@ -1257,10 +1260,17 @@
 
 class CompLoaderInsHof : public CompArchiveLoader {
 public:
-	bool checkForFiles() const;
-	bool loadFile(CompFileMap &loadTo) const;
+	CompLoaderInsHof() {
+		_fileExtP = "%03d";
+		_checkFile1 = "WESTWOOD.001";
+		_checkFile2 = "WESTWOOD.002";
+		_containerOffset = 6;
+	}
 
-private:
+	virtual bool checkForFiles() const;
+	virtual bool loadFile(CompFileMap &loadTo) const;
+
+protected:
 	struct Archive {
 		Common::String filename;
 		uint32 firstFile;
@@ -1269,10 +1279,25 @@
 		uint32 endOffset;
 		uint32 totalSize;
 	};
+
+	const char *_fileExtP;
+	const char *_checkFile1;
+	const char *_checkFile2;
+	uint8 _containerOffset;
 };
 
+class CompLoaderInsLol : public CompLoaderInsHof {
+public:
+	CompLoaderInsLol() {
+		_fileExtP = "%d";
+		_checkFile1 = "WESTWOOD.1";
+		_checkFile2 = "WESTWOOD.2";
+		_containerOffset = 0;
+	}
+};
+
 bool CompLoaderInsHof::checkForFiles() const {
-	return (Common::File::exists("WESTWOOD.001") && Common::File::exists("WESTWOOD.002"));
+	return (Common::File::exists(_checkFile1) && Common::File::exists(_checkFile2));
 }
 
 bool CompLoaderInsHof::loadFile(CompFileMap &loadTo) const {
@@ -1294,7 +1319,7 @@
 	Common::List<Archive> archives;
 
 	for (int8 currentFile = 1; currentFile; currentFile++) {
-		sprintf(filenameExt, "%03d", currentFile);
+		sprintf(filenameExt, _fileExtP, currentFile);
 		filenameTemp = filenameBase + Common::String(filenameExt);
 
 		if (!tmpFile.open(filenameTemp)) {
@@ -1310,9 +1335,9 @@
 		if (startFile) {
 			size -= 4;
 			if (fileId == currentFile) {
-				size -= 6;
-				pos += 6;
-				tmpFile.seek(6, SEEK_CUR);
+				size -= _containerOffset;
+				pos += _containerOffset;
+				tmpFile.seek(_containerOffset, SEEK_CUR);
 			} else {
 				size = size + 1 - pos;
 			}
@@ -1356,6 +1381,7 @@
 	uint8 *outbuffer = 0;
 	uint32 inPart1 = 0;
 	uint32 inPart2 = 0;
+	uint8 compressionType = 0;
 	Common::String entryStr;
 
 	pos = 0;
@@ -1367,7 +1393,7 @@
 	for (Common::List<Archive>::iterator a = archives.begin(); a != archives.end(); ++a) {
 		startFile = true;
 		for (uint32 i = a->firstFile; i != (a->lastFile + 1); i++) {
-			sprintf(filenameExt, "%03d", i);
+			sprintf(filenameExt, _fileExtP, i);
 			filenameTemp = a->filename + Common::String(filenameExt);
 
 			if (!tmpFile.open(filenameTemp)) {
@@ -1390,7 +1416,12 @@
 					tmpFile.seek(1);
 					tmpFile.read(inbuffer + inPart1, inPart2);
 					inPart2 = 0;
-					exp.process(outbuffer, inbuffer, outsize, insize);
+
+					if (compressionType > 0)
+						exp.process(outbuffer, inbuffer, outsize, insize);
+					else
+						memcpy(outbuffer, inbuffer, outsize);
+
 					delete[] inbuffer;
 					inbuffer = 0;
 					newEntry.data = outbuffer;
@@ -1419,7 +1450,7 @@
 						}
 					}
 				
-					sprintf(filenameExt, "%03d", i + 1);
+					sprintf(filenameExt, _fileExtP, i + 1);
 					filenameTemp = a->filename + Common::String(filenameExt);
 
 					Common::File tmpFile2;
@@ -1435,8 +1466,7 @@
 				uint32 id = READ_LE_UINT32(hdr);
 				
 				if (id == 0x04034B50) {
-					if (hdr[8] != 8)
-						error("compression type not implemented");
+					compressionType = hdr[8];
 					insize = READ_LE_UINT32(hdr + 18);
 					outsize = READ_LE_UINT32(hdr + 22);
 			
@@ -1464,7 +1494,12 @@
 					} else {
 						tmpFile.read(inbuffer, insize);
 						inPart2 = 0;
-						exp.process(outbuffer, inbuffer, outsize, insize);
+
+						if (compressionType > 0)
+							exp.process(outbuffer, inbuffer, outsize, insize);
+						else
+							memcpy(outbuffer, inbuffer, outsize);
+
 						delete[] inbuffer;
 						inbuffer = 0;
 						newEntry.data = outbuffer;
@@ -1498,6 +1533,7 @@
 	_loaders.push_back(LoaderList::value_type(new ResLoaderTlk()));
 
 	_compLoaders.push_back(CompLoaderList::value_type(new CompLoaderInsHof()));
+	_compLoaders.push_back(CompLoaderList::value_type(new CompLoaderInsLol()));
 }
 
 const ResArchiveLoader *Resource::getLoader(ResFileEntry::kType type) const {


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