aboutsummaryrefslogtreecommitdiff
path: root/engines/teenagent/resources.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2012-07-15 02:27:51 +0300
committerFilippos Karapetis2012-07-15 02:27:51 +0300
commitc54f95ee86b001676fbdc44aa5e1c74191fae459 (patch)
tree740f3181ec080cfdefa84a7b0e8e8cdabc381c97 /engines/teenagent/resources.cpp
parent13a5e5812af635477626de6a13f54ed8b8e4afa5 (diff)
downloadscummvm-rg350-c54f95ee86b001676fbdc44aa5e1c74191fae459.tar.gz
scummvm-rg350-c54f95ee86b001676fbdc44aa5e1c74191fae459.tar.bz2
scummvm-rg350-c54f95ee86b001676fbdc44aa5e1c74191fae459.zip
TEENAGENT: Readd the zlib code, to maintain backwards compatibility
Diffstat (limited to 'engines/teenagent/resources.cpp')
-rw-r--r--engines/teenagent/resources.cpp28
1 files changed, 9 insertions, 19 deletions
diff --git a/engines/teenagent/resources.cpp b/engines/teenagent/resources.cpp
index 74ebae9c9b..49a429d5b7 100644
--- a/engines/teenagent/resources.cpp
+++ b/engines/teenagent/resources.cpp
@@ -22,6 +22,7 @@
#include "teenagent/resources.h"
#include "teenagent/teenagent.h"
#include "common/textconsole.h"
+#include "common/zlib.h"
namespace TeenAgent {
@@ -69,26 +70,15 @@ bool Resources::loadArchives(const ADGameDescription *gd) {
return false;
}
- // 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);
+ // teenagent.dat used to be compressed with zlib compression. The usage of
+ // zlib here is no longer needed, and it's maintained only for backwards
+ // compatibility.
+ Common::SeekableReadStream *dat = Common::wrapCompressedReadStream(dat_file);
+ cseg.read(dat, 0xb3b0);
+ dseg.read(dat, 0xe790);
+ eseg.read(dat, 0x8be2);
- delete dat_file;
+ delete dat;
FilePack varia;
varia.open("varia.res");