[Scummvm-cvs-logs] CVS: scummvm/scumm resource.cpp,1.343,1.344

Eugene Sandulenko sev at users.sourceforge.net
Wed Oct 19 12:29:19 CEST 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2458

Modified Files:
	resource.cpp 
Log Message:
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.


Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.343
retrieving revision 1.344
diff -u -d -r1.343 -r1.344
--- resource.cpp	19 Oct 2005 12:15:36 -0000	1.343
+++ resource.cpp	19 Oct 2005 19:26:53 -0000	1.344
@@ -50,6 +50,8 @@
 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 @@
 		_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 @@
 	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;





More information about the Scummvm-git-logs mailing list