[Scummvm-cvs-logs] SF.net SVN: scummvm:[55154] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Jan 7 21:24:49 CET 2011


Revision: 55154
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55154&view=rev
Author:   thebluegr
Date:     2011-01-07 20:24:49 +0000 (Fri, 07 Jan 2011)

Log Message:
-----------
SCI: Moved the handling of the op_line debug opcode inside readPMachineInstruction()

The handling has been moved inside readPMachineInstruction(), instead of run_vm(), as a
lot of parts of the code depend on this function handling all opcodes correctly (e.g. the
script dissassembler, the features class, find_callk etc)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/console.cpp
    scummvm/trunk/engines/sci/engine/vm.cpp

Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp	2011-01-07 19:31:19 UTC (rev 55153)
+++ scummvm/trunk/engines/sci/console.cpp	2011-01-07 20:24:49 UTC (rev 55154)
@@ -2771,16 +2771,6 @@
 						uint16 curJmpOffset = offset + (uint16)opparams[0];
 						if (curJmpOffset > maxJmpOffset)
 							maxJmpOffset = curJmpOffset;
-						// FIXME: There seems to be a bug in the way we handle the SCI2 debug opcode
-						// (i.e. 0x7e/0x3f), which is probably why the bugs below occur
-						if (maxJmpOffset >= script->getBufSize()) {
-							warning("Called from script %d, object %s, method %s(%d) with %d parameters", 
-								itr->getNumber(), objName, 
-								_engine->getKernel()->getSelectorName(obj->getFuncSelector(i)).c_str(), i, 0);
-							warning("Script %d has a jump to an invalid offset (%d, script size is %d) - adjusting", 
-									script->getScriptNumber(), maxJmpOffset, script->getBufSize());
-							maxJmpOffset = script->getBufSize() - 1;
-						}
 					}
 
 					// Check for end of function/script

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2011-01-07 19:31:19 UTC (rev 55153)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2011-01-07 20:24:49 UTC (rev 55154)
@@ -903,6 +903,22 @@
 		}
 	}
 
+	// Special handling of the op_line opcode
+	if (opcode == op_pushSelf) {
+		// Compensate for a bug in non-Sierra compilers, which seem to generate
+		// pushSelf instructions with the low bit set. This makes the following
+		// heuristic fail and leads to endless loops and crashes. Our
+		// interpretation of this seems correct, as other SCI tools, like for
+		// example SCI Viewer, have issues with these scripts (e.g. script 999
+		// in Circus Quest). Fixes bug #3038686.
+		if (!(extOpcode & 1) || g_sci->getGameId() == GID_FANMADE) {
+			// op_pushSelf: no adjustment necessary
+		} else {
+			// Debug opcode op_file, skip null-terminated string (file name)
+			while (src[offset++]) {}
+		}
+	}
+
 	return offset;
 }
 
@@ -1825,9 +1841,7 @@
 			if (!(extOpcode & 1) || g_sci->getGameId() == GID_FANMADE) {
 				PUSH32(s->xs->objp);
 			} else {
-				// Debug opcode op_file, skip null-terminated string (file name)
-				const byte *code_buf = scr->getBuf();
-				while (code_buf[s->xs->addr.pc.offset++]) ;
+				// Debug opcode op_file
 			}
 			break;
 


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