mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-18 16:03:05 +00:00
COMMON: Enhanced debug channel checks.
Now it is possible to enforce checking by specifying level -1, that is, debug level 11 will not turn it on.
This commit is contained in:
parent
f63b9d0fcb
commit
eab2e06169
@ -117,7 +117,7 @@ public:
|
||||
/**
|
||||
* Test whether the given debug channel is enabled.
|
||||
*/
|
||||
bool isDebugChannelEnabled(uint32 channel);
|
||||
bool isDebugChannelEnabled(uint32 channel, bool enforce = false);
|
||||
|
||||
private:
|
||||
typedef HashMap<String, DebugChannel, IgnoreCase_Hash, IgnoreCase_EqualTo> DebugChannelMap;
|
||||
|
@ -110,9 +110,9 @@ void DebugManager::disableAllDebugChannels() {
|
||||
disableDebugChannel(i->_value.name);
|
||||
}
|
||||
|
||||
bool DebugManager::isDebugChannelEnabled(uint32 channel) {
|
||||
bool DebugManager::isDebugChannelEnabled(uint32 channel, bool enforce) {
|
||||
// Debug level 11 turns on all special debug level messages
|
||||
if (gDebugLevel == 11)
|
||||
if (gDebugLevel == 11 && enforce == false)
|
||||
return true;
|
||||
else
|
||||
return (gDebugChannelsEnabled & channel) != 0;
|
||||
@ -125,8 +125,8 @@ bool debugLevelSet(int level) {
|
||||
}
|
||||
|
||||
bool debugChannelSet(int level, uint32 debugChannels) {
|
||||
if (gDebugLevel != 11)
|
||||
if (level > gDebugLevel || !(DebugMan.isDebugChannelEnabled(debugChannels)))
|
||||
if (gDebugLevel != 11 || level == -1)
|
||||
if ((level != -1 && level > gDebugLevel) || !(DebugMan.isDebugChannelEnabled(debugChannels, level == -1)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -117,6 +117,7 @@ bool debugLevelSet(int level);
|
||||
/**
|
||||
* Returns true if the debug level and channel are active
|
||||
*
|
||||
* @param level debug level to check against. If set to -1, only channel check is active
|
||||
* @see enableDebugChannel
|
||||
*/
|
||||
bool debugChannelSet(int level, uint32 debugChannels);
|
||||
|
Loading…
x
Reference in New Issue
Block a user