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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Jun 18 01:50:29 CEST 2010


Revision: 49973
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49973&view=rev
Author:   thebluegr
Date:     2010-06-17 23:50:28 +0000 (Thu, 17 Jun 2010)

Log Message:
-----------
Strict mode: Changed several warnings due to logic bugs into errors. If an error pops up from these ones, please add the game where it occurred and the steps to reproduce the error before turning it into a warning

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kernel.cpp
    scummvm/trunk/engines/sci/engine/kmovement.cpp
    scummvm/trunk/engines/sci/engine/savegame.cpp
    scummvm/trunk/engines/sci/engine/script.cpp
    scummvm/trunk/engines/sci/engine/segment.cpp
    scummvm/trunk/engines/sci/engine/segment.h
    scummvm/trunk/engines/sci/engine/selector.cpp
    scummvm/trunk/engines/sci/engine/state.cpp
    scummvm/trunk/engines/sci/engine/vm.cpp
    scummvm/trunk/engines/sci/graphics/ports.cpp
    scummvm/trunk/engines/sci/sound/drivers/adlib.cpp
    scummvm/trunk/engines/sci/sound/music.cpp

Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp	2010-06-17 23:45:38 UTC (rev 49972)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp	2010-06-17 23:50:28 UTC (rev 49973)
@@ -640,7 +640,7 @@
 		return 0; // Invalid
 
 	if (!mobj->isValidOffset(reg.offset))
-		warning("[KERN] ref %04x:%04x is invalid", PRINT_REG(reg));
+		error("[KERN] ref %04x:%04x is invalid", PRINT_REG(reg));
 
 	switch (mobj->getType()) {
 	case SEG_TYPE_SCRIPT:

Modified: scummvm/trunk/engines/sci/engine/kmovement.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmovement.cpp	2010-06-17 23:45:38 UTC (rev 49972)
+++ scummvm/trunk/engines/sci/engine/kmovement.cpp	2010-06-17 23:50:28 UTC (rev 49973)
@@ -373,14 +373,14 @@
 	s->r_acc = SIGNAL_REG;
 
 	if (!s->_segMan->isHeapObject(avoider)) {
-		warning("DoAvoider() where avoider %04x:%04x is not an object", PRINT_REG(avoider));
+		error("DoAvoider() where avoider %04x:%04x is not an object", PRINT_REG(avoider));
 		return NULL_REG;
 	}
 
 	client = readSelector(segMan, avoider, SELECTOR(client));
 
 	if (!s->_segMan->isHeapObject(client)) {
-		warning("DoAvoider() where client %04x:%04x is not an object", PRINT_REG(client));
+		error("DoAvoider() where client %04x:%04x is not an object", PRINT_REG(client));
 		return NULL_REG;
 	}
 
@@ -389,7 +389,7 @@
 
 	if (!s->_segMan->isHeapObject(mover)) {
 		if (mover.segment) {
-			warning("DoAvoider() where mover %04x:%04x is not an object", PRINT_REG(mover));
+			error("DoAvoider() where mover %04x:%04x is not an object", PRINT_REG(mover));
 		}
 		return s->r_acc;
 	}
@@ -450,7 +450,7 @@
 				angle -= 360;
 		}
 
-		warning("DoAvoider failed for avoider %04x:%04x", PRINT_REG(avoider));
+		error("DoAvoider failed for avoider %04x:%04x", PRINT_REG(avoider));
 	} else {
 		int heading = readSelectorValue(segMan, client, SELECTOR(heading));
 

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2010-06-17 23:45:38 UTC (rev 49972)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2010-06-17 23:50:28 UTC (rev 49973)
@@ -776,8 +776,8 @@
 
 			if (getSciVersion() < SCI_VERSION_1_1) {
 				if (!obj->initBaseObject(this, addr, false)) {
-					warning("Failed to locate base object for object at %04X:%04X; skipping", PRINT_REG(addr));
-					scr->scriptObjRemove(addr);
+					error("Failed to locate base object for object at %04X:%04X; skipping", PRINT_REG(addr));
+					//scr->scriptObjRemove(addr);
 				}
 			}
 		}
@@ -809,7 +809,7 @@
 				const Object *baseObj = getObject(seeker.getSpeciesSelector());
 				seeker.cloneFromObject(baseObj);
 				if (!baseObj)
-					warning("Clone entry without a base class: %d", j);
+					error("Clone entry without a base class: %d", j);
 			}	// end for
 			}	// end if
 	}	// end for

Modified: scummvm/trunk/engines/sci/engine/script.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/script.cpp	2010-06-17 23:45:38 UTC (rev 49972)
+++ scummvm/trunk/engines/sci/engine/script.cpp	2010-06-17 23:50:28 UTC (rev 49973)
@@ -277,8 +277,8 @@
 					obj->initSpecies(segMan, addr);
 
 					if (!obj->initBaseObject(segMan, addr)) {
-						warning("Failed to locate base object for object at %04X:%04X; skipping", PRINT_REG(addr));
-						scr->scriptObjRemove(addr);
+						error("Failed to locate base object for object at %04X:%04X; skipping", PRINT_REG(addr));
+						//scr->scriptObjRemove(addr);
 					}
 				}
 				break;

Modified: scummvm/trunk/engines/sci/engine/segment.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/segment.cpp	2010-06-17 23:45:38 UTC (rev 49972)
+++ scummvm/trunk/engines/sci/engine/segment.cpp	2010-06-17 23:50:28 UTC (rev 49973)
@@ -221,7 +221,7 @@
 			_localsOffset = 0;
 
 		if (_localsOffset + _localsCount * 2 + 1 >= (int)_bufSize) {
-			warning("Locals extend beyond end of script: offset %04x, count %d vs size %d", _localsOffset, _localsCount, _bufSize);
+			error("Locals extend beyond end of script: offset %04x, count %d vs size %d", _localsOffset, _localsCount, _bufSize);
 			_localsCount = (_bufSize - _localsOffset) >> 1;
 		}
 	} else {
@@ -268,12 +268,14 @@
 	return obj;
 }
 
+#if 0
 void Script::scriptObjRemove(reg_t obj_pos) {
 	if (getSciVersion() < SCI_VERSION_1_1)
 		obj_pos.offset += 8;
 
 	_objects.erase(obj_pos.toUint16());
 }
+#endif
 
 // This helper function is used by Script::relocateLocal and Object::relocate
 static bool relocateBlock(Common::Array<reg_t> &block, int block_location, SegmentId segment, int location, size_t scriptSize) {
@@ -288,7 +290,7 @@
 		return false;
 
 	if (rel & 1) {
-		warning("Attempt to relocate odd variable #%d.5e (relative to %04x)\n", idx, block_location);
+		error("Attempt to relocate odd variable #%d.5e (relative to %04x)\n", idx, block_location);
 		return false;
 	}
 	block[idx].segment = segment; // Perform relocation
@@ -372,7 +374,7 @@
 	bool exportsAreWide = (g_sci->_features->detectLofsType() == SCI_VERSION_1_MIDDLE);
 
 	if (_numExports <= pubfunct) {
-		warning("validateExportFunc(): pubfunct is invalid");
+		error("validateExportFunc(): pubfunct is invalid");
 		return 0;
 	}
 
@@ -464,7 +466,7 @@
 	if (ret.maxSize > 0) {
 		ret.reg = &_locals[pointer.offset / 2];
 	} else {
-		warning("LocalVariables::dereference: Offset at end or out of bounds %04x:%04x", PRINT_REG(pointer));
+		error("LocalVariables::dereference: Offset at end or out of bounds %04x:%04x", PRINT_REG(pointer));
 		ret.reg = 0;
 	}
 	return ret;
@@ -551,7 +553,7 @@
 			for (uint i = 0; i < obj->getVarCount(); i++)
 				(*note)(param, obj->getVariable(i));
 		} else {
-			warning("Request for outgoing script-object reference at %04x:%04x failed", PRINT_REG(addr));
+			error("Request for outgoing script-object reference at %04x:%04x failed", PRINT_REG(addr));
 		}
 	} else {
 		/*		warning("Unexpected request for outgoing script-object references at %04x:%04x", PRINT_REG(addr));*/
@@ -642,7 +644,7 @@
 
 void ListTable::listAllOutgoingReferences(reg_t addr, void *param, NoteCallback note) const {
 	if (!isValidEntry(addr.offset)) {
-		warning("Invalid list referenced for outgoing references: %04x:%04x", PRINT_REG(addr));
+		error("Invalid list referenced for outgoing references: %04x:%04x", PRINT_REG(addr));
 		return;
 	}
 
@@ -662,7 +664,7 @@
 
 void NodeTable::listAllOutgoingReferences(reg_t addr, void *param, NoteCallback note) const {
 	if (!isValidEntry(addr.offset)) {
-		warning("Invalid node referenced for outgoing references: %04x:%04x", PRINT_REG(addr));
+		error("Invalid node referenced for outgoing references: %04x:%04x", PRINT_REG(addr));
 		return;
 	}
 	const Node *node = &(_table[addr.offset]);
@@ -736,7 +738,7 @@
 	int selectors = getVarCount();
 
 	if (propertyOffset < 0 || (propertyOffset >> 1) >= selectors) {
-		warning("Applied propertyOffsetToId to invalid property offset %x (property #%d not in [0..%d])",
+		error("Applied propertyOffsetToId to invalid property offset %x (property #%d not in [0..%d])",
 		          propertyOffset, propertyOffset >> 1, selectors - 1);
 		return -1;
 	}
@@ -814,7 +816,7 @@
 
 void ArrayTable::listAllOutgoingReferences(reg_t addr, void *param, NoteCallback note) const {
 	if (!isValidEntry(addr.offset)) {
-		warning("Invalid array referenced for outgoing references: %04x:%04x", PRINT_REG(addr));
+		error("Invalid array referenced for outgoing references: %04x:%04x", PRINT_REG(addr));
 		return;
 	}
 

Modified: scummvm/trunk/engines/sci/engine/segment.h
===================================================================
--- scummvm/trunk/engines/sci/engine/segment.h	2010-06-17 23:45:38 UTC (rev 49972)
+++ scummvm/trunk/engines/sci/engine/segment.h	2010-06-17 23:50:28 UTC (rev 49973)
@@ -406,11 +406,13 @@
 	 */
 	Object *scriptObjInit(reg_t obj_pos, bool fullObjectInit = true);
 
+#if 0
 	/**
 	 * Removes a script object
 	 * @param obj_pos	Location (segment, offset) of the object.
 	 */
 	void scriptObjRemove(reg_t obj_pos);
+#endif
 
 	/**
 	 * Processes a relocation block witin a script

Modified: scummvm/trunk/engines/sci/engine/selector.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/selector.cpp	2010-06-17 23:45:38 UTC (rev 49972)
+++ scummvm/trunk/engines/sci/engine/selector.cpp	2010-06-17 23:50:28 UTC (rev 49973)
@@ -188,13 +188,13 @@
 	ObjVarRef address;
 
 	if ((selectorId < 0) || (selectorId > (int)g_sci->getKernel()->getSelectorNamesSize())) {
-		warning("Attempt to write to invalid selector %d of"
+		error("Attempt to write to invalid selector %d of"
 		         " object at %04x:%04x.", selectorId, PRINT_REG(object));
 		return;
 	}
 
 	if (lookupSelector(segMan, object, selectorId, &address, NULL) != kSelectorVariable)
-		warning("Selector '%s' of object at %04x:%04x could not be"
+		error("Selector '%s' of object at %04x:%04x could not be"
 		         " written to", g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object));
 	else
 		*address.getPointer(segMan) = value;
@@ -217,7 +217,7 @@
 		         g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object));
 	}
 	if (slc_type == kSelectorVariable) {
-		warning("Attempting to invoke variable selector %s of object %04x:%04x",
+		error("Attempting to invoke variable selector %s of object %04x:%04x",
 			g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object));
 	}
 

Modified: scummvm/trunk/engines/sci/engine/state.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/state.cpp	2010-06-17 23:45:38 UTC (rev 49972)
+++ scummvm/trunk/engines/sci/engine/state.cpp	2010-06-17 23:50:28 UTC (rev 49973)
@@ -207,7 +207,7 @@
 					// Copy double-byte character
 					char c2 = *(++seeker);
 					if (!c2) {
-						warning("SJIS character %02X is missing second byte", c);
+						error("SJIS character %02X is missing second byte", c);
 						break;
 					}
 					fullWidth += c;

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2010-06-17 23:45:38 UTC (rev 49972)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2010-06-17 23:50:28 UTC (rev 49973)
@@ -128,7 +128,8 @@
 
 static int validate_arithmetic(reg_t reg) {
 	if (reg.segment) {
-		warning("[VM] Attempt to read arithmetic value from non-zero segment [%04x]", reg.segment);
+		// The results of this are likely unpredictable...
+		error("[VM] Attempt to read arithmetic value from non-zero segment [%04x]", reg.segment);
 		return 0;
 	}
 
@@ -137,7 +138,8 @@
 
 static int signed_validate_arithmetic(reg_t reg) {
 	if (reg.segment) {
-		warning("[VM] Attempt to read arithmetic value from non-zero segment [%04x]", reg.segment);
+		// The results of this are likely unpredictable...
+		error("[VM] Attempt to read arithmetic value from non-zero segment [%04x]", reg.segment);
 		return 0;
 	}
 
@@ -159,8 +161,8 @@
 		if (type == VAR_PARAM || type == VAR_TEMP) {
 			int total_offset = r - stack_base;
 			if (total_offset < 0 || total_offset >= VM_STACK_SIZE) {
-				warning("%s", txt.c_str());
-				warning("[VM] Access would be outside even of the stack (%d); access denied", total_offset);
+				// Fatal, as the game is trying to do an OOB access
+				error("%s. [VM] Access would be outside even of the stack (%d); access denied", txt.c_str(), total_offset);
 				return false;
 			} else {
 				debugC(2, kDebugLevelVM, "%s", txt.c_str());
@@ -298,7 +300,7 @@
 		ExecStack &xs = s->_executionStack.back();
 		reg_t *var = xs.getVarPointer(s->_segMan);
 		if (!var) {
-			warning("Invalid varselector exec stack entry");
+			error("Invalid varselector exec stack entry");
 		} else {
 			// varselector access?
 			if (xs.argc) { // write?
@@ -419,7 +421,7 @@
 					reg_t oldReg = *varp.getPointer(s->_segMan);
 					reg_t newReg = argp[1];
 					const char *selectorName = g_sci->getKernel()->getSelectorName(selector).c_str();
-					warning("send_selector(): argc = %d while modifying variable selector "
+					error("send_selector(): argc = %d while modifying variable selector "
 							"%x (%s) of object %04x:%04x (%s) from %04x:%04x to %04x:%04x", 
 							argc, selector, selectorName, PRINT_REG(send_obj),
 							objectName, PRINT_REG(oldReg), PRINT_REG(newReg));
@@ -762,6 +764,7 @@
 			scr = s->_segMan->getScriptIfLoaded(s->xs->addr.pc.segment);
 			if (!scr) {
 				// No script? Implicit return via fake instruction buffer
+				// FIXME: Why does this happen? Are there leftover calls in the call stack?
 				warning("Running on non-existant script in segment %x", s->xs->addr.pc.segment);
 				code_buf = _fake_return_buffer;
 #ifndef DISABLE_VALIDATIONS
@@ -779,6 +782,7 @@
 #endif
 				local_script = s->_segMan->getScriptIfLoaded(s->xs->local_segment);
 				if (!local_script) {
+					// FIXME: Why does this happen? Is the script not loaded yet at this point?
 					warning("Could not find local script from segment %x", s->xs->local_segment);
 					local_script = NULL;
 					s->variablesBase[VAR_LOCAL] = s->variables[VAR_LOCAL] = NULL;
@@ -1661,7 +1665,7 @@
 
 //#ifndef DISABLE_VALIDATIONS
 		if (s->xs != &(s->_executionStack.back())) {
-			warning("xs is stale (%p vs %p); last command was %02x",
+			error("xs is stale (%p vs %p); last command was %02x",
 					(void *)s->xs, (void *)&(s->_executionStack.back()),
 					opcode);
 		}

Modified: scummvm/trunk/engines/sci/graphics/ports.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/ports.cpp	2010-06-17 23:45:38 UTC (rev 49972)
+++ scummvm/trunk/engines/sci/graphics/ports.cpp	2010-06-17 23:50:28 UTC (rev 49973)
@@ -216,7 +216,7 @@
 	Common::Rect r;
 
 	if (!pwnd) {
-		warning("Can't open window!");
+		error("Can't open window!");
 		return 0;
 	}
 

Modified: scummvm/trunk/engines/sci/sound/drivers/adlib.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/drivers/adlib.cpp	2010-06-17 23:45:38 UTC (rev 49972)
+++ scummvm/trunk/engines/sci/sound/drivers/adlib.cpp	2010-06-17 23:50:28 UTC (rev 49973)
@@ -703,7 +703,7 @@
 
 void MidiDriver_AdLib::setPatch(int voice, int patch) {
 	if ((patch < 0) || ((uint)patch >= _patches.size())) {
-		warning("ADLIB: Invalid patch %i requested", patch);
+		error("ADLIB: Invalid patch %i requested", patch);
 		patch = 0;
 	}
 
@@ -749,7 +749,7 @@
 
 bool MidiDriver_AdLib::loadResource(const byte *data, uint size) {
 	if ((size != 1344) && (size != 2690) && (size != 5382)) {
-		warning("ADLIB: Unsupported patch format (%i bytes)", size);
+		error("ADLIB: Unsupported patch format (%i bytes)", size);
 		return false;
 	}
 

Modified: scummvm/trunk/engines/sci/sound/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/music.cpp	2010-06-17 23:45:38 UTC (rev 49972)
+++ scummvm/trunk/engines/sci/sound/music.cpp	2010-06-17 23:50:28 UTC (rev 49973)
@@ -455,7 +455,7 @@
 	if (pSnd->pMidiParser)
 		pSnd->pMidiParser->sendToDriver(cmd);
 	else
-		warning("tried to cmdSendMidi on non midi slot (%04x:%04x)", PRINT_REG(pSnd->soundObj));
+		error("tried to cmdSendMidi on non midi slot (%04x:%04x)", PRINT_REG(pSnd->soundObj));
 }
 
 void SciMusic::printPlayList(Console *con) {


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