aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2005-10-19 19:26:53 +0000
committerEugene Sandulenko2005-10-19 19:26:53 +0000
commit8527af69273cbeb7b0cf889bb16ea54edf115ff4 (patch)
treee44d0f5ef8bc03a19bbd9abaca496095a8d5b3ce
parent2e02a160f473b71d94d931a1e5552d2386bb9052 (diff)
downloadscummvm-rg350-8527af69273cbeb7b0cf889bb16ea54edf115ff4.tar.gz
scummvm-rg350-8527af69273cbeb7b0cf889bb16ea54edf115ff4.tar.bz2
scummvm-rg350-8527af69273cbeb7b0cf889bb16ea54edf115ff4.zip
There are almost 2 dozens of HE games provided as time limited full games.
Their data is encrypted by strong encryption technology ActiveMark. Now we detect these games and refuse to run them. User is warned accordingly. svn-id: r19187
-rw-r--r--scumm/resource.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/scumm/resource.cpp b/scumm/resource.cpp
index 59bfca15ed..367a437e18 100644
--- a/scumm/resource.cpp
+++ b/scumm/resource.cpp
@@ -50,6 +50,8 @@ extern const char *resTypeFromId(int id);
static uint16 newTag2Old(uint32 newTag);
static const byte *findResourceSmall(uint32 tag, const byte *searchin);
+static bool checkTryMedia(BaseScummFile *handle);
+
/* Open a room */
void ScummEngine::openRoom(const int room) {
@@ -361,6 +363,15 @@ void ScummEngine::readIndexFile() {
_fileHandle->seek(0, SEEK_SET);
}
+#ifndef DISABLE_HE
+ if (checkTryMedia(_fileHandle)) {
+ displayMessage(NULL, "You're trying to run game encrypted by ActiveMark. This is not supported.");
+ _quit = true;
+
+ return;
+ }
+#endif
+
while (true) {
blocktype = fileReadDword();
itemsize = _fileHandle->readUint32BE();
@@ -378,6 +389,40 @@ void ScummEngine::readIndexFile() {
closeRoom();
}
+
+#ifndef DISABLE_HE
+
+#define TRYMEDIA_MARK_LEN 6
+
+bool checkTryMedia(BaseScummFile *handle) {
+ byte buf[TRYMEDIA_MARK_LEN];
+ bool matched;
+ const byte magic[2][TRYMEDIA_MARK_LEN] =
+ {{ 0x00, 'T', 'M', 'S', 'A', 'M' },
+ { 'i', '=', '$', ':', '(', '$' }}; // Same but 0x69 xored
+
+ handle->read(buf, TRYMEDIA_MARK_LEN);
+
+ for (int i = 0; i < 2; i++) {
+ matched = true;
+ for (int j = 0; j < TRYMEDIA_MARK_LEN; j++)
+ if (buf[j] != magic[i][j])
+ matched = false;
+
+ if (matched)
+ break;
+ }
+
+ if (matched)
+ return true;
+
+ handle->seek(0, SEEK_SET);
+
+ return false;
+}
+#endif
+
+
#ifndef DISABLE_SCUMM_7_8
void ScummEngine_v7::readIndexBlock(uint32 blocktype, uint32 itemsize) {
int num;