[Scummvm-cvs-logs] CVS: scummvm/scumm object.cpp,1.150,1.151 script.cpp,1.136,1.137 script_v2.cpp,2.217,2.218 scumm.h,1.330,1.331 scummvm.cpp,2.495,2.496

Travis Howell kirben at users.sourceforge.net
Wed Dec 10 22:09:02 CET 2003


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

Modified Files:
	object.cpp script.cpp script_v2.cpp scumm.h scummvm.cpp 
Log Message:

Add option to enable copy protection in SCUMM games, which ScummVM disable it by default.


Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/object.cpp,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -d -r1.150 -r1.151
--- object.cpp	6 Dec 2003 15:59:17 -0000	1.150
+++ object.cpp	11 Dec 2003 06:08:43 -0000	1.151
@@ -124,26 +124,22 @@
 	_objectOwnerTable[obj] = owner;
 }
 
-#ifndef BYPASS_COPY_PROT
-#define BYPASS_COPY_PROT
-#endif
-
 int ScummEngine::getState(int obj) {
 	checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getState");
 
-#if defined(BYPASS_COPY_PROT)
-	// I knew LucasArts sold cracked copies of the original Maniac Mansion,
-	// at least as part of Day of the Tentacle. Apparently they also sold
-	// cracked versions of the enhanced version. At least in Germany.
-	//
-	// This will keep the security door open at all times. I can only
-	// assume that 182 and 193 each correspond to one particular side of
-	// the it. Fortunately it does not prevent frustrated players from
-	// blowing up the mansion, should they feel the urge to.
+	if (!_copyProtection) {
+		// I knew LucasArts sold cracked copies of the original Maniac Mansion,
+		// at least as part of Day of the Tentacle. Apparently they also sold
+		// cracked versions of the enhanced version. At least in Germany.
+		//
+		// This will keep the security door open at all times. I can only
+		// assume that 182 and 193 each correspond to one particular side of
+		// the it. Fortunately it does not prevent frustrated players from
+		// blowing up the mansion, should they feel the urge to.
 
-	if (_gameId == GID_MANIAC && (obj == 182 || obj == 193))
-		_objectStateTable[obj] |= 0x08;
-#endif
+		if (_gameId == GID_MANIAC && (obj == 182 || obj == 193))
+			_objectStateTable[obj] |= 0x08;
+	}
 
 	return _objectStateTable[obj];
 }

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -d -r1.136 -r1.137
--- script.cpp	3 Oct 2003 18:33:55 -0000	1.136
+++ script.cpp	11 Dec 2003 06:08:43 -0000	1.137
@@ -116,10 +116,6 @@
 	runScriptNested(slot);
 }
 
-#ifndef BYPASS_COPY_PROT
-#define BYPASS_COPY_PROT
-#endif
-
 void ScummEngine::initializeLocals(int slot, int *vars) {
 	int i;
 	if (!vars) {
@@ -451,9 +447,11 @@
 
 int ScummEngine::readVar(uint var) {
 	int a;
-#if defined(BYPASS_COPY_PROT)
-	static byte copyprotbypassed = false;
-#endif
+	static byte copyprotbypassed;
+	if (!_copyProtection)
+		copyprotbypassed = false;
+	else
+		copyprotbypassed = true;
 
 	debug(9, "readvar(%d)", var);
 
@@ -467,15 +465,16 @@
 	}
 
 	if (!(var & 0xF000)) {
-#if defined(BYPASS_COPY_PROT)
-		if (var == 490 && _gameId == GID_MONKEY2 && !copyprotbypassed) {
-			copyprotbypassed = true;
-			var = 518;
-		} else if (var == 179 && (_gameId == GID_MONKEY_VGA || _gameId == GID_MONKEY_EGA) && !copyprotbypassed) {
-			copyprotbypassed = true;
-			var = 266;
+		if (!_copyProtection) {
+			if (var == 490 && _gameId == GID_MONKEY2 && !copyprotbypassed) {
+				copyprotbypassed = true;
+				var = 518;
+			} else if (var == 179 && (_gameId == GID_MONKEY_VGA || _gameId == GID_MONKEY_EGA) && !copyprotbypassed) {
+				copyprotbypassed = true;
+				var = 266;
+			}
 		}
-#endif
+
 		if (_gameId == GID_LOOM256 && var == VAR_NOSUBTITLES) {
 			return _noSubtitles;	
 		}
@@ -490,27 +489,28 @@
 			int bit = var & 0xF;
 			var = (var >> 4) & 0xFF;
 
-#if defined(BYPASS_COPY_PROT)
-			// INDY3, EGA Loom and, apparently, Zak256 check this
-			// during the game...
-			if (_gameId == GID_INDY3 && (_features & GF_OLD_BUNDLE) && var == 94 && bit == 4) {
-				return 0;
-//			} else if (_gameId == GID_LOOM && var == 221 && bit == 14) {	// For Mac Loom
-			} else if (_gameId == GID_LOOM && var == 214 && bit == 15) {	// For PC Loom
-				return 0;
-			} else if (_gameId == GID_ZAK256 && var == 151 && bit == 8) {
-				return 0;
+			if (!_copyProtection) {
+				// INDY3, EGA Loom and, apparently, Zak256 check this
+				// during the game...
+				if (_gameId == GID_INDY3 && (_features & GF_OLD_BUNDLE) && var == 94 && bit == 4) {
+					return 0;
+//				} else if (_gameId == GID_LOOM && var == 221 && bit == 14) {	// For Mac Loom
+				} else if (_gameId == GID_LOOM && var == 214 && bit == 15) {	// For PC Loom
+					return 0;
+				} else if (_gameId == GID_ZAK256 && var == 151 && bit == 8) {
+					return 0;
+				}
 			}
-#endif
+
 			checkRange(_numVariables - 1, 0, var, "Variable %d out of range(rzb)");
 			return (_scummVars[ var ] & ( 1 << bit ) ) ? 1 : 0;
 		} else {
 			var &= 0x7FFF;
-#if defined(BYPASS_COPY_PROT)
-			if (_gameId == GID_INDY3 && (_features & GF_FMTOWNS) && var == 1508) {
-				return 0;
+			if (!_copyProtection) {
+				if (_gameId == GID_INDY3 && (_features & GF_FMTOWNS) && var == 1508)
+					return 0;
 			}
-#endif
+
 			checkRange(_numBitVariables - 1, 0, var, "Bit variable %d out of range(r)");
 			return (_bitVars[var >> 3] & (1 << (var & 7))) ? 1 : 0;
 		}

Index: script_v2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v2.cpp,v
retrieving revision 2.217
retrieving revision 2.218
diff -u -d -r2.217 -r2.218
--- script_v2.cpp	26 Nov 2003 08:58:00 -0000	2.217
+++ script_v2.cpp	11 Dec 2003 06:08:43 -0000	2.218
@@ -1104,13 +1104,13 @@
 void ScummEngine_v2::o2_startScript() {
 	int script = getVarOrDirectByte(PARAM_1);
 
-#if defined(BYPASS_COPY_PROT)
-	// The enhanced version of Zak McKracken included in the
-	// SelectWare Classic Collection bundle used CD check instead
-	// of the usual key code check at airports.
-	if ((_gameId == GID_ZAK) && (script == 15) && (_roomResource == 45))
-		return;
-#endif
+	if (!_copyProtection) {
+		// The enhanced version of Zak McKracken included in the
+		// SelectWare Classic Collection bundle used CD check instead
+		// of the usual key code check at airports.
+		if ((_gameId == GID_ZAK) && (script == 15) && (_roomResource == 45))
+			return;
+	}
 
 	runScript(script, 0, 0, 0);
 }

Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.330
retrieving revision 1.331
diff -u -d -r1.330 -r1.331
--- scumm.h	6 Dec 2003 05:47:24 -0000	1.330
+++ scumm.h	11 Dec 2003 06:08:43 -0000	1.331
@@ -967,6 +967,7 @@
 	int _saveSound;
 	bool _native_mt32;
 	int _midiDriver; // Use the MD_ values from mididrv.h
+	bool _copyProtection;
 	bool _demoMode;
 	bool _confirmExit;
 public:

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.495
retrieving revision 2.496
diff -u -d -r2.495 -r2.496
--- scummvm.cpp	11 Dec 2003 03:51:32 -0000	2.495
+++ scummvm.cpp	11 Dec 2003 06:08:43 -0000	2.496
@@ -629,6 +629,7 @@
 
 	_midiDriver = GameDetector::detectMusicDriver(gs.midi);
 
+	_copyProtection = ConfMan.getBool("copy_protection");
 	_demoMode = ConfMan.getBool("demo_mode");
 	_noSubtitles = ConfMan.getBool("subtitles");
 	_noSubtitles ^=1;





More information about the Scummvm-git-logs mailing list