[Scummvm-cvs-logs] scummvm master -> 13a5e5812af635477626de6a13f54ed8b8e4afa5

bluegr md5 at scummvm.org
Sun Jul 15 01:15:37 CEST 2012


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
13a5e5812a TEENAGENT: Unpack teenagent.dat and remove the engine's zlib dependency


Commit: 13a5e5812af635477626de6a13f54ed8b8e4afa5
    https://github.com/scummvm/scummvm/commit/13a5e5812af635477626de6a13f54ed8b8e4afa5
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2012-07-14T16:14:37-07:00

Commit Message:
TEENAGENT: Unpack teenagent.dat and remove the engine's zlib dependency

This addresses bug #3539822 - "TEENAGENT: Not working without zlib"

Changed paths:
    devtools/create_teenagent/create_teenagent.cpp
    dists/engine-data/teenagent.dat
    engines/teenagent/resources.cpp



diff --git a/devtools/create_teenagent/create_teenagent.cpp b/devtools/create_teenagent/create_teenagent.cpp
index 9551acb..fc2ba4d 100644
--- a/devtools/create_teenagent/create_teenagent.cpp
+++ b/devtools/create_teenagent/create_teenagent.cpp
@@ -106,7 +106,5 @@ int main(int argc, char *argv[]) {
 	fclose(fin);
 	fclose(fout);
 
-	fprintf(stderr, "please run \"gzip -n %s\"\n", dat_name);
-
 	return 0;
 }
diff --git a/dists/engine-data/teenagent.dat b/dists/engine-data/teenagent.dat
index 0dd31da..1492326 100644
Binary files a/dists/engine-data/teenagent.dat and b/dists/engine-data/teenagent.dat differ
diff --git a/engines/teenagent/resources.cpp b/engines/teenagent/resources.cpp
index 597ca67..74ebae9 100644
--- a/engines/teenagent/resources.cpp
+++ b/engines/teenagent/resources.cpp
@@ -22,7 +22,6 @@
 #include "teenagent/resources.h"
 #include "teenagent/teenagent.h"
 #include "common/textconsole.h"
-#include "common/zlib.h"
 
 namespace TeenAgent {
 
@@ -69,24 +68,37 @@ bool Resources::loadArchives(const ADGameDescription *gd) {
 		warning("%s", errorMessage.c_str());
 		return false;
 	}
-	Common::SeekableReadStream *dat = Common::wrapCompressedReadStream(dat_file);
-	cseg.read(dat, 0xb3b0);
-	dseg.read(dat, 0xe790);
-	eseg.read(dat, 0x8be2);
-
-	delete dat;
-
-	{
-		FilePack varia;
-		varia.open("varia.res");
-		font7.load(varia, 7);
-		font7.width_pack = 1;
-		font7.height = 11;
-		font8.load(varia, 8);
-		font8.height = 31;
-		varia.close();
+
+	// Check if teenagent.dat is compressed (older versions of the file)
+	uint16 header = dat_file->readUint16BE();
+	bool isCompressed = (header == 0x1F8B ||
+				    ((header & 0x0F00) == 0x0800 &&
+				    header % 31 == 0));
+	dat_file->seek(-2, SEEK_CUR);
+	
+	if (isCompressed) {
+		delete dat_file;
+		Common::String errorMessage = "The teenagent.dat file is compressed. Please decompress it";
+		GUIErrorMessage(errorMessage);
+		warning("%s", errorMessage.c_str());
+		return false;
 	}
 
+	cseg.read(dat_file, 0xb3b0);
+	dseg.read(dat_file, 0xe790);
+	eseg.read(dat_file, 0x8be2);
+
+	delete dat_file;
+
+	FilePack varia;
+	varia.open("varia.res");
+	font7.load(varia, 7);
+	font7.width_pack = 1;
+	font7.height = 11;
+	font8.load(varia, 8);
+	font8.height = 31;
+	varia.close();
+
 	off.open("off.res");
 	on.open("on.res");
 	ons.open("ons.res");






More information about the Scummvm-git-logs mailing list