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

svn-id: r11571
This commit is contained in:
Travis Howell 2003-12-11 06:08:43 +00:00
parent 2ef887fd44
commit 3d6461d30f
6 changed files with 57 additions and 53 deletions

View File

@ -81,6 +81,7 @@ static const char USAGE_STRING[] =
" --floppy-intro Use floppy version intro for Beneath a Steel Sky CD\n"
#endif
#ifndef DISABLE_SCUMM
" --copy-protection Enable the original copy protection in SCUMM games\n"
" --demo-mode Start demo mode of Maniac Mansion (Classic version)\n"
" --tempo=NUM Set music tempo (in percent, 50-200) for SCUMM games\n"
" (default: 100)\n"
@ -162,6 +163,7 @@ GameDetector::GameDetector() {
ConfMan.registerDefault("save_slot", -1);
#ifndef DISABLE_SCUMM
ConfMan.registerDefault("copy_protection", false);
ConfMan.registerDefault("demo_mode", false);
ConfMan.registerDefault("talkspeed", 60);
ConfMan.registerDefault("tempo", 0);
@ -448,6 +450,10 @@ void GameDetector::parseCommandLine(int argc, char **argv) {
ConfMan.set("talkspeed", (int)strtol(option, 0, 10), kTransientDomain);
END_OPTION
DO_LONG_OPTION_BOOL("copy-protection")
ConfMan.set("copy_protection", cmdValue, kTransientDomain);
END_OPTION
DO_LONG_OPTION_BOOL("demo-mode")
ConfMan.set("demo_mode", cmdValue, kTransientDomain);
END_OPTION

View File

@ -124,26 +124,22 @@ void ScummEngine::putOwner(int obj, int owner) {
_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];
}

View File

@ -116,10 +116,6 @@ void ScummEngine::runObjectScript(int object, int entry, bool freezeResistant, b
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::fetchScriptWordSigned() {
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 @@ int ScummEngine::readVar(uint var) {
}
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 ScummEngine::readVar(uint var) {
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;
}

View File

@ -1104,13 +1104,13 @@ void ScummEngine_v2::o2_putActor() {
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);
}

View File

@ -967,6 +967,7 @@ protected:
int _saveSound;
bool _native_mt32;
int _midiDriver; // Use the MD_ values from mididrv.h
bool _copyProtection;
bool _demoMode;
bool _confirmExit;
public:

View File

@ -629,6 +629,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
_midiDriver = GameDetector::detectMusicDriver(gs.midi);
_copyProtection = ConfMan.getBool("copy_protection");
_demoMode = ConfMan.getBool("demo_mode");
_noSubtitles = ConfMan.getBool("subtitles");
_noSubtitles ^=1;