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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Fri Jul 9 23:10:15 CEST 2010


Revision: 50769
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50769&view=rev
Author:   m_kiewitz
Date:     2010-07-09 21:10:14 +0000 (Fri, 09 Jul 2010)

Log Message:
-----------
SCI: removing origName from KernelFunction struct, adding debugCalls boolean for later use

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kernel.cpp
    scummvm/trunk/engines/sci/engine/kernel.h
    scummvm/trunk/engines/sci/engine/vm.cpp

Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp	2010-07-09 19:45:56 UTC (rev 50768)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp	2010-07-09 21:10:14 UTC (rev 50769)
@@ -1006,11 +1006,12 @@
 		// Reset the table entry
 		_kernelFuncs[id].function = NULL;
 		_kernelFuncs[id].signature = NULL;
-		_kernelFuncs[id].origName = kernelName;
+		_kernelFuncs[id].name = NULL;
 		_kernelFuncs[id].isDummy = true;
 		_kernelFuncs[id].workarounds = NULL;
 		_kernelFuncs[id].subFunctions = NULL;
 		_kernelFuncs[id].subFunctionCount = 0;
+		_kernelFuncs[id].debugCalls = false;
 		if (kernelName.empty()) {
 			// No name was given -> must be an unknown opcode
 			warning("Kernel function %x unknown", id);
@@ -1038,70 +1039,66 @@
 
 		if (kernelMap->name) {
 			// A match was found
-			if (kernelMap->function) {
-				_kernelFuncs[id].function = kernelMap->function;
-				_kernelFuncs[id].signature = parseKernelSignature(kernelMap->name, kernelMap->signature);
-				_kernelFuncs[id].workarounds = kernelMap->workarounds;
-				_kernelFuncs[id].isDummy = false;
-				if (kernelMap->subFunctions) {
-					// Get version for subfunction identification
-					SciVersion mySubVersion = (SciVersion)kernelMap->function(NULL, 0, NULL).offset;
-					// Now check whats the highest subfunction-id for this version
-					const SciKernelMapSubEntry *kernelSubMap = kernelMap->subFunctions;
-					uint16 subFunctionCount = 0;
-					while (kernelSubMap->function) {
-						if ((kernelSubMap->fromVersion == SCI_VERSION_NONE) || (kernelSubMap->fromVersion <= mySubVersion))
-							if ((kernelSubMap->toVersion == SCI_VERSION_NONE) || (kernelSubMap->toVersion >= mySubVersion))
-								if (subFunctionCount <= kernelSubMap->id)
-									subFunctionCount = kernelSubMap->id + 1;
-						kernelSubMap++;
-					}
-					if (!subFunctionCount)
-						error("k%s[%x]: no subfunctions found for requested version", kernelName.c_str(), id);
-					// Now allocate required memory and go through it again
-					_kernelFuncs[id].subFunctionCount = subFunctionCount;
-					KernelSubFunction *subFunctions = new KernelSubFunction[subFunctionCount];
-					_kernelFuncs[id].subFunctions = subFunctions;
-					memset(subFunctions, 0, sizeof(KernelSubFunction) * subFunctionCount);
-					// And fill this info out
-					kernelSubMap = kernelMap->subFunctions;
-					uint kernelSubNr = 0;
-					while (kernelSubMap->function) {
-						if ((kernelSubMap->fromVersion == SCI_VERSION_NONE) || (kernelSubMap->fromVersion <= mySubVersion))
-							if ((kernelSubMap->toVersion == SCI_VERSION_NONE) || (kernelSubMap->toVersion >= mySubVersion)) {
-								uint subId = kernelSubMap->id;
-								subFunctions[subId].function = kernelSubMap->function;
-								subFunctions[subId].name = kernelSubMap->name;
-								subFunctions[subId].workarounds = kernelSubMap->workarounds;
-								if (kernelSubMap->signature) {
-									subFunctions[subId].signature = parseKernelSignature(kernelSubMap->name, kernelSubMap->signature);
-								} else {
-									// we go back the submap to find the previous signature for that kernel call
-									const SciKernelMapSubEntry *kernelSubMapBack = kernelSubMap;
-									uint kernelSubLeft = kernelSubNr;
-									while (kernelSubLeft) {
-										kernelSubLeft--;
-										kernelSubMapBack--;
-										if (kernelSubMapBack->name == kernelSubMap->name) {
-											if (kernelSubMapBack->signature) {
-												subFunctions[subId].signature = parseKernelSignature(kernelSubMap->name, kernelSubMapBack->signature);
-												break;
-											}
+			_kernelFuncs[id].function = kernelMap->function;
+			_kernelFuncs[id].name = kernelMap->name;
+			_kernelFuncs[id].signature = parseKernelSignature(kernelMap->name, kernelMap->signature);
+			_kernelFuncs[id].workarounds = kernelMap->workarounds;
+			_kernelFuncs[id].isDummy = false;
+			if (kernelMap->subFunctions) {
+				// Get version for subfunction identification
+				SciVersion mySubVersion = (SciVersion)kernelMap->function(NULL, 0, NULL).offset;
+				// Now check whats the highest subfunction-id for this version
+				const SciKernelMapSubEntry *kernelSubMap = kernelMap->subFunctions;
+				uint16 subFunctionCount = 0;
+				while (kernelSubMap->function) {
+					if ((kernelSubMap->fromVersion == SCI_VERSION_NONE) || (kernelSubMap->fromVersion <= mySubVersion))
+						if ((kernelSubMap->toVersion == SCI_VERSION_NONE) || (kernelSubMap->toVersion >= mySubVersion))
+							if (subFunctionCount <= kernelSubMap->id)
+								subFunctionCount = kernelSubMap->id + 1;
+					kernelSubMap++;
+				}
+				if (!subFunctionCount)
+					error("k%s[%x]: no subfunctions found for requested version", kernelName.c_str(), id);
+				// Now allocate required memory and go through it again
+				_kernelFuncs[id].subFunctionCount = subFunctionCount;
+				KernelSubFunction *subFunctions = new KernelSubFunction[subFunctionCount];
+				_kernelFuncs[id].subFunctions = subFunctions;
+				memset(subFunctions, 0, sizeof(KernelSubFunction) * subFunctionCount);
+				// And fill this info out
+				kernelSubMap = kernelMap->subFunctions;
+				uint kernelSubNr = 0;
+				while (kernelSubMap->function) {
+					if ((kernelSubMap->fromVersion == SCI_VERSION_NONE) || (kernelSubMap->fromVersion <= mySubVersion))
+						if ((kernelSubMap->toVersion == SCI_VERSION_NONE) || (kernelSubMap->toVersion >= mySubVersion)) {
+							uint subId = kernelSubMap->id;
+							subFunctions[subId].function = kernelSubMap->function;
+							subFunctions[subId].name = kernelSubMap->name;
+							subFunctions[subId].workarounds = kernelSubMap->workarounds;
+							if (kernelSubMap->signature) {
+								subFunctions[subId].signature = parseKernelSignature(kernelSubMap->name, kernelSubMap->signature);
+							} else {
+								// we go back the submap to find the previous signature for that kernel call
+								const SciKernelMapSubEntry *kernelSubMapBack = kernelSubMap;
+								uint kernelSubLeft = kernelSubNr;
+								while (kernelSubLeft) {
+									kernelSubLeft--;
+									kernelSubMapBack--;
+									if (kernelSubMapBack->name == kernelSubMap->name) {
+										if (kernelSubMapBack->signature) {
+											subFunctions[subId].signature = parseKernelSignature(kernelSubMap->name, kernelSubMapBack->signature);
+											break;
 										}
 									}
-									if (!subFunctions[subId].signature)
-										error("k%s: no previous signatures", kernelSubMap->name);
 								}
+								if (!subFunctions[subId].signature)
+									error("k%s: no previous signatures", kernelSubMap->name);
 							}
-						kernelSubMap++;
-						kernelSubNr++;
-					}
+						}
+					kernelSubMap++;
+					kernelSubNr++;
 				}
-				++mapped;
-			} else {
-				//warning("Ignoring function %s\n", s_kernelFuncMap[found].name);
-				++ignored;
 			}
+			++mapped;
 		} else {
 			if (nameMatch)
 				error("k%s[%x]: not found for this version/platform", kernelName.c_str(), id);

Modified: scummvm/trunk/engines/sci/engine/kernel.h
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.h	2010-07-09 19:45:56 UTC (rev 50768)
+++ scummvm/trunk/engines/sci/engine/kernel.h	2010-07-09 21:10:14 UTC (rev 50769)
@@ -141,13 +141,14 @@
 };
 
 struct KernelFunction {
+	bool isDummy;
 	KernelFunctionCall *function;
-	Common::String origName; /**< Original name, in case we couldn't map it */
-	bool isDummy;
+	const char *name;
 	uint16 *signature;
 	const SciWorkaroundEntry *workarounds;
 	const KernelSubFunction *subFunctions;
 	uint16 subFunctionCount;
+	bool debugCalls;
 };
 
 enum AutoDetectedFeatures {

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2010-07-09 19:45:56 UTC (rev 50768)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2010-07-09 21:10:14 UTC (rev 50769)
@@ -798,7 +798,7 @@
 		workaround = trackOriginAndFindWorkaround(0, kernelCall.workarounds, workaroundFound, &originReply);
 		if (!workaroundFound) {
 			kernel->signatureDebug(kernelCall.signature, argc, argv);
-			error("[VM] k%s (%x) signature mismatch via method %s::%s (script %d, localCall %x)", kernel->getKernelName(kernelFuncNr).c_str(), kernelFuncNr, originReply.objectName.c_str(), originReply.methodName.c_str(), originReply.scriptNr, originReply.localCallOffset);
+			error("[VM] k%s (%x) signature mismatch via method %s::%s (script %d, localCall %x)", kernelCall.name, kernelFuncNr, originReply.objectName.c_str(), originReply.methodName.c_str(), originReply.scriptNr, originReply.localCallOffset);
 		}
 		// FIXME: implement some real workaround type logic - ignore call, still do call etc.
 		if (workaround.segment)
@@ -827,7 +827,7 @@
 			argc--;
 			argv++;
 			if (subId >= kernelCall.subFunctionCount)
-				error("[VM] k%s: subfunction-id %d requested, but not available", kernelCall.origName, subId);
+				error("[VM] k%s: subfunction-id %d requested, but not available", kernelCall.name, subId);
 			const KernelSubFunction &kernelSubCall = kernelCall.subFunctions[subId];
 			if (!kernel->signatureMatch(kernelSubCall.signature, argc, argv)) {
 				// Signature mismatch
@@ -857,7 +857,7 @@
 		if (s->_executionStack.begin() != s->_executionStack.end())
 			s->_executionStack.pop_back();
 	} else {
-		Common::String warningMsg = "Dummy function " + kernelCall.origName +
+		Common::String warningMsg = "Dummy function " + kernel->getKernelName(kernelFuncNr) +
 									Common::String::printf("[0x%x]", kernelFuncNr) +
 									" invoked - ignoring. Params: " +
 									Common::String::printf("%d", argc) + " (";
@@ -871,7 +871,7 @@
 
 		// Make sure that the game doesn't call a function that is considered unused. If
 		// that happens, error out.
-		if (kernelCall.origName == "Dummy")
+		if (kernel->getKernelName(kernelFuncNr) == "Dummy")
 			error("Kernel function %d was called, which was considered to be unused", kernelFuncNr);
 	}
 }


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