[Scummvm-cvs-logs] scummvm master -> f4e395b4a185ac4aabd4e0a19c7e00682365d893

bluegr md5 at scummvm.org
Sun Jul 15 01:47:55 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:
f4e395b4a1 TEENAGENT: Show a verbose warning when a compressed data file is used and zlib hasn't been included in the executable


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

Commit Message:
TEENAGENT: Show a verbose warning when a compressed data file is used and zlib hasn't been included in the executable

Changed paths:
    engines/teenagent/resources.cpp



diff --git a/engines/teenagent/resources.cpp b/engines/teenagent/resources.cpp
index 49a429d..0dc6ea2 100644
--- a/engines/teenagent/resources.cpp
+++ b/engines/teenagent/resources.cpp
@@ -74,10 +74,27 @@ bool Resources::loadArchives(const ADGameDescription *gd) {
 	// zlib here is no longer needed, and it's maintained only for backwards
 	// compatibility.
 	Common::SeekableReadStream *dat = Common::wrapCompressedReadStream(dat_file);
+
+#if !defined(USE_ZLIB)
+	uint16 header = dat->readUint16BE();
+	bool isCompressed = (header == 0x1F8B ||
+				     ((header & 0x0F00) == 0x0800 &&
+				      header % 31 == 0));
+	dat->seek(-2, SEEK_CUR);
+
+	if (isCompressed) {
+		// teenagent.dat is compressed, but zlib hasn't been compiled in
+		delete dat;
+		Common::String errorMessage = "The teenagent.dat file is compressed and zlib hasn't been included in this executable. Please decompress it";
+		GUIErrorMessage(errorMessage);
+		warning("%s", errorMessage.c_str());
+		return false;
+	}
+#endif
+
 	cseg.read(dat, 0xb3b0);
 	dseg.read(dat, 0xe790);
 	eseg.read(dat, 0x8be2);
-
 	delete dat;
 
 	FilePack varia;






More information about the Scummvm-git-logs mailing list