aboutsummaryrefslogtreecommitdiff
path: root/engines/teenagent
diff options
context:
space:
mode:
authorFilippos Karapetis2012-07-15 02:47:06 +0300
committerFilippos Karapetis2012-07-15 02:47:06 +0300
commitf4e395b4a185ac4aabd4e0a19c7e00682365d893 (patch)
tree532749d30417c32f3c8732db562d582ac4c16c3b /engines/teenagent
parentc54f95ee86b001676fbdc44aa5e1c74191fae459 (diff)
downloadscummvm-rg350-f4e395b4a185ac4aabd4e0a19c7e00682365d893.tar.gz
scummvm-rg350-f4e395b4a185ac4aabd4e0a19c7e00682365d893.tar.bz2
scummvm-rg350-f4e395b4a185ac4aabd4e0a19c7e00682365d893.zip
TEENAGENT: Show a verbose warning when a compressed data file is used and zlib hasn't been included in the executable
Diffstat (limited to 'engines/teenagent')
-rw-r--r--engines/teenagent/resources.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/engines/teenagent/resources.cpp b/engines/teenagent/resources.cpp
index 49a429d5b7..0dc6ea2f3c 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;