COMMON: Persist global debug channels between engine runs

This commit is contained in:
Eugene Sandulenko 2021-08-16 21:33:15 +02:00
parent fef26b3c59
commit 83fc4f7338
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
2 changed files with 10 additions and 0 deletions

View File

@ -157,6 +157,7 @@ private:
DebugChannelMap _debugChannels;
uint32 _debugChannelsEnabled;
uint32 _globalChannelsMask;
friend class Singleton<SingletonBaseType>;

View File

@ -54,6 +54,12 @@ struct DebugLevelComperator {
DebugManager::DebugManager() :
_debugChannelsEnabled(0) {
addDebugChannels(gDebugChannels);
// Create global debug channels mask
_globalChannelsMask = 0;
for (uint i = 0; gDebugChannels[i].channel != 0; ++i) {
_globalChannelsMask |= gDebugChannels[i].channel;
}
}
bool DebugManager::addDebugChannel(uint32 channel, const String &name, const String &description) {
@ -83,9 +89,12 @@ void DebugManager::addAllDebugChannels(const DebugChannelDef *channels) {
}
void DebugManager::removeAllDebugChannels() {
uint32 globalChannels = _debugChannelsEnabled & _globalChannelsMask;
_debugChannelsEnabled = 0;
_debugChannels.clear();
addDebugChannels(gDebugChannels);
_debugChannelsEnabled |= globalChannels;
}
bool DebugManager::enableDebugChannel(const String &name) {