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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Mon May 11 19:10:36 CEST 2009


Revision: 40457
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40457&view=rev
Author:   thebluegr
Date:     2009-05-11 17:10:36 +0000 (Mon, 11 May 2009)

Log Message:
-----------
Moved the "selectors" and "syscalls" console commands to ScummVM's debug console (as commands "selectors" and "kernelnames", respectively)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/console.cpp
    scummvm/trunk/engines/sci/console.h
    scummvm/trunk/engines/sci/engine/scriptconsole.cpp

Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp	2009-05-11 17:08:31 UTC (rev 40456)
+++ scummvm/trunk/engines/sci/console.cpp	2009-05-11 17:10:36 UTC (rev 40457)
@@ -29,6 +29,7 @@
 #include "sci/console.h"
 #include "sci/scicore/resource.h"
 #include "sci/scicore/versions.h"
+#include "sci/scicore/vocabulary.h"
 
 namespace Sci {
 
@@ -36,6 +37,8 @@
 	_vm = vm;
 
 	DCmd_Register("version",			WRAP_METHOD(Console, cmdGetVersion));
+	DCmd_Register("selectors",			WRAP_METHOD(Console, cmdSelectors));
+	DCmd_Register("kernelnames",		WRAP_METHOD(Console, cmdKernelNames));
 	DCmd_Register("man",				WRAP_METHOD(Console, cmdMan));
 }
 
@@ -53,6 +56,48 @@
 	return true;
 }
 
+bool Console::cmdSelectors(int argc, const char **argv) {
+	Common::StringList selectorNames;
+
+	if (!vocabulary_get_snames(_vm->getResMgr(), _vm->getVersion(), selectorNames)) {
+		DebugPrintf("No selector name table found!\n");
+		return true;
+	}
+
+	DebugPrintf("Selector names in numeric order:\n");
+	for (uint seeker = 0; seeker < selectorNames.size(); seeker++) {
+		DebugPrintf("%03x: %20s | ", seeker, selectorNames[seeker].c_str());
+		if (seeker % 3 == 0)
+			DebugPrintf("\n");
+	}
+
+	DebugPrintf("\n");
+
+	return true;
+}
+
+bool Console::cmdKernelNames(int argc, const char **argv) {
+	Common::StringList kernelNames;
+
+	vocabulary_get_knames(_vm->getResMgr(), kernelNames);
+
+	if (kernelNames.empty()) {
+		DebugPrintf("No kernel name table found!\n");
+		return true;
+	}
+
+	DebugPrintf("Selector names in numeric order:\n");
+	for (uint seeker = 0; seeker < kernelNames.size(); seeker++) {
+		DebugPrintf("%03x: %20s | ", seeker, kernelNames[seeker].c_str());
+		if (seeker % 3 == 0)
+			DebugPrintf("\n");
+	}
+
+	DebugPrintf("\n");
+
+	return true;
+}
+
 bool Console::cmdMan(int argc, const char **argv) {
 #if 0
 	int section = 0;

Modified: scummvm/trunk/engines/sci/console.h
===================================================================
--- scummvm/trunk/engines/sci/console.h	2009-05-11 17:08:31 UTC (rev 40456)
+++ scummvm/trunk/engines/sci/console.h	2009-05-11 17:10:36 UTC (rev 40457)
@@ -41,6 +41,8 @@
 
 private:
 	bool cmdGetVersion(int argc, const char **argv);
+	bool cmdSelectors(int argc, const char **argv);
+	bool cmdKernelNames(int argc, const char **argv);
 	bool cmdMan(int argc, const char **argv);
 
 private:

Modified: scummvm/trunk/engines/sci/engine/scriptconsole.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/scriptconsole.cpp	2009-05-11 17:08:31 UTC (rev 40456)
+++ scummvm/trunk/engines/sci/engine/scriptconsole.cpp	2009-05-11 17:10:36 UTC (rev 40457)
@@ -45,8 +45,6 @@
 //static int c_objinfo(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // shows some info about one class
 //static int c_objmethods(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // Disassembles all methods of a class
 static int c_hexgrep(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // Searches a string in one resource or resource class
-static int c_selectornames(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // Displays all selector names
-static int c_kernelnames(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // Displays all kernel function names
 static int c_dissectscript(EngineState *s, const Common::Array<cmd_param_t> &cmdParams); // Splits a script into objects and explains them
 
 struct cmd_mm_entry_t {
@@ -785,8 +783,6 @@
 		          "docs       - lists all misc. documentation\n"
 		          "\n"
 		          "restypes   - lists all resource types\n"
-		          "selectors  - lists all selectors\n"
-		          "syscalls   - lists all kernel functions\n"
 		          "words      - lists all kernel words\n"
 		          "suffixes   - lists all suffix replacements\n"
 		          "[resource] - lists all [resource]s");
@@ -808,10 +804,6 @@
 				return 1;
 			}
 
-			if (!strcmp("selectors", cmdParams[0].str))
-				return c_selectornames(s, cmdParams);
-			else if (!strcmp("syscalls", cmdParams[0].str))
-				return c_kernelnames(s, cmdParams);
 			else if (!strcmp("suffixes", cmdParams[0].str) || !strcmp("suffices", cmdParams[0].str) || !strcmp("sufficos", cmdParams[0].str))
 				// sufficos: Accusative Plural of 'suffix'
 				return c_list_suffixes(s, cmdParams);
@@ -997,49 +989,6 @@
 	return 0;
 }
 
-static int c_selectornames(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
-	Common::StringList selectorNames;
-
-	if (NULL == s) {
-		sciprintf("console.c: c_selectornames(): NULL passed for parameter s\n");
-		return -1;
-	}
-
-	if (!vocabulary_get_snames(s->resmgr, s ? s->version : 0, selectorNames)) {
-		sciprintf("No selector name table found!\n");
-		return 1;
-	}
-
-	sciprintf("Selector names in numeric order:\n");
-	for (uint seeker = 0; seeker < selectorNames.size(); seeker++) {
-		sciprintf("%03x: %s\n", seeker, selectorNames[seeker].c_str());
-	}
-
-	return 0;
-}
-
-static int c_kernelnames(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
-	Common::StringList knames;
-
-	if (NULL == s) {
-		sciprintf("console.c: c_kernelnames NULL passed for parameter s\n");
-		return -1;
-	}
-
-	vocabulary_get_knames(s->resmgr, knames);
-
-	if (knames.empty()) {
-		sciprintf("No kernel name table found!\n");
-		return 1;
-	}
-
-	sciprintf("Syscalls in numeric order:\n");
-	for (uint seeker = 0; seeker < knames.size(); seeker++)
-		sciprintf("%03x: %s\n", seeker, knames[seeker].c_str());
-
-	return 0;
-}
-
 static int c_dissectscript(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
 	if (NULL == s) {
 		sciprintf("console.c: c_dissectscript(): NULL passed for parameter s\n");


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