[Scummvm-cvs-logs] CVS: scummvm/scumm script.cpp,1.114,1.115

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Sun Jun 15 23:19:16 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv1041

Modified Files:
	script.cpp 
Log Message:
The code to bypass the EGA Loom copy protection (which is necessary since
LucasArts have been selling cracked copies themselves) turned out to be
interfering with the ability to learn the fourth note under certain
conditions.

I've deviced an alternative bypass which should be a great deal safer,
though it won't do anything to salvage older savegames.

Ironically, Endy told me recently that he didn't like the idea of basing
the copy protection bypasses on the value of _currentRoom, but in this case
I really don't have any better idea.


Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -d -r1.114 -r1.115
--- script.cpp	14 Jun 2003 12:23:30 -0000	1.114
+++ script.cpp	16 Jun 2003 06:18:30 -0000	1.115
@@ -116,6 +116,10 @@
 	runScriptNested(slot);
 }
 
+#ifndef BYPASS_COPY_PROT
+#define BYPASS_COPY_PROT
+#endif
+
 void Scumm::initializeLocals(int slot, int *vars) {
 	int i;
 	if (!vars) {
@@ -125,6 +129,26 @@
 		for (i = 0; i < 16; i++)
 			vm.localvar[slot][i] = vars[i];
 	}
+
+#if defined(BYPASS_COPY_PROT)
+	// Loom will set bit 15 of variable 214 to 1 if the user enters the
+	// wrong code. But this bit is also used later in the game to determine
+	// if the user has already learned the fourth note. Therefore any
+	// interfering directly with this variable is risky.
+	//
+	// Let's try an alternative solution instead. The correct code is
+	// stored in variables 82-85. Each time the user selects a symbol,
+	// its ID (0-11) is passed to room-69-203 as local variable 0. Variable
+	// 98 is 1, 2, 3 or 4 depending on how many symbols the player has
+	// selected yet.
+	//
+	// If the sum of variables 82-85 is 0, the "fail" bit will be set,
+	// regardless of the player's choice. I don't know why, but it does
+	// mean that it's safer to change local variable 0 than to change
+	// variables 82-85.
+	if (_gameId == GID_LOOM && _currentRoom == 69 && vm.slot[slot].number == 203)
+		vm.localvar[slot][0] = _scummVars[81 + _scummVars[98]];
+#endif
 }
 
 int Scumm::getVerbEntrypoint(int obj, int entry) {
@@ -444,10 +468,6 @@
 	return (int16)fetchScriptWord();
 }
 
-#ifndef BYPASS_COPY_PROT
-#define BYPASS_COPY_PROT
-#endif
-
 int Scumm::readVar(uint var) {
 	int a;
 #if defined(BYPASS_COPY_PROT)
@@ -491,9 +511,6 @@
 #if defined(BYPASS_COPY_PROT)
 			// INDY3 checks this during the game...
 			if (_gameId == GID_INDY3 && var == 94 && bit == 4) {
-				return 0;
-			} else if (_gameId == GID_LOOM && var == 214 && bit == 15 && !copyprotbypassed) {
-				copyprotbypassed = true;
 				return 0;
 			} else if (_gameId == GID_ZAK256 && var == 151 && bit == 8) {
 				return 0;





More information about the Scummvm-git-logs mailing list