[Scummvm-cvs-logs] SF.net SVN: scummvm:[48458] scummvm/trunk/engines/sword2

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Thu Apr 1 18:11:35 CEST 2010


Revision: 48458
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48458&view=rev
Author:   eriktorbjorn
Date:     2010-04-01 16:11:29 +0000 (Thu, 01 Apr 2010)

Log Message:
-----------
Added an "fxq" debugger command to print the FX queue. I guess it might help in
debugging the "No free slot in FX queue!" bug I've heard of but never actually
seen. (See for instance bug #2976008, "BS2: Game lockup in British Museum".)

Modified Paths:
--------------
    scummvm/trunk/engines/sword2/console.cpp
    scummvm/trunk/engines/sword2/console.h
    scummvm/trunk/engines/sword2/sound.cpp
    scummvm/trunk/engines/sword2/sound.h

Modified: scummvm/trunk/engines/sword2/console.cpp
===================================================================
--- scummvm/trunk/engines/sword2/console.cpp	2010-04-01 15:03:08 UTC (rev 48457)
+++ scummvm/trunk/engines/sword2/console.cpp	2010-04-01 16:11:29 UTC (rev 48458)
@@ -122,6 +122,7 @@
 	DCmd_Register("english",  WRAP_METHOD(Debugger, Cmd_English));
 	DCmd_Register("finnish",  WRAP_METHOD(Debugger, Cmd_Finnish));
 	DCmd_Register("polish",   WRAP_METHOD(Debugger, Cmd_Polish));
+	DCmd_Register("fxq",      WRAP_METHOD(Debugger, Cmd_FxQueue));
 }
 
 void Debugger::varGet(int var) {
@@ -795,4 +796,9 @@
 	return true;
 }
 
+bool Debugger::Cmd_FxQueue(int argc, const char **argv) {
+	_vm->_sound->printFxQueue();
+	return true;
+}
+
 } // End of namespace Sword2

Modified: scummvm/trunk/engines/sword2/console.h
===================================================================
--- scummvm/trunk/engines/sword2/console.h	2010-04-01 15:03:08 UTC (rev 48457)
+++ scummvm/trunk/engines/sword2/console.h	2010-04-01 16:11:29 UTC (rev 48458)
@@ -124,6 +124,7 @@
 	bool Cmd_English(int argc, const char **argv);
 	bool Cmd_Finnish(int argc, const char **argv);
 	bool Cmd_Polish(int argc, const char **argv);
+	bool Cmd_FxQueue(int argc, const char **argv);
 };
 
 } // End of namespace Sword2

Modified: scummvm/trunk/engines/sword2/sound.cpp
===================================================================
--- scummvm/trunk/engines/sword2/sound.cpp	2010-04-01 15:03:08 UTC (rev 48457)
+++ scummvm/trunk/engines/sword2/sound.cpp	2010-04-01 16:11:29 UTC (rev 48458)
@@ -42,6 +42,7 @@
 #include "sword2/sword2.h"
 #include "sword2/defs.h"
 #include "sword2/header.h"
+#include "sword2/console.h"
 #include "sword2/logic.h"
 #include "sword2/resman.h"
 #include "sword2/sound.h"
@@ -49,6 +50,8 @@
 #include "sound/decoders/wave.h"
 #include "sound/decoders/vag.h"
 
+#define Debug_Printf _vm->_debugger->DebugPrintf
+
 namespace Sword2 {
 
 Sound::Sound(Sword2Engine *vm) {
@@ -377,4 +380,44 @@
 	unpauseFx();
 }
 
+void Sound::printFxQueue() {
+	int freeSlots = 0;
+
+	for (int i = 0; i < FXQ_LENGTH; i++) {
+		if (_fxQueue[i].resource) {
+			const char *type;
+
+			switch (_fxQueue[i].type) {
+			case FX_SPOT:
+				type = "SPOT";
+				break;
+			case FX_LOOP:
+				type = "LOOP";
+				break;
+			case FX_RANDOM:
+				type = "RANDOM";
+				break;
+			case FX_SPOT2:
+				type = "SPOT2";
+				break;
+			case FX_LOOPING:
+				type = "LOOPING";
+				break;
+			default:
+				type = "UNKNOWN";
+				break;
+			}
+
+			Debug_Printf("%d: res: %d ('%s') %s (%d) delay: %d vol: %d pan: %d\n",
+				i, _fxQueue[i].resource,
+				_vm->_resman->fetchName(_fxQueue[i].resource),
+				type, _fxQueue[i].type, _fxQueue[i].delay,
+				_fxQueue[i].volume, _fxQueue[i].pan);
+		} else {
+			freeSlots++;
+		}
+	}
+	Debug_Printf("Free slots: %d\n", freeSlots);
+}
+
 } // End of namespace Sword2

Modified: scummvm/trunk/engines/sword2/sound.h
===================================================================
--- scummvm/trunk/engines/sword2/sound.h	2010-04-01 15:03:08 UTC (rev 48457)
+++ scummvm/trunk/engines/sword2/sound.h	2010-04-01 16:11:29 UTC (rev 48458)
@@ -282,6 +282,8 @@
 	int32 streamCompMusic(uint32 musicId, bool loop);
 	void stopMusic(bool immediately);
 	int32 musicTimeRemaining();
+
+	void printFxQueue();
 };
 
 } // End of namespace Sword2


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