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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sat May 30 19:53:12 CEST 2009


Revision: 41039
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41039&view=rev
Author:   thebluegr
Date:     2009-05-30 17:53:12 +0000 (Sat, 30 May 2009)

Log Message:
-----------
Removed the "sfx_debuglog" command. Sound debug messages are now shown if kDebugLevelSound is specified

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/savegame.cpp
    scummvm/trunk/engines/sci/engine/scriptdebug.cpp
    scummvm/trunk/engines/sci/gfx/gfx_widgets.cpp
    scummvm/trunk/engines/sci/sfx/core.cpp
    scummvm/trunk/engines/sci/sfx/core.h

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2009-05-30 17:30:54 UTC (rev 41038)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2009-05-30 17:53:12 UTC (rev 41039)
@@ -853,7 +853,6 @@
 	retval->_sound._flags = s->_sound._flags;
 	retval->_sound._song = NULL;
 	retval->_sound._suspended = s->_sound._suspended;
-	retval->_sound._debug = s->_sound._debug;
 	reconstruct_sounds(retval);
 
 	// Message state:

Modified: scummvm/trunk/engines/sci/engine/scriptdebug.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/scriptdebug.cpp	2009-05-30 17:30:54 UTC (rev 41038)
+++ scummvm/trunk/engines/sci/engine/scriptdebug.cpp	2009-05-30 17:53:12 UTC (rev 41039)
@@ -1708,87 +1708,9 @@
 	unsigned int flag;
 };
 
-static void handle_config_update(const generic_config_flag_t *flags_list, int flags_nr, const char *subsystem,
-								 int *active_options_p, const char *changestring /* or NULL to display*/) {
-	if (!changestring) {
-		int j;
-
-		sciprintf("Logging in %s:\n", subsystem);
-		if (!(*active_options_p))
-			sciprintf("  (nothing)\n");
-
-		for (j = 0; j < flags_nr; j++)
-			if (*active_options_p & flags_list[j].flag) {
-				sciprintf("  - %s (%c)\n", flags_list[j].name, flags_list[j].option);
-			}
-	} else {
-		int mode;
-		int j = 0;
-		int flags = 0;
-
-		if (changestring[0] == '-')
-			mode = 0;
-		else if (changestring[0] == '+')
-			mode = 1;
-		else {
-			sciprintf("Mode spec must start with '+' or '-' in '%s'\n", changestring);
-			return;
-		}
-
-		while (changestring[++j]) {
-			int k;
-			int flag = 0;
-
-			if (changestring[j] == '*')
-				flags = ~0; // Everything
-			else
-				for (k = 0; !flag && k < flags_nr; k++)
-					if (flags_list[k].option == changestring[j])
-						flag = flags_list[k].flag;
-
-			if (!flag) {
-				sciprintf("Invalid/unknown mode flag '%c'\n", changestring[j]);
-				return;
-			}
-			flags |= flag;
-		}
-
-		if (mode) // +
-			*active_options_p |= flags;
-		else // -
-			*active_options_p &= ~flags;
-	}
-}
-
-static int c_handle_config_update(const generic_config_flag_t *flags, int flags_nr, const char *subsystem,
-			int *active_options_p, const Common::Array<cmd_param_t> &cmdParams) {
-
-	if (!_debugstate_valid) {
-		sciprintf("Not in debug state\n");
-		return 1;
-	}
-
-	if (cmdParams.size() == 0)
-		handle_config_update(flags, flags_nr, subsystem, active_options_p, 0);
-
-	for (uint i = 0; i < cmdParams.size(); i++)
-		handle_config_update(flags, flags_nr, subsystem, active_options_p, cmdParams[i].str);
-
-	return 0;
-}
-
 #define SFX_DEBUG_MODES 2
 #define FROBNICATE_HANDLE(reg) ((reg).segment << 16 | (reg).offset)
 
-static int c_sfx_debuglog(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
-	const generic_config_flag_t sfx_debug_modes[SFX_DEBUG_MODES] = {
-		{"Song activation/deactivation", 's', SFX_DEBUG_SONGS},
-		{"Song cue polling and delivery", 'c', SFX_DEBUG_CUES}
-	};
-
-	return c_handle_config_update(sfx_debug_modes, SFX_DEBUG_MODES, "sound subsystem", (int *)&(s->_sound._debug), cmdParams);
-}
-
 static int c_sfx_remove(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
 	reg_t id = cmdParams[0].reg;
 	int handle = FROBNICATE_HANDLE(id);
@@ -1810,20 +1732,20 @@
 	Audio::AudioStream *data;
 
 	if (!song) {
-		sciprintf("Not a sound resource.\n");
+		warning("Not a sound resource");
 		return 1;
 	}
 
 	songit = songit_new(song->data, song->size, SCI_SONG_ITERATOR_TYPE_SCI0, 0xcaffe /* What do I care about the ID? */);
 
 	if (!songit) {
-		sciprintf("Error-- Could not convert to song iterator\n");
+		warning("Error-- Could not convert to song iterator");
 		return 1;
 	}
 
 	if ((data = songit->getAudioStream())) {
 /*
-		sciprintf("\nIs sample (encoding %dHz/%s/%04x).\n", data->conf.rate, (data->conf.stereo) ?
+		warning("\nIs sample (encoding %dHz/%s/%04x).", data->conf.rate, (data->conf.stereo) ?
 		          ((data->conf.stereo == SFX_PCM_STEREO_LR) ? "stereo-LR" : "stereo-RL") : "mono", data->conf.format);
 */
 		delete data;
@@ -2360,20 +2282,6 @@
 			                 "  The word sequence must be provided as a\n  single string.");
 			con_hook_command(c_set_parse_nodes, "set_parse_nodes", "s*", "Sets the contents of all parse nodes.\n"
 			                 "  Input token must be separated by\n  blanks.");
-			con_hook_command(c_sfx_debuglog, "sfx_debuglog", "s*",
-			                 "Sets or prints the sound subsystem debug\n"
-			                 "settings\n\n"
-			                 "USAGE\n\n"
-			                 "  sfx_debuglog {[+|-][p|u|x|b]+}*\n\n"
-			                 "  sfx_debuglog\n\n"
-			                 "    Prints current settings\n\n"
-			                 "  sfx_debuglog +X\n\n"
-			                 "    Activates all debug features listed in X\n\n"
-			                 "  sfx_debuglog -X\n\n"
-			                 "    Deactivates the debug features listed in X\n\n"
-			                 "  Debug features:\n"
-			                 "    s: Active song changes\n"
-			                 "    c: Song cues\n");
 
 #ifdef GFXW_DEBUG_WIDGETS
 			con_hook_command(c_gfx_print_widget, "gfx_print_widget", "i*", "If called with no parameters, it\n  shows which widgets are active.\n"

Modified: scummvm/trunk/engines/sci/gfx/gfx_widgets.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_widgets.cpp	2009-05-30 17:30:54 UTC (rev 41038)
+++ scummvm/trunk/engines/sci/gfx/gfx_widgets.cpp	2009-05-30 17:53:12 UTC (rev 41039)
@@ -154,9 +154,6 @@
 static int verify_widget(GfxWidget *widget) {
 	if (!widget) {
 		GFXERROR("Attempt to use NULL widget\n");
-#ifdef GFXW_DEBUG_WIDGETS
-		BREAKPOINT();
-#endif
 		return 1;
 	} else if (widget->_magic != GFXW_MAGIC_VALID) {
 		if (widget->_magic == GFXW_MAGIC_INVALID) {
@@ -164,9 +161,6 @@
 		} else {
 			GFXERROR("Attempt to use non-widget\n");
 		}
-#ifdef GFXW_DEBUG_WIDGETS
-		BREAKPOINT();
-#endif
 		return 1;
 	}
 	return 0;

Modified: scummvm/trunk/engines/sci/sfx/core.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/core.cpp	2009-05-30 17:30:54 UTC (rev 41038)
+++ scummvm/trunk/engines/sci/sfx/core.cpp	2009-05-30 17:53:12 UTC (rev 41039)
@@ -26,6 +26,7 @@
 /* Sound subsystem core: Event handler, sound player dispatching */
 
 #include "sci/tools.h"
+#include "sci/sci.h"
 #include "sci/sfx/core.h"
 #include "sci/sfx/iterator.h"
 #include "sci/sfx/misc.h"
@@ -486,20 +487,25 @@
 				setSongStatus(newsong, SOUND_STATUS_WAITING);
 		}
 
-		if (_debug & SFX_DEBUG_SONGS) {
-			sciprintf("[SFX] Changing active song:");
-			if (!_song)
-				sciprintf(" New song:");
-			else
-				sciprintf(" pausing %08lx, now playing", _song->handle);
+		Common::String debugMessage = "[SFX] Changing active song:";
+		if (!_song) {
+			debugMessage += " New song:";
+		} else {
+			char tmp[50];
+			sprintf(tmp, " pausing %08lx, now playing ", _song->handle);
+			debugMessage += tmp;
+		}
 
-			if (newsong)
-				sciprintf(" %08lx\n", newsong->handle);
-			else
-				sciprintf(" none\n");
+		if (newsong) {
+			char tmp[20];
+			sprintf(tmp, "%08lx\n", newsong->handle);
+			debugMessage += tmp;
+		} else {
+			debugMessage += " none\n";
 		}
 
-
+		debugC(2, kDebugLevelSound, debugMessage.c_str());
+				
 		_song = newsong;
 		thawTime(); /* Recover song delay time */
 
@@ -565,9 +571,8 @@
 	        oldseeker = oldseeker->next_stopping)
 		if (oldseeker->next_playing == &not_playing_anymore) {
 			setSongStatus(oldseeker, SOUND_STATUS_SUSPENDED);
-			if (_debug & SFX_DEBUG_SONGS) {
-				sciprintf("[SFX] Stopping song %lx\n", oldseeker->handle);
-			}
+			debugC(2, kDebugLevelSound, "[SFX] Stopping song %lx\n", oldseeker->handle);
+
 			if (player && oldseeker->it)
 				player->iterator_message(SongIterator::Message(oldseeker->it->ID, SIMSG_STOP));
 			oldseeker->next_playing = NULL; /* Clear this pointer; we don't need the tag anymore */
@@ -575,8 +580,7 @@
 
 	for (newseeker = newsong; newseeker; newseeker = newseeker->next_playing) {
 		if (newseeker->status != SOUND_STATUS_PLAYING && player) {
-			if (_debug & SFX_DEBUG_SONGS)
-				sciprintf("[SFX] Adding song %lx\n", newseeker->it->ID);
+			debugC(2, kDebugLevelSound, "[SFX] Adding song %lx\n", newseeker->it->ID);
 
 			SongIterator *clonesong = newseeker->it->clone(newseeker->_delay);
 			player->add_iterator(clonesong, g_system->getMillis());
@@ -617,7 +621,6 @@
 	song_lib_init(&_songlib);
 	_song = NULL;
 	_flags = flags;
-	_debug = 0; /* Disable all debugging by default */
 	_soundSync = NULL;
 	_audioResource = NULL;
 
@@ -644,7 +647,7 @@
 	player = new SfxPlayer();
 
 	if (!player) {
-		sciprintf("[SFX] No song player found\n");
+		warning("[SFX] No song player found");
 		return;
 	}
 
@@ -721,9 +724,7 @@
 	if (!song)
 		return 0; /* Song not playing */
 
-	if (_debug & SFX_DEBUG_CUES) {
-		fprintf(stderr, "[SFX:CUE] Polled song %08lx ", handle);
-	}
+	debugC(2, kDebugLevelSound, "[SFX:CUE] Polled song %08lx ", handle);
 
 	while (1) {
 		if (song->_wakeupTime.frameDiff(ctime) > 0)
@@ -741,19 +742,14 @@
 		case SI_LOOP:
 		case SI_RELATIVE_CUE:
 		case SI_ABSOLUTE_CUE:
-			if (_debug & SFX_DEBUG_CUES) {
-				sciprintf(" => ");
+			if (result == SI_FINISHED)
+				debugC(2, kDebugLevelSound, " => finished");
+			else {
+				if (result == SI_LOOP)
+					debugC(2, kDebugLevelSound, " => Loop: %d (0x%x)", *cue, *cue);
+				else
+					debugC(2, kDebugLevelSound, " => Cue: %d (0x%x)", *cue, *cue);
 
-				if (result == SI_FINISHED)
-					sciprintf("finished\n");
-				else {
-					if (result == SI_LOOP)
-						sciprintf("Loop: ");
-					else
-						sciprintf("Cue: ");
-
-					sciprintf("%d (0x%x)", *cue, *cue);
-				}
 			}
 			return result;
 
@@ -765,9 +761,7 @@
 			break;
 		}
 	}
-	if (_debug & SFX_DEBUG_CUES) {
-		fprintf(stderr, "\n");
-	}
+
 }
 
 
@@ -939,8 +933,7 @@
 
 	if (command == 0xb0 &&
 	        arg1 == SCI_MIDI_CHANNEL_MUTE) {
-		sciprintf("TODO: channel mute (channel %d %s)!\n", channel,
-		          channel_state[arg2]);
+		warning("TODO: channel mute (channel %d %s)!", channel, channel_state[arg2]);
 		/* We need to have a GET_PLAYMASK interface to use
 		   here. SET_PLAYMASK we've got.
 		*/
@@ -964,7 +957,7 @@
 		buffer[2] = (arg1 & 0xff00) >> 7;
 		break;
 	default:
-		sciprintf("Unexpected explicit MIDI command %02x\n", command);
+		warning("Unexpected explicit MIDI command %02x", command);
 		return Common::kUnknownError;
 	}
 

Modified: scummvm/trunk/engines/sci/sfx/core.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/core.h	2009-05-30 17:30:54 UTC (rev 41038)
+++ scummvm/trunk/engines/sci/sfx/core.h	2009-05-30 17:53:12 UTC (rev 41039)
@@ -43,11 +43,6 @@
 ** simultaneously ? */
 #define SFX_STATE_FLAG_NOSOUND	 (1 << 1) /* Completely disable sound playing */
 
-
-#define SFX_DEBUG_SONGS		(1 << 0) /* Debug song changes */
-#define SFX_DEBUG_CUES		(1 << 1) /* Debug cues, loops, and
-** song completions */
-
 class SfxState {
 public:	// FIXME, make private
 	SongIterator *_it; /**< The song iterator at the heart of things */
@@ -55,7 +50,6 @@
 	songlib_t _songlib; /**< Song library */
 	song_t *_song; /**< Active song, or start of active song chain */
 	bool _suspended; /**< Whether we are suspended */
-	uint _debug; /**< Debug flags */
 	ResourceSync *_soundSync; /**< Used by kDoSync for speech syncing in CD talkie games */
 	AudioResource *_audioResource; /**< Used for audio resources in CD talkie games */
 


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