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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Thu Jul 29 23:33:43 CEST 2010


Revision: 51483
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51483&view=rev
Author:   m_kiewitz
Date:     2010-07-29 21:33:42 +0000 (Thu, 29 Jul 2010)

Log Message:
-----------
SCI: finished logkernel command

use 'logkernel DoSound' on to log calls to all kDoSound subfunctions. use 'logkernel DoSoundPlay' to log calls to kDoSound(play)

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

Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp	2010-07-29 21:12:16 UTC (rev 51482)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp	2010-07-29 21:33:42 UTC (rev 51483)
@@ -652,30 +652,37 @@
 
 bool Kernel::debugSetFunctionLogging(const char *kernelName, bool logging) {
 	if (strcmp(kernelName, "*")) {
-		const char *kernelSubName = strchr(kernelName, '(');
-		uint kernelSubNameLen = 0;
-		if (kernelSubName) {
-			kernelSubName++;
-			kernelSubNameLen = strlen(kernelSubName);
-			if ((!kernelSubNameLen) || (kernelSubName[kernelSubNameLen - 1] != ')'))
-				return false;
-		}
 		for (uint id = 0; id < _kernelFuncs.size(); id++) {
 			if (_kernelFuncs[id].name) {
-				if (!_kernelFuncs[id].subFunctions) {
-					// No sub-functions, enable actual kernel function
-					if (strcmp(kernelName, _kernelFuncs[id].name) == 0) {
-						_kernelFuncs[id].debugLogging = logging;
+				if (strcmp(kernelName, _kernelFuncs[id].name) == 0) {
+					if (_kernelFuncs[id].subFunctions) {
+						// sub-functions available and main name matched, in that case set logging of all sub-functions
+						KernelSubFunction *kernelSubCall = _kernelFuncs[id].subFunctions;
+						uint kernelSubCallCount = _kernelFuncs[id].subFunctionCount;
+						for (uint subId = 0; subId < kernelSubCallCount; subId++) {
+							if (kernelSubCall->function)
+								kernelSubCall->debugLogging = logging;
+							kernelSubCall++;
+						}
 						return true;
 					}
+					// function name matched, set for this one and exit
+					_kernelFuncs[id].debugLogging = logging;
+					return true;
 				} else {
-					// Sub-Functions available
-					if (kernelSubName) {
+					// main name was not matched
+					if (_kernelFuncs[id].subFunctions) {
+						// Sub-Functions available
 						KernelSubFunction *kernelSubCall = _kernelFuncs[id].subFunctions;
 						uint kernelSubCallCount = _kernelFuncs[id].subFunctionCount;
 						for (uint subId = 0; subId < kernelSubCallCount; subId++) {
-							if (kernelSubCall->function)
-								kernelSubCall->debugLogging = logging;
+							if (kernelSubCall->function) {
+								if (strcmp(kernelName, kernelSubCall->name) == 0) {
+									// sub-function name matched, set for this one and exit
+									kernelSubCall->debugLogging = logging;
+									return true;
+								}
+							}
 							kernelSubCall++;
 						}
 					}


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