[Scummvm-cvs-logs] scummvm master -> 4c5950dff2314aa50cf240543024dab7a13242a6

bluegr md5 at scummvm.org
Mon Mar 14 20:34:40 CET 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4c5950dff2 SCI: Fixed find_callk


Commit: 4c5950dff2314aa50cf240543024dab7a13242a6
    https://github.com/scummvm/scummvm/commit/4c5950dff2314aa50cf240543024dab7a13242a6
Author: md5 (md5 at scummvm.org)
Date: 2011-03-14T12:33:07-07:00

Commit Message:
SCI: Fixed find_callk

Create a custom segment manager within find_callk, so that the game's
segment manager won't be affected by loading and unloading scripts in there

Changed paths:
    engines/sci/console.cpp



diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index b13ae3c..db93333 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -2717,7 +2717,9 @@ void Console::printKernelCallsFound(int kernelFuncNum, bool showFoundScripts) {
 
 	int scriptSegment;
 	Script *script;
-	SegManager *segMan = _engine->getEngineState()->_segMan;
+	// Create a custom segment manager here, so that the game's segment
+	// manager won't be affected by loading and unloading scripts here.
+	SegManager *customSegMan = new SegManager(_engine->getResMan());
 
 	while (itr != resources->end()) {
 		// Ignore specific leftover scripts, which require other non-existing scripts
@@ -2729,15 +2731,15 @@ void Console::printKernelCallsFound(int kernelFuncNum, bool showFoundScripts) {
 		}
 
 		// Load script
-		scriptSegment = segMan->instantiateScript(itr->getNumber());
-		script = segMan->getScript(scriptSegment);
+		scriptSegment = customSegMan->instantiateScript(itr->getNumber());
+		script = customSegMan->getScript(scriptSegment);
 
 		// Iterate through all the script's objects
 		ObjMap::iterator it;
 		const ObjMap::iterator end = script->_objects.end();
 		for (it = script->_objects.begin(); it != end; ++it) {
-			const Object *obj = segMan->getObject(it->_value.getPos());
-			const char *objName = segMan->getObjectName(it->_value.getPos());
+			const Object *obj = customSegMan->getObject(it->_value.getPos());
+			const char *objName = customSegMan->getObjectName(it->_value.getPos());
 
 			// Now dissassemble each method of the script object
 			for (uint16 i = 0; i < obj->getMethodCount(); i++) {
@@ -2780,10 +2782,12 @@ void Console::printKernelCallsFound(int kernelFuncNum, bool showFoundScripts) {
 			}	// for (uint16 i = 0; i < obj->getMethodCount(); i++)
 		}	// for (it = script->_objects.begin(); it != end; ++it)
 
-		segMan->uninstantiateScript(itr->getNumber());
+		customSegMan->uninstantiateScript(itr->getNumber());
 		++itr;
 	}
 
+	delete customSegMan;
+
 	delete resources;
 }
 






More information about the Scummvm-git-logs mailing list