COMMON: Rename DebugManager methods, update comments
This commit is contained in:
parent
efd4f9ff9d
commit
f2f28c4549
6 changed files with 36 additions and 31 deletions
|
@ -134,7 +134,7 @@ static const Plugin *detectPlugin() {
|
|||
// Query the plugin for the game descriptor
|
||||
printf(" Looking for a plugin supporting this target... %s\n", plugin->getName());
|
||||
const MetaEngineDetection &metaEngine = plugin->get<MetaEngineDetection>();
|
||||
DebugMan.debugFlagsRegister(metaEngine.getDebugChannels());
|
||||
DebugMan.addAllDebugChannels(metaEngine.getDebugChannels());
|
||||
PlainGameDescriptor game = metaEngine.findGame(gameId.c_str());
|
||||
if (!game.gameId) {
|
||||
warning("'%s' is an invalid game ID for the engine '%s'. Use the --list-games option to list supported game IDs", gameId.c_str(), engineId.c_str());
|
||||
|
@ -194,7 +194,7 @@ static Common::Error runGame(const Plugin *plugin, const Plugin *enginePlugin, O
|
|||
}
|
||||
|
||||
// before we instantiate the engine, we register debug channels for it
|
||||
DebugMan.debugFlagsRegister(metaEngineDetection.getDebugChannels());
|
||||
DebugMan.addAllDebugChannels(metaEngineDetection.getDebugChannels());
|
||||
|
||||
// Create the game's MetaEngine.
|
||||
MetaEngine &metaEngine = enginePlugin->get<MetaEngine>();
|
||||
|
@ -219,7 +219,7 @@ static Common::Error runGame(const Plugin *plugin, const Plugin *enginePlugin, O
|
|||
ConfMan.removeGameDomain(target.c_str());
|
||||
}
|
||||
|
||||
DebugMan.clearAllDebugChannels();
|
||||
DebugMan.removeAllDebugChannels();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ static Common::Error runGame(const Plugin *plugin, const Plugin *enginePlugin, O
|
|||
// Free up memory
|
||||
delete engine;
|
||||
|
||||
DebugMan.clearAllDebugChannels();
|
||||
DebugMan.removeAllDebugChannels();
|
||||
|
||||
// Reset the file/directory mappings
|
||||
SearchMan.clear();
|
||||
|
|
|
@ -678,7 +678,7 @@ QualifiedGameList EngineManager::findGamesMatching(const Common::String &engineI
|
|||
const Plugin *p = EngineMan.findPlugin(engineId);
|
||||
if (p) {
|
||||
const MetaEngineDetection &engine = p->get<MetaEngineDetection>();
|
||||
DebugMan.debugFlagsRegister(engine.getDebugChannels());
|
||||
DebugMan.addAllDebugChannels(engine.getDebugChannels());
|
||||
|
||||
PlainGameDescriptor pluginResult = engine.findGame(gameId.c_str());
|
||||
if (pluginResult.gameId) {
|
||||
|
@ -708,7 +708,7 @@ QualifiedGameList EngineManager::findGameInLoadedPlugins(const Common::String &g
|
|||
|
||||
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
|
||||
const MetaEngineDetection &engine = (*iter)->get<MetaEngineDetection>();
|
||||
DebugMan.debugFlagsRegister(engine.getDebugChannels());
|
||||
DebugMan.addAllDebugChannels(engine.getDebugChannels());
|
||||
PlainGameDescriptor pluginResult = engine.findGame(gameId.c_str());
|
||||
|
||||
if (pluginResult.gameId) {
|
||||
|
@ -736,7 +736,7 @@ DetectionResults EngineManager::detectGames(const Common::FSList &fslist) const
|
|||
for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
|
||||
const MetaEngineDetection &metaEngine = (*iter)->get<MetaEngineDetection>();
|
||||
// set the debug flags
|
||||
DebugMan.debugFlagsRegister(metaEngine.getDebugChannels());
|
||||
DebugMan.addAllDebugChannels(metaEngine.getDebugChannels());
|
||||
DetectedGames engineCandidates = metaEngine.detectGames(fslist);
|
||||
|
||||
for (uint i = 0; i < engineCandidates.size(); i++) {
|
||||
|
@ -867,7 +867,7 @@ QualifiedGameDescriptor EngineManager::findTarget(const Common::String &target,
|
|||
|
||||
// Make sure it does support the game ID
|
||||
const MetaEngineDetection &engine = foundPlugin->get<MetaEngineDetection>();
|
||||
DebugMan.debugFlagsRegister(engine.getDebugChannels());
|
||||
DebugMan.addAllDebugChannels(engine.getDebugChannels());
|
||||
PlainGameDescriptor desc = engine.findGame(domain->getVal("gameid").c_str());
|
||||
if (!desc.gameId) {
|
||||
return QualifiedGameDescriptor();
|
||||
|
@ -934,7 +934,7 @@ void EngineManager::upgradeTargetForEngineId(const Common::String &target) const
|
|||
// Take the first detection entry
|
||||
const MetaEngineDetection &metaEngine = plugin->get<MetaEngineDetection>();
|
||||
// set debug flags before call detectGames
|
||||
DebugMan.debugFlagsRegister(metaEngine.getDebugChannels());
|
||||
DebugMan.addAllDebugChannels(metaEngine.getDebugChannels());
|
||||
DetectedGames candidates = metaEngine.detectGames(files);
|
||||
if (candidates.empty()) {
|
||||
warning("No games supported by the engine '%s' were found in path '%s' when upgrading target '%s'",
|
||||
|
|
|
@ -85,9 +85,15 @@ public:
|
|||
bool addDebugChannel(uint32 channel, const String &name, const String &description);
|
||||
|
||||
/**
|
||||
* Reset all engine-specific debug channels.
|
||||
* Add all the debug channels for an engine. This replaces any existing engine
|
||||
* debug channels and disables all channels.
|
||||
*/
|
||||
void clearAllDebugChannels();
|
||||
void addAllDebugChannels(const DebugChannelDef *channels);
|
||||
|
||||
/**
|
||||
* Remove all engine debug channels and disable all global debug channels.
|
||||
*/
|
||||
void removeAllDebugChannels();
|
||||
|
||||
/**
|
||||
* Enable a debug channel.
|
||||
|
@ -124,11 +130,12 @@ public:
|
|||
typedef List<DebugChannel> DebugChannelList;
|
||||
|
||||
/**
|
||||
* Lists all engine specific debug channels.
|
||||
* Lists all debug channels. This includes engine and global
|
||||
* debug channels.
|
||||
*
|
||||
* @return returns an array with all debug channels
|
||||
* @return List of all debug channels sorted by debug level.
|
||||
*/
|
||||
DebugChannelList listDebugChannels();
|
||||
DebugChannelList getDebugChannels();
|
||||
|
||||
/**
|
||||
* Enable all debug channels.
|
||||
|
@ -145,11 +152,6 @@ public:
|
|||
*/
|
||||
bool isDebugChannelEnabled(uint32 channel, bool enforce = false);
|
||||
|
||||
/**
|
||||
* register engine specified flags
|
||||
*/
|
||||
void debugFlagsRegister(const DebugChannelDef *channels);
|
||||
|
||||
private:
|
||||
typedef HashMap<String, DebugChannel, IgnoreCase_Hash, IgnoreCase_EqualTo> DebugChannelMap;
|
||||
|
||||
|
@ -160,6 +162,9 @@ private:
|
|||
|
||||
DebugManager();
|
||||
|
||||
/**
|
||||
* Internal method for adding an array of debug channels.
|
||||
*/
|
||||
void addDebugChannels(const DebugChannelDef *channels);
|
||||
};
|
||||
|
||||
|
|
|
@ -69,7 +69,15 @@ bool DebugManager::addDebugChannel(uint32 channel, const String &name, const Str
|
|||
return true;
|
||||
}
|
||||
|
||||
void DebugManager::clearAllDebugChannels() {
|
||||
void DebugManager::addAllDebugChannels(const DebugChannelDef *channels) {
|
||||
removeAllDebugChannels();
|
||||
|
||||
if (channels) {
|
||||
addDebugChannels(channels);
|
||||
}
|
||||
}
|
||||
|
||||
void DebugManager::removeAllDebugChannels() {
|
||||
_debugChannelsEnabled = 0;
|
||||
_debugChannels.clear();
|
||||
addDebugChannels(gDebugChannels);
|
||||
|
@ -111,7 +119,7 @@ bool DebugManager::disableDebugChannel(uint32 channel) {
|
|||
return true;
|
||||
}
|
||||
|
||||
DebugManager::DebugChannelList DebugManager::listDebugChannels() {
|
||||
DebugManager::DebugChannelList DebugManager::getDebugChannels() {
|
||||
DebugChannelList tmp;
|
||||
for (DebugChannelMap::iterator i = _debugChannels.begin(); i != _debugChannels.end(); ++i)
|
||||
tmp.push_back(i->_value);
|
||||
|
@ -138,14 +146,6 @@ bool DebugManager::isDebugChannelEnabled(uint32 channel, bool enforce) {
|
|||
return (_debugChannelsEnabled & channel) != 0;
|
||||
}
|
||||
|
||||
void DebugManager::debugFlagsRegister(const DebugChannelDef *channels) {
|
||||
clearAllDebugChannels();
|
||||
|
||||
if (channels) {
|
||||
addDebugChannels(channels);
|
||||
}
|
||||
}
|
||||
|
||||
void DebugManager::addDebugChannels(const DebugChannelDef *channels) {
|
||||
for (uint i = 0; channels[i].channel != 0; ++i) {
|
||||
addDebugChannel(channels[i].channel, channels[i].name, channels[i].description);
|
||||
|
|
|
@ -507,7 +507,7 @@ bool ScummDebugger::Cmd_Object(int argc, const char **argv) {
|
|||
}
|
||||
|
||||
bool ScummDebugger::Cmd_Debug(int argc, const char **argv) {
|
||||
const Common::DebugManager::DebugChannelList &lvls = DebugMan.listDebugChannels();
|
||||
const Common::DebugManager::DebugChannelList &lvls = DebugMan.getDebugChannels();
|
||||
|
||||
// No parameters given: Print out a list of all channels and their status
|
||||
if (argc <= 1) {
|
||||
|
|
|
@ -733,7 +733,7 @@ bool Debugger::cmdDebugLevel(int argc, const char **argv) {
|
|||
}
|
||||
|
||||
bool Debugger::cmdDebugFlagsList(int argc, const char **argv) {
|
||||
const Common::DebugManager::DebugChannelList &debugLevels = DebugMan.listDebugChannels();
|
||||
const Common::DebugManager::DebugChannelList &debugLevels = DebugMan.getDebugChannels();
|
||||
|
||||
debugPrintf("Engine debug levels:\n");
|
||||
debugPrintf("--------------------\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue