[Scummvm-cvs-logs] SF.net SVN: scummvm:[46864] scummvm/trunk/engines/sci/engine
waltervn at users.sourceforge.net
waltervn at users.sourceforge.net
Sat Jan 2 00:48:23 CET 2010
Revision: 46864
http://scummvm.svn.sourceforge.net/scummvm/?rev=46864&view=rev
Author: waltervn
Date: 2010-01-01 23:48:22 +0000 (Fri, 01 Jan 2010)
Log Message:
-----------
SCI: Fix segfault in dual-language KQ5.
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/seg_manager.cpp
scummvm/trunk/engines/sci/engine/segment.h
scummvm/trunk/engines/sci/engine/vm.cpp
Modified: scummvm/trunk/engines/sci/engine/seg_manager.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/seg_manager.cpp 2010-01-01 22:57:08 UTC (rev 46863)
+++ scummvm/trunk/engines/sci/engine/seg_manager.cpp 2010-01-01 23:48:22 UTC (rev 46864)
@@ -568,6 +568,13 @@
return obj;
}
+void Script::scriptObjRemove(reg_t obj_pos) {
+ if (getSciVersion() < SCI_VERSION_1_1)
+ obj_pos.offset += 8;
+
+ _objects.erase(obj_pos.toUint16());
+}
+
LocalVariables *SegManager::allocLocalsSegment(Script *scr, int count) {
if (!count) { // No locals
scr->_localsSegment = 0;
Modified: scummvm/trunk/engines/sci/engine/segment.h
===================================================================
--- scummvm/trunk/engines/sci/engine/segment.h 2010-01-01 22:57:08 UTC (rev 46863)
+++ scummvm/trunk/engines/sci/engine/segment.h 2010-01-01 23:48:22 UTC (rev 46864)
@@ -381,6 +381,12 @@
Object *scriptObjInit(reg_t obj_pos);
/**
+ * Removes a script object
+ * @param obj_pos Location (segment, offset) of the object.
+ */
+ void scriptObjRemove(reg_t obj_pos);
+
+ /**
* Processes a relocation block witin a script
* This function is idempotent, but it must only be called after all
* objects have been instantiated, or a run-time error will occur.
Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp 2010-01-01 22:57:08 UTC (rev 46863)
+++ scummvm/trunk/engines/sci/engine/vm.cpp 2010-01-01 23:48:22 UTC (rev 46864)
@@ -1644,11 +1644,18 @@
obj->setSpeciesSelector(INST_LOOKUP_CLASS(obj->getSpeciesSelector().offset));
Object *baseObj = segMan->getObject(obj->getSpeciesSelector());
- obj->setVarCount(baseObj->getVarCount());
- // Copy base from species class, as we need its selector IDs
- obj->_baseObj = baseObj->_baseObj;
- obj->setSuperClassSelector(INST_LOOKUP_CLASS(obj->getSuperClassSelector().offset));
+ if (baseObj) {
+ obj->setVarCount(baseObj->getVarCount());
+ // Copy base from species class, as we need its selector IDs
+ obj->_baseObj = baseObj->_baseObj;
+
+ obj->setSuperClassSelector(INST_LOOKUP_CLASS(obj->getSuperClassSelector().offset));
+ } else {
+ warning("Failed to locate base object for object at %04X:%04X; skipping", PRINT_REG(addr));
+
+ scr->scriptObjRemove(addr);
+ }
} // if object or class
break;
case SCI_OBJ_POINTERS: // A relocation table
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