diff options
author | Torbjörn Andersson | 2010-04-01 16:11:29 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2010-04-01 16:11:29 +0000 |
commit | d38f71c1e45f4b45f2e11e02315957d40657f3f3 (patch) | |
tree | e4d9f6a3d98b7cd987f4045563c63955f1bba952 | |
parent | aee05cd21d5da6de39f23e5250af00f05a94fb5d (diff) | |
download | scummvm-rg350-d38f71c1e45f4b45f2e11e02315957d40657f3f3.tar.gz scummvm-rg350-d38f71c1e45f4b45f2e11e02315957d40657f3f3.tar.bz2 scummvm-rg350-d38f71c1e45f4b45f2e11e02315957d40657f3f3.zip |
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".)
svn-id: r48458
-rw-r--r-- | engines/sword2/console.cpp | 6 | ||||
-rw-r--r-- | engines/sword2/console.h | 1 | ||||
-rw-r--r-- | engines/sword2/sound.cpp | 43 | ||||
-rw-r--r-- | engines/sword2/sound.h | 2 |
4 files changed, 52 insertions, 0 deletions
diff --git a/engines/sword2/console.cpp b/engines/sword2/console.cpp index eb3b885cf7..4bf7c0da19 100644 --- a/engines/sword2/console.cpp +++ b/engines/sword2/console.cpp @@ -122,6 +122,7 @@ Debugger::Debugger(Sword2Engine *vm) 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 @@ bool Debugger::Cmd_Polish(int argc, const char **argv) { return true; } +bool Debugger::Cmd_FxQueue(int argc, const char **argv) { + _vm->_sound->printFxQueue(); + return true; +} + } // End of namespace Sword2 diff --git a/engines/sword2/console.h b/engines/sword2/console.h index 32beaedfbb..6cdee91ea0 100644 --- a/engines/sword2/console.h +++ b/engines/sword2/console.h @@ -124,6 +124,7 @@ protected: 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 diff --git a/engines/sword2/sound.cpp b/engines/sword2/sound.cpp index 4273da67b8..25069e83cd 100644 --- a/engines/sword2/sound.cpp +++ b/engines/sword2/sound.cpp @@ -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 @@ void Sound::unpauseAllSound() { 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 diff --git a/engines/sword2/sound.h b/engines/sword2/sound.h index f59d6a3434..29bbdf22ca 100644 --- a/engines/sword2/sound.h +++ b/engines/sword2/sound.h @@ -282,6 +282,8 @@ public: int32 streamCompMusic(uint32 musicId, bool loop); void stopMusic(bool immediately); int32 musicTimeRemaining(); + + void printFxQueue(); }; } // End of namespace Sword2 |