mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-07 10:48:43 +00:00
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
This commit is contained in:
parent
9e7ee4953e
commit
4c5950dff2
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user