diff options
author | Max Horn | 2009-01-30 04:52:53 +0000 |
---|---|---|
committer | Max Horn | 2009-01-30 04:52:53 +0000 |
commit | 76deee02d6b2638cd04be6cfb50aaf217b6252ee (patch) | |
tree | 2662abc9deec308936693cbf7b95c19b30039b9c | |
parent | de7c89e38143ccac34e5228d5591a2738f27a661 (diff) | |
download | scummvm-rg350-76deee02d6b2638cd04be6cfb50aaf217b6252ee.tar.gz scummvm-rg350-76deee02d6b2638cd04be6cfb50aaf217b6252ee.tar.bz2 scummvm-rg350-76deee02d6b2638cd04be6cfb50aaf217b6252ee.zip |
Some more 'special debug levels' tweaks
svn-id: r36140
-rw-r--r-- | base/main.cpp | 9 | ||||
-rw-r--r-- | common/debug.cpp | 19 | ||||
-rw-r--r-- | common/debug.h | 17 | ||||
-rw-r--r-- | engines/groovie/script.cpp | 6 | ||||
-rw-r--r-- | engines/groovie/vdx.cpp | 7 | ||||
-rw-r--r-- | engines/scumm/debugger.cpp | 2 |
6 files changed, 21 insertions, 39 deletions
diff --git a/base/main.cpp b/base/main.cpp index 9efe582301..8540c309e0 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -175,9 +175,14 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const SearchMan.addDirectory(dir.getPath(), dir); } - // On creation the engine should've set up all debug levels so we can use + // On creation the engine should have set up all debug levels so we can use // the command line arugments here - Common::enableSpecialDebugLevelList(edebuglevels); + Common::StringTokenizer tokenizer(edebuglevels, " ,"); + while (!tokenizer.empty()) { + Common::String token = tokenizer.nextToken(); + if (!enableSpecialDebugLevel(token)) + warning("Engine does not support debug level '%s'", token.c_str()); + } // Inform backend that the engine is about to be run system.engineInit(); diff --git a/common/debug.cpp b/common/debug.cpp index af3e6d8018..1c232c0662 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -57,8 +57,8 @@ namespace Common { namespace { -SpecialDebugLevelList gDebugLevels; -uint32 gDebugLevelsEnabled = 0; +static SpecialDebugLevelList gDebugLevels; +static uint32 gDebugLevelsEnabled = 0; struct DebugLevelSort { bool operator()(const SpecialDebugLevel &l, const SpecialDebugLevel &r) { @@ -110,17 +110,6 @@ bool enableSpecialDebugLevel(const String &name) { } } -void enableSpecialDebugLevelList(const String &names) { - StringTokenizer tokenizer(names, " ,"); - String token; - - while (!tokenizer.empty()) { - token = tokenizer.nextToken(); - if (!enableSpecialDebugLevel(token)) - warning("Engine does not support debug level '%s'", token.c_str()); - } -} - bool disableSpecialDebugLevel(const String &option) { SpecialDebugLevelList::iterator i = find_if(gDebugLevels.begin(), gDebugLevels.end(), DebugLevelSearch(option)); @@ -138,10 +127,6 @@ const SpecialDebugLevelList &listSpecialDebugLevels() { return gDebugLevels; } -uint32 getEnabledSpecialDebugLevels() { - return gDebugLevelsEnabled; -} - bool isSpecialDebugLevelEnabled(uint32 level) { // FIXME: Seems gDebugLevel 11 has a special meaning? Document that! if (gDebugLevel == 11) diff --git a/common/debug.h b/common/debug.h index 8d01cde539..5d58af03a6 100644 --- a/common/debug.h +++ b/common/debug.h @@ -49,7 +49,7 @@ struct SpecialDebugLevel { * Adds a engine debug level. * @param level the level flag (should be OR-able i.e. first one should be 1 than 2,4,...) * @param name the option name which is used in the debugger/on the command line to enable - * this special debug level, the option will be compared case !insentiv! later + * this special debug level (case will be ignored) * @param description the description which shows up in the debugger * @return true on success false on failure */ @@ -68,19 +68,14 @@ void clearAllSpecialDebugLevels(); bool enableSpecialDebugLevel(const String &name); /** - * Enables a list of engine debug levels, given as a comma-separated list - * of level names. - * @param name the list of names of debug levels to enable - */ -void enableSpecialDebugLevelList(const String &names); - -/** * Disables an engine debug level * @param name the name of the debug level to disable * @return true on success, false on failure */ bool disableSpecialDebugLevel(const String &name); + + typedef List<SpecialDebugLevel> SpecialDebugLevelList; /** @@ -89,12 +84,6 @@ typedef List<SpecialDebugLevel> SpecialDebugLevelList; */ const SpecialDebugLevelList &listSpecialDebugLevels(); -/** - * Return the active debug flag mask (i.e. all active debug flags ORed - * together into a single uint32). - */ -uint32 getEnabledSpecialDebugLevels(); - /** * Test whether the given debug level is enabled. diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp index e1912d2737..4909bb46bc 100644 --- a/engines/groovie/script.cpp +++ b/engines/groovie/script.cpp @@ -42,7 +42,8 @@ void debugScript(int level, bool nl, const char *s, ...) { char buf[STRINGBUFLEN]; va_list va; - if (!Common::isSpecialDebugLevelEnabled(kGroovieDebugScript | kGroovieDebugAll)) + if (!Common::isSpecialDebugLevelEnabled(kGroovieDebugScript) && + !Common::isSpecialDebugLevelEnabled(kGroovieDebugAll)) return; va_start(va, s); @@ -329,7 +330,8 @@ bool Script::hotspot(Common::Rect rect, uint16 address, uint8 cursor) { bool contained = rect.contains(mousepos); // Show hotspots when debugging - if (Common::getEnabledSpecialDebugLevels() & (kGroovieDebugHotspots | kGroovieDebugAll)) { + if (Common::isSpecialDebugLevelEnabled(kGroovieDebugHotspots) || + Common::isSpecialDebugLevelEnabled(kGroovieDebugAll)) { rect.translate(0, -80); _vm->_graphicsMan->_foreground.frameRect(rect, 250); _vm->_system->copyRectToScreen((byte*)_vm->_graphicsMan->_foreground.getBasePtr(0, 0), 640, 0, 80, 640, 320); diff --git a/engines/groovie/vdx.cpp b/engines/groovie/vdx.cpp index aa5196c5c9..2e5cb2dbe9 100644 --- a/engines/groovie/vdx.cpp +++ b/engines/groovie/vdx.cpp @@ -49,7 +49,8 @@ void VDXPlayer::setOrigin(int16 x, int16 y) { } uint16 VDXPlayer::loadInternal() { - if (Common::isSpecialDebugLevelEnabled(kGroovieDebugVideo | kGroovieDebugAll)) { + if (Common::isSpecialDebugLevelEnabled(kGroovieDebugVideo) || + Common::isSpecialDebugLevelEnabled(kGroovieDebugAll)) { int8 i; debugN(1, "Groovie::VDX: New VDX: bitflags are "); for (i = 15; i >= 0; i--) { @@ -161,7 +162,7 @@ bool VDXPlayer::playFrameInternal() { // Wait until the current frame can be shown - if (!(Common::getEnabledSpecialDebugLevels() & kGroovieDebugFast)) { + if (!Common::isSpecialDebugLevelEnabled(kGroovieDebugFast)) { waitFrame(); } // TODO: Move it to a better place @@ -492,7 +493,7 @@ void VDXPlayer::chunkSound(Common::ReadStream *in) { byte *data = new byte[60000]; int chunksize = in->read(data, 60000); - if (!(Common::getEnabledSpecialDebugLevels() & kGroovieDebugFast)) { + if (!Common::isSpecialDebugLevelEnabled(kGroovieDebugFast)) { _audioStream->queueBuffer(data, chunksize); } } diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp index 78c2c410e0..fbffffb9e0 100644 --- a/engines/scumm/debugger.cpp +++ b/engines/scumm/debugger.cpp @@ -47,7 +47,7 @@ void debugC(int channel, const char *s, ...) { // FIXME: Still spew all debug at -d9, for crashes in startup etc. // Add setting from commandline ( / abstract channel interface) - if (!(Common::getEnabledSpecialDebugLevels() & channel) && (gDebugLevel < 9)) + if (!Common::isSpecialDebugLevelEnabled(channel) && (gDebugLevel < 9)) return; va_start(va, s); |