[Scummvm-cvs-logs] SF.net SVN: scummvm:[52316] scummvm/trunk/engines/gob

strangerke at users.sourceforge.net strangerke at users.sourceforge.net
Tue Aug 24 08:25:08 CEST 2010


Revision: 52316
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52316&view=rev
Author:   strangerke
Date:     2010-08-24 06:25:08 +0000 (Tue, 24 Aug 2010)

Log Message:
-----------
GOB: Avoid a crash in the protection screen of Fascination (PC).
When failing the protection check, the script of the PC version was writing on purpose everywhere in the memory to hang the computer. This resulted in a crash in Scummvm, fixed by this workaround. (Tested on the 256 Col version french and german)

Modified Paths:
--------------
    scummvm/trunk/engines/gob/inter.h
    scummvm/trunk/engines/gob/inter_fascin.cpp

Modified: scummvm/trunk/engines/gob/inter.h
===================================================================
--- scummvm/trunk/engines/gob/inter.h	2010-08-23 23:43:32 UTC (rev 52315)
+++ scummvm/trunk/engines/gob/inter.h	2010-08-24 06:25:08 UTC (rev 52316)
@@ -432,6 +432,7 @@
 
 	void oFascin_playProtracker(OpGobParams &params);
 
+	bool oFascin_repeatUntil(OpFuncParams &params);
 	bool oFascin_assign(OpFuncParams &params);
 	bool oFascin_copySprite(OpFuncParams &params);
 	bool oFascin_keyFunc(OpFuncParams &params);

Modified: scummvm/trunk/engines/gob/inter_fascin.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_fascin.cpp	2010-08-23 23:43:32 UTC (rev 52315)
+++ scummvm/trunk/engines/gob/inter_fascin.cpp	2010-08-24 06:25:08 UTC (rev 52316)
@@ -88,6 +88,7 @@
 void Inter_Fascination::setupOpcodesFunc() {
 	Inter_v2::setupOpcodesFunc();
 
+	OPCODEFUNC(0x06, oFascin_repeatUntil);
 	OPCODEFUNC(0x09, oFascin_assign);
 	OPCODEFUNC(0x32, oFascin_copySprite);
 }
@@ -113,6 +114,43 @@
 	OPCODEGOB(1002, o2_stopProtracker);
 }
 
+bool Inter_Fascination::oFascin_repeatUntil(OpFuncParams &params) {
+	int16 size;
+	bool flag;
+
+	_nestLevel[0]++;
+
+	uint32 blockPos = _vm->_game->_script->pos();
+
+	do {
+		_vm->_game->_script->seek(blockPos);
+		size = _vm->_game->_script->peekUint16(2) + 2;
+
+		funcBlock(1);
+
+		_vm->_game->_script->seek(blockPos + size + 1);
+
+		flag = _vm->_game->_script->evalBoolResult();
+
+		// WORKAROUND: The script of the PC version of Fascination, when the protection check
+		// fails, writes on purpose everywhere in the memory in order to hang the computer. 
+		// This results in a crash in Scummvm. This workaround avoids that crash.
+		if (_vm->getPlatform() == Common::kPlatformPC) {
+			if ((!scumm_stricmp(_vm->_game->_curTotFile, "INTRO1.TOT") && (blockPos == 3533)) ||
+				(!scumm_stricmp(_vm->_game->_curTotFile, "INTRO2.TOT") && (blockPos == 3519)))
+				_terminate = 1;
+		}
+	} while (!flag && !_break && !_terminate && !_vm->shouldQuit());
+
+	_nestLevel[0]--;
+
+	if (*_breakFromLevel > -1) {
+		_break = false;
+		*_breakFromLevel = -1;
+	}
+	return false;
+}
+
 bool Inter_Fascination::oFascin_assign(OpFuncParams &params) {
 	byte destType = _vm->_game->_script->peekByte();
 	int16 dest = _vm->_game->_script->readVarIndex();
@@ -322,4 +360,5 @@
 void Inter_Fascination::oFascin_playProtracker(OpGobParams &params) {
 	_vm->_sound->protrackerPlay("mod.extasy");
 }
+
 } // End of namespace Gob


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list