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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sat May 30 15:36:52 CEST 2009


Revision: 41030
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41030&view=rev
Author:   thebluegr
Date:     2009-05-30 13:36:51 +0000 (Sat, 30 May 2009)

Log Message:
-----------
Moved more script debug commands to console.cpp: "visual_state", "dynamic_views", "dropped_views", "gc" and "gc_objects". Removed the "gfx_free_widgets" and "sleep" commands (they weren't really useful)

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

Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp	2009-05-30 13:04:09 UTC (rev 41029)
+++ scummvm/trunk/engines/sci/console.cpp	2009-05-30 13:36:51 UTC (rev 41030)
@@ -31,6 +31,7 @@
 #include "sci/vocabulary.h"
 #include "sci/engine/savegame.h"
 #include "sci/engine/state.h"
+#include "sci/engine/gc.h"
 #include "sci/gfx/gfx_state_internal.h"
 #include "sci/vocabulary.h"
 
@@ -67,6 +68,11 @@
 	DCmd_Register("parser_words",		WRAP_METHOD(Console, cmdParserWords));
 	DCmd_Register("current_port",		WRAP_METHOD(Console, cmdCurrentPort));
 	DCmd_Register("parse_grammar",		WRAP_METHOD(Console, cmdParseGrammar));
+	DCmd_Register("visual_state",		WRAP_METHOD(Console, cmdVisualState));
+	DCmd_Register("dynamic_views",		WRAP_METHOD(Console, cmdDynamicViews));
+	DCmd_Register("dropped_views",		WRAP_METHOD(Console, cmdDroppedViews));
+	DCmd_Register("gc",					WRAP_METHOD(Console, cmdInvokeGC));
+	DCmd_Register("gc_objects",			WRAP_METHOD(Console, cmdGCObjects));
 	DCmd_Register("exit",				WRAP_METHOD(Console, cmdExit));
 
 	// These were in sci.cpp
@@ -568,6 +574,58 @@
 	return true;
 }
 
+bool Console::cmdVisualState(int argc, const char **argv) {
+	DebugPrintf("State of the current visual widget:\n");
+
+	if (g_EngineState->visual)
+		g_EngineState->visual->print(0);
+	else
+		DebugPrintf("The visual widget is uninitialized.\n");
+
+	return true;
+}
+
+bool Console::cmdDynamicViews(int argc, const char **argv) {
+	DebugPrintf("List of active dynamic views:\n");
+
+	if (g_EngineState->dyn_views)
+		g_EngineState->dyn_views->print(0);
+	else
+		DebugPrintf("The list is empty.\n");
+
+	return true;
+}
+
+bool Console::cmdDroppedViews(int argc, const char **argv) {
+	DebugPrintf("List of dropped dynamic views:\n");
+
+	if (g_EngineState->drop_views)
+		g_EngineState->drop_views->print(0);
+	else
+		DebugPrintf("The list is empty.\n");
+
+	return true;
+}
+
+bool Console::cmdInvokeGC(int argc, const char **argv) {
+	DebugPrintf("Performing garbage collection...\n");
+	run_gc(g_EngineState);
+	return true;
+}
+
+bool Console::cmdGCObjects(int argc, const char **argv) {
+	reg_t_hash_map *use_map = find_all_used_references(g_EngineState);
+
+	DebugPrintf("Reachable object references (normalised):\n");
+	for (reg_t_hash_map::iterator i = use_map->begin(); i != use_map->end(); ++i) {
+		DebugPrintf(" - %04x:%04x\n", PRINT_REG(i->_key));
+	}
+
+	delete use_map;
+
+	return true;
+}
+
 bool Console::cmdExit(int argc, const char **argv) {
 	if (argc != 2) {
 		DebugPrintf("%s game - exit gracefully\n", argv[0]);

Modified: scummvm/trunk/engines/sci/console.h
===================================================================
--- scummvm/trunk/engines/sci/console.h	2009-05-30 13:04:09 UTC (rev 41029)
+++ scummvm/trunk/engines/sci/console.h	2009-05-30 13:36:51 UTC (rev 41030)
@@ -64,6 +64,11 @@
 	bool cmdParserWords(int argc, const char **argv);
 	bool cmdCurrentPort(int argc, const char **argv);
 	bool cmdParseGrammar(int argc, const char **argv);
+	bool cmdVisualState(int argc, const char **argv);
+	bool cmdDynamicViews(int argc, const char **argv);
+	bool cmdDroppedViews(int argc, const char **argv);
+	bool cmdInvokeGC(int argc, const char **argv);
+	bool cmdGCObjects(int argc, const char **argv);
 	bool cmdExit(int argc, const char **argv);
 
 private:

Modified: scummvm/trunk/engines/sci/engine/scriptdebug.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/scriptdebug.cpp	2009-05-30 13:04:09 UTC (rev 41029)
+++ scummvm/trunk/engines/sci/engine/scriptdebug.cpp	2009-05-30 13:36:51 UTC (rev 41030)
@@ -1583,48 +1583,6 @@
 	return 0;
 }
 
-static int c_gfx_print_visual(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
-	if (!_debugstate_valid) {
-		sciprintf("Not in debug state\n");
-		return 1;
-	}
-
-	if (s->visual)
-		s->visual->print(0);
-	else
-		sciprintf("visual is uninitialized.\n");
-
-	return 0;
-}
-
-static int c_gfx_print_dynviews(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
-	if (!_debugstate_valid) {
-		sciprintf("Not in debug state\n");
-		return 1;
-	}
-
-	if (!s->dyn_views)
-		sciprintf("No dynview list active.\n");
-	else
-		s->dyn_views->print(0);
-
-	return 0;
-}
-
-static int c_gfx_print_dropviews(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
-	if (!_debugstate_valid) {
-		sciprintf("Not in debug state\n");
-		return 1;
-	}
-
-	if (!s->drop_views)
-		sciprintf("No dropped dynview list active.\n");
-	else
-		s->drop_views->print(0);
-
-	return 0;
-}
-
 static int c_gfx_drawpic(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
 	int flags = 1, default_palette = 0;
 
@@ -1867,21 +1825,6 @@
 }
 #endif
 
-static int c_gfx_flush_resources(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
-	if (!_debugstate_valid) {
-		sciprintf("Not in debug state\n");
-		return 1;
-	}
-
-	gfxop_set_pointer_cursor(s->gfx_state, GFXOP_NO_POINTER);
-	sciprintf("Flushing resources...\n");
-	delete s->visual;
-	s->gfx_state->gfxResMan->freeAllResources();
-	s->visual = NULL;
-
-	return 0;
-}
-
 static int c_gfx_update_zone(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
 	if (!_debugstate_valid) {
 		sciprintf("Not in debug state\n");
@@ -2278,12 +2221,6 @@
 	return 0;
 }
 
-#define ASSERT_PARAMS(number) \
-	if (cmdParams.size() <= number) {\
-		sciprintf("Operation '%s' needs %d parameters\n", op, number); \
-		return 1;\
-	}
-
 #define GETRECT(ll, rr, tt, bb) \
 	ll = GET_SELECTOR(pos, ll); \
 	rr = GET_SELECTOR(pos, rr); \
@@ -2606,12 +2543,6 @@
 	return 0;
 }
 
-// int c_sleep(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
-//	sleep(cmdParams[0].val);
-//
-//	return 0;
-// }
-
 static void _print_address(void * _, reg_t addr) {
 	if (addr.segment)
 		sciprintf("  %04x:%04x\n", PRINT_REG(addr));
@@ -2662,25 +2593,6 @@
 	return 0;
 }
 
-static int c_gc(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
-	run_gc(s);
-
-	return 0;
-}
-
-static int c_gc_list_reachable(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
-	reg_t_hash_map *use_map = find_all_used_references(s);
-
-	sciprintf("Reachable references (normalised):\n");
-	for (reg_t_hash_map::iterator i = use_map->begin(); i != use_map->end(); ++i) {
-		sciprintf(" - %04x:%04x\n", PRINT_REG(i->_key));
-	}
-
-	delete use_map;
-
-	return 0;
-}
-
 void script_debug(EngineState *s, reg_t *pc, StackPtr *sp, StackPtr *pp, reg_t *objp, int *restadjust,
 	SegmentId *segids, reg_t **variables, reg_t **variables_base, int *variables_nr, int bp) {
 	// Do we support a separate console?
@@ -2885,12 +2797,8 @@
 			con_hook_command(c_gfx_print_widget, "gfx_print_widget", "i*", "If called with no parameters, it\n  shows which widgets are active.\n"
 			                 "  With parameters, it lists the\n  widget corresponding to the\n  numerical index specified (for\n  each parameter).");
 #endif
-			con_hook_command(c_gfx_flush_resources, "gfx_free_widgets", "", "Frees all dynamically allocated\n  widgets (for memory profiling).\n");
 			con_hook_command(c_gfx_print_port, "gfx_print_port", "i*", "Displays all information about the\n  specified port,"
 			                 " or the current port\n  if no port was specified.");
-			con_hook_command(c_gfx_print_visual, "gfx_print_visual", "", "Displays all information about the\n  current widget state");
-			con_hook_command(c_gfx_print_dynviews, "gfx_print_dynviews", "", "Shows the dynview list");
-			con_hook_command(c_gfx_print_dropviews, "gfx_print_dropviews", "", "Shows the list of dropped\n  dynviews");
 			con_hook_command(c_gfx_drawpic, "gfx_drawpic", "ii*", "Draws a pic resource\n\nUSAGE\n  gfx_drawpic <nr> [<pal> [<fl>]]\n"
 			                 "  where <nr> is the number of the pic resource\n  to draw\n  <pal> is the optional default\n  palette for the pic (0 is"
 			                 "\n  assumed if not specified)\n  <fl> are any pic draw flags (default\n  is 1)");
@@ -2967,8 +2875,6 @@
 			                 "  sfx-01-track <song> <offset>\n\n"
 			                 "SEE ALSO\n\n"
 			                 "  sfx-01-header.1\n\n");
-//			con_hook_command(c_sleep, "sleep", "i", "Suspends everything for the\n"
-//			                 " specified number of seconds");
 			con_hook_command(c_gc_show_reachable, "gc-list-reachable", "!a",
 			                 "Prints all addresses directly reachable from\n"
 			                 "  the memory object specified as parameter.\n\n"
@@ -2988,16 +2894,6 @@
 			                 "SEE ALSO\n\n"
 			                 "  gc-list-freeable.1, gc-list-reachable.1, gc.1,\n"
 			                 "  gc-all-reachable.1");
-			con_hook_command(c_gc, "gc", "",
-			                 "Performs garbage collection.\n\n"
-			                 "SEE ALSO\n\n"
-			                 "  gc-list-freeable.1, gc-list-reachable.1,\n"
-			                 "  gc-all-reachable.1, gc-normalise.1");
-			con_hook_command(c_gc_list_reachable, "gc-all-reachable", "",
-			                 "Lists all reachable objects, normalised.\n\n"
-			                 "SEE ALSO\n\n"
-			                 "  gc-list-freeable.1, gc-list-reachable.1,\n"
-			                 "  gc.1, gc-normalise.1");
 
 /*
 			con_hook_int(&script_debug_flag, "script_debug_flag", "Set != 0 to enable debugger\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