aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormd52011-03-14 21:31:28 +0200
committermd52011-03-14 21:33:07 +0200
commit4c5950dff2314aa50cf240543024dab7a13242a6 (patch)
tree4d35320647191a8f6cd9971404d42a0cdc12e0a9
parent9e7ee4953ec5ca41a30c178ce778149a86f07b8f (diff)
downloadscummvm-rg350-4c5950dff2314aa50cf240543024dab7a13242a6.tar.gz
scummvm-rg350-4c5950dff2314aa50cf240543024dab7a13242a6.tar.bz2
scummvm-rg350-4c5950dff2314aa50cf240543024dab7a13242a6.zip
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
-rw-r--r--engines/sci/console.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index b13ae3c420..db93333b81 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;
}