aboutsummaryrefslogtreecommitdiff
path: root/engines/teenagent/resources.cpp
diff options
context:
space:
mode:
authorD G Turner2012-07-16 01:24:40 +0100
committerD G Turner2012-07-16 01:24:40 +0100
commite73dffa57cbe65ffb10af4f2a5b47f644269caab (patch)
tree191c3e8e2ebdf81dec58d4006a98ca20a688120b /engines/teenagent/resources.cpp
parent9669b73ca811af9672215748e92acb3f77805b75 (diff)
parent1fffbe40ceb82bec77479c56176abeff0d2bd5e5 (diff)
downloadscummvm-rg350-e73dffa57cbe65ffb10af4f2a5b47f644269caab.tar.gz
scummvm-rg350-e73dffa57cbe65ffb10af4f2a5b47f644269caab.tar.bz2
scummvm-rg350-e73dffa57cbe65ffb10af4f2a5b47f644269caab.zip
Merge branch 'master' into teenagentRefactor
Conflicts: engines/teenagent/resources.cpp
Diffstat (limited to 'engines/teenagent/resources.cpp')
-rw-r--r--engines/teenagent/resources.cpp28
1 files changed, 25 insertions, 3 deletions
diff --git a/engines/teenagent/resources.cpp b/engines/teenagent/resources.cpp
index 500b44cfe3..bd09b08522 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/translation.h"
#include "common/zlib.h"
namespace TeenAgent {
@@ -87,16 +88,37 @@ bool Resources::loadArchives(const ADGameDescription *gd) {
Common::File *dat_file = new Common::File();
if (!dat_file->open("teenagent.dat")) {
delete dat_file;
- Common::String errorMessage = "You're missing the 'teenagent.dat' file. Get it from the ScummVM website";
- GUIErrorMessage(errorMessage);
+ Common::String errorMessage = _("You're missing the 'teenagent.dat' file. Get it from the ScummVM website");
warning("%s", errorMessage.c_str());
+ GUIErrorMessage(errorMessage);
return false;
}
+
+ // 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);
+
+#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");
+ warning("%s", errorMessage.c_str());
+ GUIErrorMessage(errorMessage);
+ return false;
+ }
+#endif
+
cseg.read(dat, CSEG_SIZE);
dseg.read(dat, DSEG_SIZE);
eseg.read(dat, ESEG_SIZE);
-
delete dat;
precomputeDialogOffsets();