[Scummvm-git-logs] scummvm master -> 6dfe6ad51a71d7e5d6cc7b473ded7d89d275ba13

sev- sev at scummvm.org
Fri May 21 23:35:52 UTC 2021


This automated email contains information about 87 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
9d149b7988 ENGINE: add method getDebugChannelOptions for metaegine detection
c32fb48a38 PINK: move adding debugchannels to detection
061fd12966 BASE: register debug channel before instantiate the engine in main
f07ceca9cb BASE: add global debug flag
9609406205 COMMON: introduce debugFlagsClear and debugFlagsRegister to debug manager
a6542f242e BASE: move setting debug flags to debug manager, set debug flags before call detectGames
a64a097ca3 COMMON: change passing pointer instead of passing the array when passing the debug channels
1c333f66e2 BASE: change the method name to adapt for new api
dde0961225 ENGINE: return the pointer of array instead of a array of getDebugChannels in metaengine
11ba16558a PINK: change the AD to adapt for new api
9ca5ce1390 COMMON: fix the include file of debug.h and debug-channels.h
96aa98ed14 ENGINE: change the name of the delimiter of DebugChannelDef
4505054c33 BASE: Register debug channels before calling the findGame() in plugins.cpp
d3b596d820 BASE: Register debug channels before calling the findGame() in main.cpp
1c4e15599f GUI: Register debug channels before run saveload-dialog
d2ea7cea88 COMMON: fix the bug when using default implementation of getDebugChannel
d0ea1c5953 DIRECTOR: move debug channels to metaEngineDetection
24e7c01c19 ACCESS: move debug channels to metaEngineDetection
0cfdf7bb6e ADL: move debug channels to metaEngineDetection
ff8d7f442a AGI: move debug channels to metaEngineDetection
7dcf259006 AGOS: move debug channels to metaEngineDetection
29e39e0d55 AGS: move debug channels to metaEngineDetection
44e2285003 BASE: add duplicate debug channel check for addDebugChannel
a5bb79d6fd BLADERUNNER: move debug channels to metaEngineDetection
3ad0a9573a CGE: move debug channels to metaEngineDetection
7a0d9546ce GUI: move kDebugLevelEventRec flag to global flag
b2f5ee4ab9 CGE2: move debug channels to metaEngineDetection
c80dd052d7 CINE: move debug channels to metaEngineDetection
5daceeac83 CRUISE: move debug channels to metaEngineDetection
c24f589c8f CRYOMNI3D: move debug channels to metaEngineDetection
467c6594a2 DRACI: move debug channels to metaEngineDetection
d987e1a6b1 DREAMWEB: move debug channels to metaEngineDetection
ad4f367292 GLK: move debug channels to metaEngineDetection
e42e1bcb25 GNAP: move debug channels to metaEngineDetection
3f74a19d81 GOB: move debug channels to metaEngineDetection
2bb220f545 GROOVIE: move debug channels to metaEngineDetection
9d585ee994 HADESCH: move debug channels to metaEngineDetection
cd6a9db116 HOPKINS: move debug channels to metaEngineDetection
58d4dc84c1 HUGO: move debug channels to metaEngineDetection
957189213d KINGDOM: move debug channels to metaEngineDetection
034be8cc6d KYRA: move debug channels to metaEngineDetection
fb1e15fc3d LASTEXPRESS: move debug channels to metaEngineDetection
414d6235b3 LILLIPUT: move debug channels to metaEngineDetection
acc86e6140 LURE: move debug channels to metaEngineDetection
eb0412c21f MACVENTURE: move debug channels to metaEngineDetection
a336c3158f MADS: move debug channels to metaEngineDetection
ad62915be3 MORTEVIELLE: move debug channels to metaEngineDetection
37e313bada MYST3: move debug channels to metaEngineDetection
04d03fe7f0 NANCY: move debug channels to metaEngineDetection
9c7718465e NGI: move debug channels to metaEngineDetection
3909daf6a2 PARALLACTION: move debug channels to metaEngineDetection
e955e588d0 PETKA: move debug channels to metaEngineDetection
e52a3bf7ec PLUMBERS: move debug channels to metaEngineDetection
9d0818015e PRINCE: move debug channels to metaEngineDetection
043fda5c47 PRIVATE: move debug channels to metaEngineDetection
3a65856f4c SCI: move debug channels to metaEngineDetection
17efb68cba SCUMM: move debug channels to metaEngineDetection
53dcc76913 SHERLOCK: move debug channels to metaEngineDetection
554fb982ab SLUDGE: move debug channels to metaEngineDetection
0b070c9f06 STARK: move debug channels to metaEngineDetection
2c93928e5f STARTREK: move debug channels to metaEngineDetection
489d605cad SUPERNOVA: move debug channels to metaEngineDetection
3c283af377 SWORD25: move debug channels to metaEngineDetection
8c500c9675 TEENAGENT: move debug channels to metaEngineDetection
32f66c21dd TESTBED: move debug channels to metaEngineDetection
bea68bb58c TINSEL: move debug channels to metaEngineDetection
8905a28f89 TITANIC: move debug channels to metaEngineDetection
f58b4c5e59 TONY: move debug channels to metaEngineDetection
b50b2251a4 TOON: move debug channels to metaEngineDetection
f91930091b TOUCHE: move debug channels to metaEngineDetection
f1a242d44e TSAGE: move debug channels to metaEngineDetection
cad09bb63b VOYEUR: move debug channels to metaEngineDetection
a8afd02783 WINTERMUTE: move debug channels to metaEngineDetection
5bdaf49328 XEEN: move debug channels to metaEngineDetection
b41b540a03 AGI: delete adding debug channels in preagi
dd14b7b34a GRIM: move debug flags to metaEngineDetection
5feac6bdff BASE: add list-all-debugflags and list-debugflags to commandLine
d147ab855f BASE: add listing the engine specified debugflags in commandline
649661a6da BASE: add clarification for list-debugflags when typing help
6d1aece1a8 COMMON: remove kDebugGlobalTest flag
361c723e8a ENGINE: introduce kDebugGlobalDetection which is used for print debug messages of advancedDetector
d7dfc15229 DIRECTOR: fix code style problem
5f74ffcf0a ADL: move debug messages in detection into kDebugGlobalDetection channel
263d27a89b SCUMM: move debug messages in detection into kDebugGlobalDetection channel
9f1f800d5a SCUMM: add forward declaration of FontSJIS
859d9acef3 ENGINE: add doxygen comments fo DebugChannelDef and getDebugChannels
6dfe6ad51a ASYLUM: move debugchannels to metaEngineDetection


Commit: 9d149b7988bce45185f26464fffbf4c8ffe8c99b
    https://github.com/scummvm/scummvm/commit/9d149b7988bce45185f26464fffbf4c8ffe8c99b
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
ENGINE: add method getDebugChannelOptions for metaegine detection

Changed paths:
    engines/metaengine.h


diff --git a/engines/metaengine.h b/engines/metaengine.h
index b4075be976..8b70c69d99 100644
--- a/engines/metaengine.h
+++ b/engines/metaengine.h
@@ -74,11 +74,19 @@ struct ExtraGuiOption {
 	bool defaultState;         /*!< Default state of the checkbox (checked or not). */
 };
 
+struct DebugChannelOption {
+	uint32 channel;
+	Common::String name;
+	Common::String description;
+};
+
 /**
  * Array of ExtraGuiOption structures.
  */
 typedef Common::Array<ExtraGuiOption> ExtraGuiOptions;
 
+typedef Common::Array<DebugChannelOption> DebugChannelOptions;
+
 /**
  * @todo Doc required
  */
@@ -162,6 +170,11 @@ public:
 		return ExtraGuiOptions();
 	}
 
+	virtual const DebugChannelOptions getDebugChannelOptions() const {
+		warning("Using the default implementation of getDebugChannelOptions");
+		return DebugChannelOptions();
+	}
+
 	/**
 	 * Register the default values for the settings that the engine uses into the
 	 * configuration manager.


Commit: c32fb48a38380dbfb26aa6d6d6850504c39a0980
    https://github.com/scummvm/scummvm/commit/c32fb48a38380dbfb26aa6d6d6850504c39a0980
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
PINK: move adding debugchannels to detection

Changed paths:
    engines/pink/detection.cpp
    engines/pink/pink.cpp


diff --git a/engines/pink/detection.cpp b/engines/pink/detection.cpp
index 5fc66f7ef0..94078c9a84 100644
--- a/engines/pink/detection.cpp
+++ b/engines/pink/detection.cpp
@@ -24,6 +24,8 @@
 
 #include "engines/advancedDetector.h"
 
+#include "pink/pink.h"
+
 static const PlainGameDescriptor pinkGames[] = {
 	{"peril", "The Pink Panther: Passport to Peril"},
 	{"pokus", "The Pink Panther: Hokus Pokus Pink"},
@@ -37,6 +39,14 @@ static const char *directoryGlobs[] = {
 	nullptr
 };
 
+static const DebugChannelOption debugFlagList[] = {
+	{Pink::kPinkDebugGeneral, "general", "General issues"},
+	{Pink::kPinkDebugLoadingResources, "loading_resources", "Loading resources data"},
+	{Pink::kPinkDebugLoadingObjects, "loading_objects", "Serializing objects from Orb"},
+	{Pink::kPinkDebugScripts, "scripts", "Sequences"},
+	{Pink::kPinkDebugActions, "actions", "Actions"}
+};
+
 
 class PinkMetaEngineDetection : public AdvancedMetaEngineDetection {
 public:
@@ -57,6 +67,13 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Pink Panther (C) Wanderlust Interactive";
 	}
+
+	const DebugChannelOptions getDebugChannelOptions() const override {
+		DebugChannelOptions options;
+		for (int i = 0; i < 5; i++)
+			options.push_back(debugFlagList[i]);
+		return options;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(PINK_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, PinkMetaEngineDetection);
diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp
index 1fa1a7b6d3..0e9374676b 100644
--- a/engines/pink/pink.cpp
+++ b/engines/pink/pink.cpp
@@ -45,12 +45,6 @@ PinkEngine::PinkEngine(OSystem *system, const ADGameDescription *desc)
 	_desc(desc), _bro(nullptr), _menu(nullptr), _actor(nullptr),
 	_module(nullptr), _director(nullptr), _pdaMgr(this) {
 
-	DebugMan.addDebugChannel(kPinkDebugGeneral, "general", "General issues");
-	DebugMan.addDebugChannel(kPinkDebugLoadingResources, "loading_resources", "Loading resources data");
-	DebugMan.addDebugChannel(kPinkDebugLoadingObjects, "loading_objects", "Serializing objects from Orb");
-	DebugMan.addDebugChannel(kPinkDebugScripts, "scripts", "Sequences");
-	DebugMan.addDebugChannel(kPinkDebugActions, "actions", "Actions");
-
 	const Common::FSNode gameDataDir(ConfMan.get("path"));
 	SearchMan.addSubDirectoryMatching(gameDataDir, "install");
 }


Commit: 061fd129663d6edaabecbc5573ff917d8bf8c2f9
    https://github.com/scummvm/scummvm/commit/061fd129663d6edaabecbc5573ff917d8bf8c2f9
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
BASE: register debug channel before instantiate the engine in main

Changed paths:
    base/main.cpp


diff --git a/base/main.cpp b/base/main.cpp
index 8130c1fe64..fd3c540c1d 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -191,6 +191,11 @@ static Common::Error runGame(const Plugin *plugin, const Plugin *enginePlugin, O
 		metaEngineDetection.registerDefaultSettings(target);
 	}
 
+	// before we instantiate the engine, we register debug channels for it
+	DebugChannelOptions debugChannelOptions = metaEngineDetection.getDebugChannelOptions();
+	for (uint i = 0; i < debugChannelOptions.size(); i++)
+		DebugMan.addDebugChannel(debugChannelOptions[i].channel, debugChannelOptions[i].name, debugChannelOptions[i].description);
+
 	// Create the game's MetaEngine.
 	MetaEngine &metaEngine = enginePlugin->get<MetaEngine>();
 	err = metaEngine.createInstance(&system, &engine);


Commit: f07ceca9cb83eb869a85136c3c922bda07d06803
    https://github.com/scummvm/scummvm/commit/f07ceca9cb83eb869a85136c3c922bda07d06803
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
BASE: add global debug flag

Changed paths:
    base/main.cpp
    common/debug.h


diff --git a/base/main.cpp b/base/main.cpp
index fd3c540c1d..e0860bec51 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -151,6 +151,18 @@ void saveLastLaunchedTarget(const Common::String &target) {
 	}
 }
 
+void debugFlagsRegister(const DebugChannelOptions &options) {
+	for (uint i = 0; i < options.size(); i++)
+		DebugMan.addDebugChannel(options[i].channel, options[i].name, options[i].description);
+}
+
+void debugFlagClear() {
+	// first we clear all the debug channels
+	// then we add the global debug flags
+	DebugMan.clearAllDebugChannels();
+	DebugMan.addDebugChannel(kDebugGlobalTest, "test", "test global debug flag");
+}
+
 // TODO: specify the possible return values here
 static Common::Error runGame(const Plugin *plugin, const Plugin *enginePlugin, OSystem &system, const Common::String &edebuglevels) {
 	assert(plugin);
@@ -191,10 +203,10 @@ static Common::Error runGame(const Plugin *plugin, const Plugin *enginePlugin, O
 		metaEngineDetection.registerDefaultSettings(target);
 	}
 
+	// clear the flag and add the global ones
+	debugFlagClear();
 	// before we instantiate the engine, we register debug channels for it
-	DebugChannelOptions debugChannelOptions = metaEngineDetection.getDebugChannelOptions();
-	for (uint i = 0; i < debugChannelOptions.size(); i++)
-		DebugMan.addDebugChannel(debugChannelOptions[i].channel, debugChannelOptions[i].name, debugChannelOptions[i].description);
+	debugFlagsRegister(metaEngineDetection.getDebugChannelOptions());
 
 	// Create the game's MetaEngine.
 	MetaEngine &metaEngine = enginePlugin->get<MetaEngine>();
@@ -514,6 +526,8 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
 	system.getAudioCDManager();
 	MusicManager::instance();
 	Common::DebugManager::instance();
+	// set the global debug flags as soon as we instantiate the debug mannager
+	debugFlagClear();
 
 	// Init the event manager. As the virtual keyboard is loaded here, it must
 	// take place after the backend is initiated and the screen has been setup
diff --git a/common/debug.h b/common/debug.h
index 17ac5a743d..acca2b1c3e 100644
--- a/common/debug.h
+++ b/common/debug.h
@@ -163,6 +163,10 @@ enum GlobalDebugLevels {
 	kDebugLevelEventRec = 1 << 30
 };
 
+enum GlobalDebugFlags {
+	kDebugGlobalTest = 1 << 31
+};
+
 /** @} */
 
 #endif


Commit: 9609406205b4cd9cd4cf4b52ee926887625b12f2
    https://github.com/scummvm/scummvm/commit/9609406205b4cd9cd4cf4b52ee926887625b12f2
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
COMMON: introduce debugFlagsClear and debugFlagsRegister to debug manager

Changed paths:
    common/debug-channels.h
    common/debug.cpp


diff --git a/common/debug-channels.h b/common/debug-channels.h
index 73fbe7fa36..082b414fa8 100644
--- a/common/debug-channels.h
+++ b/common/debug-channels.h
@@ -31,6 +31,7 @@
 #include "common/singleton.h"
 #include "common/str.h"
 
+#include "metaengine.h"
 
 namespace Common {
 
@@ -144,6 +145,18 @@ public:
 	 */
 	bool isDebugChannelEnabled(uint32 channel, bool enforce = false);
 
+
+	/**
+	 * clear all the engine specified flags
+	 * only left the global debug flags
+	 */
+	void debugFlagsClear();
+
+	/**
+	 * register engine specified flags
+	 */
+	void debugFlagsRegister(const DebugChannelOptions &options);
+
 private:
 	typedef HashMap<String, DebugChannel, IgnoreCase_Hash, IgnoreCase_EqualTo> DebugChannelMap;
 
diff --git a/common/debug.cpp b/common/debug.cpp
index 568d2d52cb..898ee204fa 100644
--- a/common/debug.cpp
+++ b/common/debug.cpp
@@ -128,6 +128,18 @@ bool DebugManager::isDebugChannelEnabled(uint32 channel, bool enforce) {
 		return (gDebugChannelsEnabled & channel) != 0;
 }
 
+void DebugManager::debugFlagsRegister(const DebugChannelOptions &options) {
+	for (uint i = 0; i < options.size(); i++)
+		addDebugChannel(options[i].channel, options[i].name, options[i].description);
+}
+
+void DebugManager::debugFlagsClear() {
+	// first we clear all the debug channels
+	// then we add the global debug flags
+	clearAllDebugChannels();
+	addDebugChannel(kDebugGlobalTest, "test", "test global debug flag");
+}
+
 } // End of namespace Common
 
 bool debugLevelSet(int level) {


Commit: a6542f242eb1d4ec0a50525dc32bb64811cb07eb
    https://github.com/scummvm/scummvm/commit/a6542f242eb1d4ec0a50525dc32bb64811cb07eb
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
BASE: move setting debug flags to debug manager, set debug flags before call detectGames

Changed paths:
    base/main.cpp
    base/plugins.cpp


diff --git a/base/main.cpp b/base/main.cpp
index e0860bec51..dd55784603 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -151,18 +151,6 @@ void saveLastLaunchedTarget(const Common::String &target) {
 	}
 }
 
-void debugFlagsRegister(const DebugChannelOptions &options) {
-	for (uint i = 0; i < options.size(); i++)
-		DebugMan.addDebugChannel(options[i].channel, options[i].name, options[i].description);
-}
-
-void debugFlagClear() {
-	// first we clear all the debug channels
-	// then we add the global debug flags
-	DebugMan.clearAllDebugChannels();
-	DebugMan.addDebugChannel(kDebugGlobalTest, "test", "test global debug flag");
-}
-
 // TODO: specify the possible return values here
 static Common::Error runGame(const Plugin *plugin, const Plugin *enginePlugin, OSystem &system, const Common::String &edebuglevels) {
 	assert(plugin);
@@ -204,9 +192,9 @@ static Common::Error runGame(const Plugin *plugin, const Plugin *enginePlugin, O
 	}
 
 	// clear the flag and add the global ones
-	debugFlagClear();
+	DebugMan.debugFlagsClear();
 	// before we instantiate the engine, we register debug channels for it
-	debugFlagsRegister(metaEngineDetection.getDebugChannelOptions());
+	DebugMan.debugFlagsRegister(metaEngineDetection.getDebugChannelOptions());
 
 	// Create the game's MetaEngine.
 	MetaEngine &metaEngine = enginePlugin->get<MetaEngine>();
@@ -527,7 +515,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
 	MusicManager::instance();
 	Common::DebugManager::instance();
 	// set the global debug flags as soon as we instantiate the debug mannager
-	debugFlagClear();
+	DebugMan.debugFlagsClear();
 
 	// Init the event manager. As the virtual keyboard is loaded here, it must
 	// take place after the backend is initiated and the screen has been setup
diff --git a/base/plugins.cpp b/base/plugins.cpp
index 6226945ac5..fb8cae263a 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -24,6 +24,7 @@
 
 #include "common/func.h"
 #include "common/debug.h"
+#include "common/debug-channels.h"
 #include "common/config-manager.h"
 
 #ifdef DYNAMIC_MODULES
@@ -732,6 +733,9 @@ DetectionResults EngineManager::detectGames(const Common::FSList &fslist) const
 	// the game in the presented directory.
 	for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
 		const MetaEngineDetection &metaEngine = (*iter)->get<MetaEngineDetection>();
+		// set the debug flags
+		DebugMan.debugFlagsClear();
+		DebugMan.debugFlagsRegister(metaEngine.getDebugChannelOptions());
 		DetectedGames engineCandidates = metaEngine.detectGames(fslist);
 
 		for (uint i = 0; i < engineCandidates.size(); i++) {
@@ -927,6 +931,9 @@ 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.debugFlagsClear();
+		DebugMan.debugFlagsRegister(metaEngine.getDebugChannelOptions());
 		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'",


Commit: a64a097ca33729d3bf8759637f317e7a5d19ecab
    https://github.com/scummvm/scummvm/commit/a64a097ca33729d3bf8759637f317e7a5d19ecab
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
COMMON: change passing pointer instead of passing the array when passing the debug channels

Changed paths:
    common/debug-channels.h
    common/debug.cpp
    common/debug.h


diff --git a/common/debug-channels.h b/common/debug-channels.h
index 082b414fa8..59892ad9f9 100644
--- a/common/debug-channels.h
+++ b/common/debug-channels.h
@@ -155,7 +155,7 @@ public:
 	/**
 	 * register engine specified flags
 	 */
-	void debugFlagsRegister(const DebugChannelOptions &options);
+	void debugFlagsRegister(const DebugChannelDef *channels);
 
 private:
 	typedef HashMap<String, DebugChannel, IgnoreCase_Hash, IgnoreCase_EqualTo> DebugChannelMap;
diff --git a/common/debug.cpp b/common/debug.cpp
index 898ee204fa..3640a5a8e1 100644
--- a/common/debug.cpp
+++ b/common/debug.cpp
@@ -128,16 +128,16 @@ bool DebugManager::isDebugChannelEnabled(uint32 channel, bool enforce) {
 		return (gDebugChannelsEnabled & channel) != 0;
 }
 
-void DebugManager::debugFlagsRegister(const DebugChannelOptions &options) {
-	for (uint i = 0; i < options.size(); i++)
-		addDebugChannel(options[i].channel, options[i].name, options[i].description);
+void DebugManager::debugFlagsRegister(const DebugChannelDef *channels) {
+	for (uint i = 0; channels[i].channel != 0; i++)
+		addDebugChannel(channels[i].channel, channels[i].name, channels[i].description);
 }
 
 void DebugManager::debugFlagsClear() {
 	// first we clear all the debug channels
 	// then we add the global debug flags
 	clearAllDebugChannels();
-	addDebugChannel(kDebugGlobalTest, "test", "test global debug flag");
+	debugFlagsRegister(globalDebugChannels);
 }
 
 } // End of namespace Common
diff --git a/common/debug.h b/common/debug.h
index acca2b1c3e..ac4b4f9080 100644
--- a/common/debug.h
+++ b/common/debug.h
@@ -25,6 +25,8 @@
 
 #include "common/scummsys.h"
 
+#include "metaengine.h"
+
 #ifdef DISABLE_TEXT_CONSOLE
 
 inline void debug(const char *s, ...) {}
@@ -160,11 +162,13 @@ extern bool gDebugChannelsOnly;
 
 /** Global constant for EventRecorder debug channel. */
 enum GlobalDebugLevels {
-	kDebugLevelEventRec = 1 << 30
+	kDebugLevelEventRec = 1 << 30,
+	kDebugGlobalTest = 1 << 29
 };
 
-enum GlobalDebugFlags {
-	kDebugGlobalTest = 1 << 31
+static const DebugChannelDef globalDebugChannels[] = {
+	{kDebugGlobalTest, "test", "test global debug flag"},
+	{0, "delimiter", "delimiter"}
 };
 
 /** @} */


Commit: 1c333f66e2d6dddc871ce13003a16726cdcbae71
    https://github.com/scummvm/scummvm/commit/1c333f66e2d6dddc871ce13003a16726cdcbae71
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
BASE: change the method name to adapt for new api

Changed paths:
    base/main.cpp
    base/plugins.cpp


diff --git a/base/main.cpp b/base/main.cpp
index dd55784603..3abbf92610 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -194,7 +194,7 @@ static Common::Error runGame(const Plugin *plugin, const Plugin *enginePlugin, O
 	// clear the flag and add the global ones
 	DebugMan.debugFlagsClear();
 	// before we instantiate the engine, we register debug channels for it
-	DebugMan.debugFlagsRegister(metaEngineDetection.getDebugChannelOptions());
+	DebugMan.debugFlagsRegister(metaEngineDetection.getDebugChannels());
 
 	// Create the game's MetaEngine.
 	MetaEngine &metaEngine = enginePlugin->get<MetaEngine>();
diff --git a/base/plugins.cpp b/base/plugins.cpp
index fb8cae263a..a53b0dc50f 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -735,7 +735,7 @@ DetectionResults EngineManager::detectGames(const Common::FSList &fslist) const
 		const MetaEngineDetection &metaEngine = (*iter)->get<MetaEngineDetection>();
 		// set the debug flags
 		DebugMan.debugFlagsClear();
-		DebugMan.debugFlagsRegister(metaEngine.getDebugChannelOptions());
+		DebugMan.debugFlagsRegister(metaEngine.getDebugChannels());
 		DetectedGames engineCandidates = metaEngine.detectGames(fslist);
 
 		for (uint i = 0; i < engineCandidates.size(); i++) {
@@ -933,7 +933,7 @@ void EngineManager::upgradeTargetForEngineId(const Common::String &target) const
 		const MetaEngineDetection &metaEngine = plugin->get<MetaEngineDetection>();
 		// set debug flags before call detectGames
 		DebugMan.debugFlagsClear();
-		DebugMan.debugFlagsRegister(metaEngine.getDebugChannelOptions());
+		DebugMan.debugFlagsRegister(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'",


Commit: dde0961225b87bd152b0a526407c929396a5ca4b
    https://github.com/scummvm/scummvm/commit/dde0961225b87bd152b0a526407c929396a5ca4b
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
ENGINE: return the pointer of array instead of a array of getDebugChannels in metaengine

Changed paths:
    engines/metaengine.h


diff --git a/engines/metaengine.h b/engines/metaengine.h
index 8b70c69d99..e5ca934ce6 100644
--- a/engines/metaengine.h
+++ b/engines/metaengine.h
@@ -74,19 +74,19 @@ struct ExtraGuiOption {
 	bool defaultState;         /*!< Default state of the checkbox (checked or not). */
 };
 
-struct DebugChannelOption {
+struct DebugChannelDef {
 	uint32 channel;
 	Common::String name;
 	Common::String description;
 };
 
+#define DEBUG_CHANNEL_DELIMITER {0, "", ""}
+
 /**
  * Array of ExtraGuiOption structures.
  */
 typedef Common::Array<ExtraGuiOption> ExtraGuiOptions;
 
-typedef Common::Array<DebugChannelOption> DebugChannelOptions;
-
 /**
  * @todo Doc required
  */
@@ -170,9 +170,9 @@ public:
 		return ExtraGuiOptions();
 	}
 
-	virtual const DebugChannelOptions getDebugChannelOptions() const {
-		warning("Using the default implementation of getDebugChannelOptions");
-		return DebugChannelOptions();
+	virtual const DebugChannelDef *getDebugChannels() const {
+		warning("Using the default implementation of getDebugChannels");
+		return NULL;
 	}
 
 	/**


Commit: 11ba16558a1c6e0bbf71d014dae4d4c6fd8893a2
    https://github.com/scummvm/scummvm/commit/11ba16558a1c6e0bbf71d014dae4d4c6fd8893a2
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
PINK: change the AD to adapt for new api

Changed paths:
    engines/pink/detection.cpp


diff --git a/engines/pink/detection.cpp b/engines/pink/detection.cpp
index 94078c9a84..dc72ab4e47 100644
--- a/engines/pink/detection.cpp
+++ b/engines/pink/detection.cpp
@@ -39,12 +39,13 @@ static const char *directoryGlobs[] = {
 	nullptr
 };
 
-static const DebugChannelOption debugFlagList[] = {
+static const DebugChannelDef debugFlagList[] = {
 	{Pink::kPinkDebugGeneral, "general", "General issues"},
 	{Pink::kPinkDebugLoadingResources, "loading_resources", "Loading resources data"},
 	{Pink::kPinkDebugLoadingObjects, "loading_objects", "Serializing objects from Orb"},
 	{Pink::kPinkDebugScripts, "scripts", "Sequences"},
-	{Pink::kPinkDebugActions, "actions", "Actions"}
+	{Pink::kPinkDebugActions, "actions", "Actions"},
+	DEBUG_CHANNEL_DELIMITER
 };
 
 
@@ -68,11 +69,8 @@ public:
 		return "Pink Panther (C) Wanderlust Interactive";
 	}
 
-	const DebugChannelOptions getDebugChannelOptions() const override {
-		DebugChannelOptions options;
-		for (int i = 0; i < 5; i++)
-			options.push_back(debugFlagList[i]);
-		return options;
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
 	}
 };
 


Commit: 9ca5ce1390ab73532c02eab591f5ddc08893e446
    https://github.com/scummvm/scummvm/commit/9ca5ce1390ab73532c02eab591f5ddc08893e446
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
COMMON: fix the include file of debug.h and debug-channels.h

Changed paths:
    common/debug-channels.h
    common/debug.h


diff --git a/common/debug-channels.h b/common/debug-channels.h
index 59892ad9f9..fa30cf830e 100644
--- a/common/debug-channels.h
+++ b/common/debug-channels.h
@@ -31,7 +31,7 @@
 #include "common/singleton.h"
 #include "common/str.h"
 
-#include "metaengine.h"
+#include "engines/metaengine.h"
 
 namespace Common {
 
diff --git a/common/debug.h b/common/debug.h
index ac4b4f9080..290873fde9 100644
--- a/common/debug.h
+++ b/common/debug.h
@@ -25,7 +25,7 @@
 
 #include "common/scummsys.h"
 
-#include "metaengine.h"
+#include "engines/metaengine.h"
 
 #ifdef DISABLE_TEXT_CONSOLE
 


Commit: 96aa98ed148f9cecdc067bf07b1e5309d3ff706d
    https://github.com/scummvm/scummvm/commit/96aa98ed148f9cecdc067bf07b1e5309d3ff706d
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
ENGINE: change the name of the delimiter of DebugChannelDef

Changed paths:
    common/debug.h
    engines/metaengine.h
    engines/pink/detection.cpp


diff --git a/common/debug.h b/common/debug.h
index 290873fde9..b658af9413 100644
--- a/common/debug.h
+++ b/common/debug.h
@@ -168,7 +168,7 @@ enum GlobalDebugLevels {
 
 static const DebugChannelDef globalDebugChannels[] = {
 	{kDebugGlobalTest, "test", "test global debug flag"},
-	{0, "delimiter", "delimiter"}
+	DEBUG_CHANNEL_END
 };
 
 /** @} */
diff --git a/engines/metaengine.h b/engines/metaengine.h
index e5ca934ce6..401b939026 100644
--- a/engines/metaengine.h
+++ b/engines/metaengine.h
@@ -76,11 +76,11 @@ struct ExtraGuiOption {
 
 struct DebugChannelDef {
 	uint32 channel;
-	Common::String name;
-	Common::String description;
+	const char *name;
+	const char *description;
 };
 
-#define DEBUG_CHANNEL_DELIMITER {0, "", ""}
+#define DEBUG_CHANNEL_END {0, NULL, NULL}
 
 /**
  * Array of ExtraGuiOption structures.
diff --git a/engines/pink/detection.cpp b/engines/pink/detection.cpp
index dc72ab4e47..412e0d1b29 100644
--- a/engines/pink/detection.cpp
+++ b/engines/pink/detection.cpp
@@ -45,7 +45,7 @@ static const DebugChannelDef debugFlagList[] = {
 	{Pink::kPinkDebugLoadingObjects, "loading_objects", "Serializing objects from Orb"},
 	{Pink::kPinkDebugScripts, "scripts", "Sequences"},
 	{Pink::kPinkDebugActions, "actions", "Actions"},
-	DEBUG_CHANNEL_DELIMITER
+	DEBUG_CHANNEL_END
 };
 
 


Commit: 4505054c333b4ce61d7499217df865441404f46f
    https://github.com/scummvm/scummvm/commit/4505054c333b4ce61d7499217df865441404f46f
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
BASE: Register debug channels before calling the findGame() in plugins.cpp

Changed paths:
    base/plugins.cpp


diff --git a/base/plugins.cpp b/base/plugins.cpp
index a53b0dc50f..f62a1b6d5c 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -678,6 +678,8 @@ QualifiedGameList EngineManager::findGamesMatching(const Common::String &engineI
 		const Plugin *p = EngineMan.findPlugin(engineId);
 		if (p) {
 			const MetaEngineDetection &engine = p->get<MetaEngineDetection>();
+			DebugMan.debugFlagsClear();
+			DebugMan.debugFlagsRegister(engine.getDebugChannels());
 
 			PlainGameDescriptor pluginResult = engine.findGame(gameId.c_str());
 			if (pluginResult.gameId) {
@@ -707,6 +709,8 @@ QualifiedGameList EngineManager::findGameInLoadedPlugins(const Common::String &g
 
 	for (iter = plugins.begin(); iter != plugins.end(); ++iter) {
 		const MetaEngineDetection &engine = (*iter)->get<MetaEngineDetection>();
+		DebugMan.debugFlagsClear();
+		DebugMan.debugFlagsRegister(engine.getDebugChannels());
 		PlainGameDescriptor pluginResult = engine.findGame(gameId.c_str());
 
 		if (pluginResult.gameId) {
@@ -866,6 +870,8 @@ QualifiedGameDescriptor EngineManager::findTarget(const Common::String &target,
 
 	// Make sure it does support the game ID
 	const MetaEngineDetection &engine = foundPlugin->get<MetaEngineDetection>();
+	DebugMan.debugFlagsClear();
+	DebugMan.debugFlagsRegister(engine.getDebugChannels());
 	PlainGameDescriptor desc = engine.findGame(domain->getVal("gameid").c_str());
 	if (!desc.gameId) {
 		return QualifiedGameDescriptor();


Commit: d3b596d820266d4b52d0ff54023a90af3c808db6
    https://github.com/scummvm/scummvm/commit/d3b596d820266d4b52d0ff54023a90af3c808db6
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
BASE: Register debug channels before calling the findGame() in main.cpp

Changed paths:
    base/main.cpp


diff --git a/base/main.cpp b/base/main.cpp
index 3abbf92610..d91bd8c27d 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -133,7 +133,10 @@ static const Plugin *detectPlugin() {
 
 	// Query the plugin for the game descriptor
 	printf("   Looking for a plugin supporting this target... %s\n", plugin->getName());
-	PlainGameDescriptor game = plugin->get<MetaEngineDetection>().findGame(gameId.c_str());
+	const MetaEngineDetection &metaEngine = plugin->get<MetaEngineDetection>();
+	DebugMan.debugFlagsClear();
+	DebugMan.debugFlagsRegister(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());
 		return 0;
@@ -229,6 +232,7 @@ static Common::Error runGame(const Plugin *plugin, const Plugin *enginePlugin, O
 	Common::String caption(ConfMan.get("description"));
 
 	if (caption.empty()) {
+		// here, we don't need to set the debug channels because it has been set earlier
 		PlainGameDescriptor game = metaEngineDetection.findGame(ConfMan.get("gameid").c_str());
 		if (game.description) {
 			caption = game.description;


Commit: 1c4e15599f4a88aaba903952f0cfb385a5d0f213
    https://github.com/scummvm/scummvm/commit/1c4e15599f4a88aaba903952f0cfb385a5d0f213
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
GUI: Register debug channels before run saveload-dialog

Changed paths:
    gui/saveload.cpp


diff --git a/gui/saveload.cpp b/gui/saveload.cpp
index 8bd4f11c61..9cb6f266e7 100644
--- a/gui/saveload.cpp
+++ b/gui/saveload.cpp
@@ -22,6 +22,7 @@
 
 #include "common/config-manager.h"
 #include "common/system.h"
+#include "common/debug-channels.h"
 
 #include "gui/saveload.h"
 #include "gui/saveload-dialog.h"
@@ -80,6 +81,10 @@ int SaveLoadChooser::runModalWithCurrentTarget() {
 	if (!g_engine)
 		error("No engine is currently active");
 
+	const MetaEngineDetection &metaEngineDetection = g_engine->getMetaEngineDetection();
+	DebugMan.debugFlagsClear();
+	DebugMan.debugFlagsRegister(metaEngineDetection.getDebugChannels());
+
 	return runModalWithMetaEngineAndTarget(g_engine->getMetaEngine(), ConfMan.getActiveDomainName());
 }
 


Commit: d2ea7cea8882bba0c5b0c97d4afa60048a8e4540
    https://github.com/scummvm/scummvm/commit/d2ea7cea8882bba0c5b0c97d4afa60048a8e4540
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
COMMON: fix the bug when using default implementation of getDebugChannel

Changed paths:
    common/debug.cpp


diff --git a/common/debug.cpp b/common/debug.cpp
index 3640a5a8e1..9110332751 100644
--- a/common/debug.cpp
+++ b/common/debug.cpp
@@ -129,6 +129,8 @@ bool DebugManager::isDebugChannelEnabled(uint32 channel, bool enforce) {
 }
 
 void DebugManager::debugFlagsRegister(const DebugChannelDef *channels) {
+	if (!channels)
+		return;
 	for (uint i = 0; channels[i].channel != 0; i++)
 		addDebugChannel(channels[i].channel, channels[i].name, channels[i].description);
 }


Commit: d0ea1c59534ed14455cd65039a3d559c3de2a1f1
    https://github.com/scummvm/scummvm/commit/d0ea1c59534ed14455cd65039a3d559c3de2a1f1
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
DIRECTOR: move debug channels to metaEngineDetection

Changed paths:
    engines/director/detection.cpp
    engines/director/director.cpp


diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index 144fbc868b..82009282d8 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -27,6 +27,7 @@
 #include "common/file.h"
 
 #include "director/detection.h"
+#include "director/director.h"
 
 static const PlainGameDescriptor directorGames[] = {
 	{ "director",			"Macromedia Director Game" },
@@ -186,6 +187,27 @@ static const char *directoryGlobs[] = {
 	0
 };
 
+static DebugChannelDef debugFlagList[] = {
+	{Director::kDebugCompile, "compile", "Lingo Compilation"},
+	{Director::kDebugCompileOnly, "compileonly", "Skip Lingo code execution"},
+	{Director::kDebugDesktop, "desktop", "Show the Classic Mac desktop"},
+	{Director::kDebugEndVideo, "endvideo", "Fake that the end of video is reached setting"},
+	{Director::kDebugEvents, "events", "Event processing"},
+	{Director::kDebugFast, "fast", "Fast (no delay) playback"},
+	{Director::kDebugFewFramesOnly, "fewframesonly", "Only run the first 10 frames"},
+	{Director::kDebugImages, "images", "Image drawing"},
+	{Director::kDebugLingoExec, "lingoexec", "Lingo Execution"},
+	{Director::kDebugLoading, "loading", "Loading"},
+	{Director::kDebugNoBytecode, "nobytecode", "Do not execute Lscr bytecode"},
+	{Director::kDebugNoLoop, "noloop", "Do not loop the playback"},
+	{Director::kDebugParse, "parse", "Lingo code parsing"},
+	{Director::kDebugPreprocess, "preprocess", "Lingo preprocessing"},
+	{Director::kDebugScreenshot, "screenshot", "screenshot each frame"},
+	{Director::kDebugSlow, "slow", "Slow playback"},
+	{Director::kDebugText, "text", "Text rendering"},
+	DEBUG_CHANNEL_END
+};
+
 class DirectorMetaEngineDetection : public AdvancedMetaEngineDetection {
 public:
 	DirectorMetaEngineDetection() : AdvancedMetaEngineDetection(Director::gameDescriptions, sizeof(Director::DirectorGameDescription), directorGames) {
@@ -205,6 +227,10 @@ public:
 		return "Macromedia Director (C) 1990-1995 Macromedia";
 	}
 
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
+
 	ADDetectedGame fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const override;
 };
 
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index a38eaab39a..b985c8d055 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -45,25 +45,6 @@ uint32 wmMode = 0;
 DirectorEngine *g_director;
 
 DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
-	DebugMan.addDebugChannel(kDebug32bpp, "32bpp", "Work in 32bpp mode");
-	DebugMan.addDebugChannel(kDebugCompile, "compile", "Lingo Compilation");
-	DebugMan.addDebugChannel(kDebugCompileOnly, "compileonly", "Skip Lingo code execution");
-	DebugMan.addDebugChannel(kDebugDesktop, "desktop", "Show the Classic Mac desktop");
-	DebugMan.addDebugChannel(kDebugEndVideo, "endvideo", "Fake that the end of video is reached setting");
-	DebugMan.addDebugChannel(kDebugEvents, "events", "Event processing");
-	DebugMan.addDebugChannel(kDebugFast, "fast", "Fast (no delay) playback");
-	DebugMan.addDebugChannel(kDebugFewFramesOnly, "fewframesonly", "Only run the first 10 frames");
-	DebugMan.addDebugChannel(kDebugImages, "images", "Image drawing");
-	DebugMan.addDebugChannel(kDebugLingoExec, "lingoexec", "Lingo Execution");
-	DebugMan.addDebugChannel(kDebugLoading, "loading", "Loading");
-	DebugMan.addDebugChannel(kDebugNoBytecode, "nobytecode", "Do not execute Lscr bytecode");
-	DebugMan.addDebugChannel(kDebugNoLoop, "noloop", "Do not loop the playback");
-	DebugMan.addDebugChannel(kDebugParse, "parse", "Lingo code parsing");
-	DebugMan.addDebugChannel(kDebugPreprocess, "preprocess", "Lingo preprocessing");
-	DebugMan.addDebugChannel(kDebugScreenshot, "screenshot", "screenshot each frame");
-	DebugMan.addDebugChannel(kDebugSlow, "slow", "Slow playback");
-	DebugMan.addDebugChannel(kDebugText, "text", "Text rendering");
-
 	g_director = this;
 
 	// Setup mixer


Commit: 24e7c01c1961d03bc69dd0b03a987f6ffe3249e8
    https://github.com/scummvm/scummvm/commit/24e7c01c1961d03bc69dd0b03a987f6ffe3249e8
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
ACCESS: move debug channels to metaEngineDetection

Changed paths:
    engines/access/access.cpp
    engines/access/detection.cpp


diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index 03e6e9d22f..2265c5edee 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -36,10 +36,6 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
 	: _gameDescription(gameDesc), Engine(syst), _randomSource("Access"),
 	  _useItem(_flags[99]), _startup(_flags[170]), _manScaleOff(_flags[172]) {
 	// Set up debug channels
-	DebugMan.addDebugChannel(kDebugPath, "path", "Pathfinding debug level");
-	DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts");
-	DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling");
-	DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling");
 
 	_aboutBox = nullptr;
 	_animation = nullptr;
diff --git a/engines/access/detection.cpp b/engines/access/detection.cpp
index 41b5d7e97b..53cce15170 100644
--- a/engines/access/detection.cpp
+++ b/engines/access/detection.cpp
@@ -23,6 +23,7 @@
 #include "base/plugins.h"
 #include "engines/advancedDetector.h"
 #include "access/detection.h"
+#include "access/access.h"
 
 static const PlainGameDescriptor AccessGames[] = {
 	{"amazon", "Amazon: Guardians of Eden"},
@@ -30,6 +31,14 @@ static const PlainGameDescriptor AccessGames[] = {
 	{0, 0}
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{Access::kDebugPath, "path", "Pathfinding debug level"},
+	{Access::kDebugScripts, "scripts", "Game scripts"},
+	{Access::kDebugGraphics, "graphics", "Graphics handling"},
+	{Access::kDebugSound, "sound", "Sound and Music handling"},
+	DEBUG_CHANNEL_END
+};
+
 #include "access/detection_tables.h"
 
 class AccessMetaEngineDetection : public AdvancedMetaEngineDetection {
@@ -49,6 +58,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Access Engine (C) 1989-1994 Access Software";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 


Commit: 0cfdf7bb6eaec306ac57a64b678ffa7768eb110b
    https://github.com/scummvm/scummvm/commit/0cfdf7bb6eaec306ac57a64b678ffa7768eb110b
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
ADL: move debug channels to metaEngineDetection

Changed paths:
    engines/adl/adl.cpp
    engines/adl/detection.cpp


diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp
index d80ef63708..5ce0c20b6c 100644
--- a/engines/adl/adl.cpp
+++ b/engines/adl/adl.cpp
@@ -102,7 +102,6 @@ AdlEngine::AdlEngine(OSystem *syst, const AdlGameDescription *gd) :
 		_canRestoreNow(false) {
 
 	_random = new Common::RandomSource("adl");
-	DebugMan.addDebugChannel(kDebugChannelScript, "Script", "Trace script execution");
 }
 
 bool AdlEngine::pollEvent(Common::Event &event) const {
diff --git a/engines/adl/detection.cpp b/engines/adl/detection.cpp
index a7858bc73a..6372dfd485 100644
--- a/engines/adl/detection.cpp
+++ b/engines/adl/detection.cpp
@@ -30,6 +30,7 @@
 #include "adl/detection.h"
 #include "adl/disk.h"
 #include "adl/disk_image_helpers.h"
+#include "adl/adl.h"
 
 namespace Adl {
 
@@ -41,6 +42,11 @@ namespace Adl {
 #define GAMEOPTION_NTSC              GUIO_GAMEOPTIONS4
 #define GAMEOPTION_MONO_TEXT         GUIO_GAMEOPTIONS5
 
+static const DebugChannelDef debugFlagList[] = {
+	{Adl::kDebugChannelScript, "Script", "Trace script execution"},
+	DEBUG_CHANNEL_END
+};
+
 static const ADExtraGuiOptionsMap optionsList[] = {
 	{
 		GAMEOPTION_NTSC,
@@ -338,6 +344,10 @@ public:
 		return "Copyright (C) Sierra On-Line";
 	}
 
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
+
 	ADDetectedGames detectGame(const Common::FSNode &parent, const FileMap &allFiles, Common::Language language, Common::Platform platform, const Common::String &extra) const override;
 
 	bool addFileProps(const FileMap &allFiles, Common::String fname, FilePropertiesMap &filePropsMap) const;


Commit: ff8d7f442a5a087bd82f450f8b5ca2bb57e04c35
    https://github.com/scummvm/scummvm/commit/ff8d7f442a5a087bd82f450f8b5ca2bb57e04c35
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
AGI: move debug channels to metaEngineDetection

Changed paths:
    engines/agi/agi.cpp
    engines/agi/detection.cpp


diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index 1ea0af5483..925e5609f9 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -343,17 +343,6 @@ AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBas
 	// Setup mixer
 	syncSoundSettings();
 
-	DebugMan.addDebugChannel(kDebugLevelMain, "Main", "Generic debug level");
-	DebugMan.addDebugChannel(kDebugLevelResources, "Resources", "Resources debugging");
-	DebugMan.addDebugChannel(kDebugLevelSprites, "Sprites", "Sprites debugging");
-	DebugMan.addDebugChannel(kDebugLevelInventory, "Inventory", "Inventory debugging");
-	DebugMan.addDebugChannel(kDebugLevelInput, "Input", "Input events debugging");
-	DebugMan.addDebugChannel(kDebugLevelMenu, "Menu", "Menu debugging");
-	DebugMan.addDebugChannel(kDebugLevelScripts, "Scripts", "Scripts debugging");
-	DebugMan.addDebugChannel(kDebugLevelSound, "Sound", "Sound debugging");
-	DebugMan.addDebugChannel(kDebugLevelText, "Text", "Text output debugging");
-	DebugMan.addDebugChannel(kDebugLevelSavegame, "Savegame", "Saving & restoring game debugging");
-
 	memset(&_debug, 0, sizeof(struct AgiDebug));
 
 	_game.mouseEnabled = true;
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp
index aa2b989031..57efd76ea5 100644
--- a/engines/agi/detection.cpp
+++ b/engines/agi/detection.cpp
@@ -30,6 +30,21 @@
 
 #include "agi/detection.h"
 #include "agi/wagparser.h" // for fallback detection
+#include "agi/agi.h"
+
+static const DebugChannelDef debugFlagList[] = {
+	{Agi::kDebugLevelMain, "Main", "Generic debug level"},
+	{Agi::kDebugLevelResources, "Resources", "Resources debugging"},
+	{Agi::kDebugLevelSprites, "Sprites", "Sprites debugging"},
+	{Agi::kDebugLevelInventory, "Inventory", "Inventory debugging"},
+	{Agi::kDebugLevelInput, "Input", "Input events debugging"},
+	{Agi::kDebugLevelMenu, "Menu", "Menu debugging"},
+	{Agi::kDebugLevelScripts, "Scripts", "Scripts debugging"},
+	{Agi::kDebugLevelSound, "Sound", "Sound debugging"},
+	{Agi::kDebugLevelText, "Text", "Text output debugging"},
+	{Agi::kDebugLevelSavegame, "Savegame", "Saving & restoring game debugging"},
+	DEBUG_CHANNEL_END
+};
 
 static const PlainGameDescriptor agiGames[] = {
 	{"agi", "Sierra AGI game"},
@@ -152,6 +167,10 @@ public:
 		return "Sierra AGI Engine (C) Sierra On-Line Software";
 	}
 
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
+
 	ADDetectedGame fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const override;
 };
 


Commit: 7dcf259006ddf70bbc4bbbd34cd76140201123d0
    https://github.com/scummvm/scummvm/commit/7dcf259006ddf70bbc4bbbd34cd76140201123d0
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
AGOS: move debug channels to metaEngineDetection

Changed paths:
    engines/agos/agos.cpp
    engines/agos/detection.cpp


diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index 794db26fb3..adbf8797b2 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -163,10 +163,6 @@ Common::Error AGOSEngine_Elvira1::init() {
 AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd)
 	: Engine(system), _rnd("agos"), _gameDescription(gd) {
 
-	DebugMan.addDebugChannel(kDebugOpcode, "opcode", "Opcode debug level");
-	DebugMan.addDebugChannel(kDebugVGAOpcode, "vga_opcode", "VGA Opcode debug level");
-	DebugMan.addDebugChannel(kDebugSubroutine, "subroutine", "Subroutine debug level");
-	DebugMan.addDebugChannel(kDebugVGAScript, "vga_script", "VGA Script debug level");
 	//Image dumping command disabled as it doesn't work well
 #if 0
 	DebugMan.addDebugChannel(kDebugImageDump, "image_dump", "Enable dumping of images to files");
diff --git a/engines/agos/detection.cpp b/engines/agos/detection.cpp
index b12156b71b..c539ad4423 100644
--- a/engines/agos/detection.cpp
+++ b/engines/agos/detection.cpp
@@ -32,6 +32,7 @@
 #include "agos/detection.h"
 #include "agos/intern_detection.h"
 #include "agos/obsolete.h" // Obsolete ID table.
+#include "agos/agos.h"
 
 /**
  * Conversion table mapping old obsolete target names to the
@@ -39,6 +40,14 @@
  *
  */
 
+static const DebugChannelDef debugFlagList[] = {
+	{AGOS::kDebugOpcode, "opcode", "Opcode debug level"},
+	{AGOS::kDebugVGAOpcode, "vga_opcode", "VGA Opcode debug level"},
+	{AGOS::kDebugSubroutine, "subroutine", "Subroutine debug level"},
+	{AGOS::kDebugVGAScript, "vga_script", "VGA Script debug level"},
+	DEBUG_CHANNEL_END
+};
+
 static const PlainGameDescriptor agosGames[] = {
 	{"pn", "Personal Nightmare"},
 	{"elvira1", "Elvira - Mistress of the Dark"},
@@ -86,6 +95,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "AGOS (C) Adventure Soft";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(AGOS_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, AgosMetaEngineDetection);


Commit: 29e39e0d5540a2f0fcee7c6c65c74e116113c200
    https://github.com/scummvm/scummvm/commit/29e39e0d5540a2f0fcee7c6c65c74e116113c200
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
AGS: move debug channels to metaEngineDetection

Changed paths:
    engines/ags/ags.cpp
    engines/ags/detection.h


diff --git a/engines/ags/ags.cpp b/engines/ags/ags.cpp
index a9c887b132..aac1b0b6d1 100644
--- a/engines/ags/ags.cpp
+++ b/engines/ags/ags.cpp
@@ -74,11 +74,6 @@ AGSEngine::AGSEngine(OSystem *syst, const AGSGameDescription *gameDesc) : Engine
 		_rawScreen(nullptr), _screen(nullptr), _gfxDriver(nullptr),
 		_globals(nullptr), _forceTextAA(false) {
 	g_vm = this;
-	DebugMan.addDebugChannel(kDebugGraphics, "Graphics", "Graphics debug level");
-	DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
-	DebugMan.addDebugChannel(kDebugFilePath, "FilePath", "File path debug level");
-	DebugMan.addDebugChannel(kDebugScan, "Scan", "Scan for unrecognised games");
-	DebugMan.addDebugChannel(kDebugScript, "Script", "Enable debug script dump");
 
 	_events = new EventsManager();
 	_music = new Music();
diff --git a/engines/ags/detection.h b/engines/ags/detection.h
index 398d83bace..5e1cf85de2 100644
--- a/engines/ags/detection.h
+++ b/engines/ags/detection.h
@@ -24,6 +24,16 @@
 #define AGS_DETECTION_H
 
 #include "engines/advancedDetector.h"
+#include "ags/ags.h"
+
+static const DebugChannelDef debugFlagList[] = {
+	{AGS::kDebugGraphics, "Graphics", "Graphics debug level"},
+	{AGS::kDebugPath, "Path", "Pathfinding debug level"},
+	{AGS::kDebugFilePath, "FilePath", "File path debug level"},
+	{AGS::kDebugScan, "Scan", "Scan for unrecognised games"},
+	{AGS::kDebugScript, "Script", "Enable debug script dump"},
+	DEBUG_CHANNEL_END
+};
 
 namespace AGS {
 
@@ -69,6 +79,10 @@ public:
 		return "AGS Engine (C) Chris Jones";
 	}
 
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
+
 	DetectedGames detectGames(const Common::FSList &fslist) const override;
 
 	ADDetectedGame fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const override;


Commit: 44e2285003af61fd463db9e683477bfbdbd05873
    https://github.com/scummvm/scummvm/commit/44e2285003af61fd463db9e683477bfbdbd05873
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
BASE: add duplicate debug channel check for addDebugChannel

Changed paths:
    common/debug.cpp


diff --git a/common/debug.cpp b/common/debug.cpp
index 9110332751..8d94adfa1f 100644
--- a/common/debug.cpp
+++ b/common/debug.cpp
@@ -55,6 +55,10 @@ bool DebugManager::addDebugChannel(uint32 channel, const String &name, const Str
 	if (gDebugChannels.contains(name))
 		warning("Duplicate declaration of engine debug channel '%s'", name.c_str());
 
+	for (DebugChannelMap::iterator i = gDebugChannels.begin(); i != gDebugChannels.end(); i++)
+		if (i->_value.channel == channel)
+			error("Duplicate engine debug channel id '%d' for flag '%s'", channel, name.c_str());
+
 	gDebugChannels[name] = DebugChannel(channel, name, description);
 
 	return true;
@@ -131,8 +135,9 @@ bool DebugManager::isDebugChannelEnabled(uint32 channel, bool enforce) {
 void DebugManager::debugFlagsRegister(const DebugChannelDef *channels) {
 	if (!channels)
 		return;
-	for (uint i = 0; channels[i].channel != 0; i++)
+	for (uint i = 0; channels[i].channel != 0; i++) {
 		addDebugChannel(channels[i].channel, channels[i].name, channels[i].description);
+	}
 }
 
 void DebugManager::debugFlagsClear() {


Commit: a5bb79d6fdac9a3a9f192904eb5cadfea6d09d3b
    https://github.com/scummvm/scummvm/commit/a5bb79d6fdac9a3a9f192904eb5cadfea6d09d3b
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
BLADERUNNER: move debug channels to metaEngineDetection

Changed paths:
    engines/bladerunner/bladerunner.cpp
    engines/bladerunner/detection.cpp


diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index e7cba880b7..f5c0bf0670 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -100,8 +100,6 @@ BladeRunnerEngine::BladeRunnerEngine(OSystem *syst, const ADGameDescription *des
 	: Engine(syst),
 	  _rnd("bladerunner") {
 
-	DebugMan.addDebugChannel(kDebugScript, "Script", "Debug the scripts");
-
 	_windowIsActive     = true;
 	_gameIsRunning      = true;
 	_gameJustLaunched   = true;
diff --git a/engines/bladerunner/detection.cpp b/engines/bladerunner/detection.cpp
index b912bc81e7..4f0230cf55 100644
--- a/engines/bladerunner/detection.cpp
+++ b/engines/bladerunner/detection.cpp
@@ -33,6 +33,11 @@
 
 #include "engines/advancedDetector.h"
 
+static const DebugChannelDef debugFlagList[] = {
+	{BladeRunner::kDebugScript, "Script", "Debug the scripts"},
+	DEBUG_CHANNEL_END
+};
+
 namespace BladeRunner {
 
 static const PlainGameDescriptor bladeRunnerGames[] = {
@@ -99,6 +104,7 @@ public:
 	const char *getEngineId() const override;
 	const char *getName() const override;
 	const char *getOriginalCopyright() const override;
+	const DebugChannelDef *getDebugChannels() const override;
 };
 
 BladeRunnerMetaEngineDetection::BladeRunnerMetaEngineDetection()
@@ -120,4 +126,8 @@ const char *BladeRunnerMetaEngineDetection::getOriginalCopyright() const {
 	return "Blade Runner (C) 1997 Westwood Studios";
 }
 
+const DebugChannelDef *BladeRunnerMetaEngineDetection::getDebugChannels() const {
+	return debugFlagList;
+}
+
 REGISTER_PLUGIN_STATIC(BLADERUNNER_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, BladeRunnerMetaEngineDetection);


Commit: 3ad0a9573ab454508abe0d60ca5b866ecc16fd54
    https://github.com/scummvm/scummvm/commit/3ad0a9573ab454508abe0d60ca5b866ecc16fd54
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
CGE: move debug channels to metaEngineDetection

Changed paths:
    engines/cge/cge.cpp
    engines/cge/detection.cpp


diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp
index 814d1c2dbc..c831eec97e 100644
--- a/engines/cge/cge.cpp
+++ b/engines/cge/cge.cpp
@@ -45,11 +45,6 @@ const int CGEEngine::_maxSceneArr[5] = {1, 8, 16, 23, 24};
 CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription)
 	: Engine(syst), _gameDescription(gameDescription), _randomSource("cge") {
 
-	// Debug/console setup
-	DebugMan.addDebugChannel(kCGEDebugBitmap, "bitmap", "CGE Bitmap debug channel");
-	DebugMan.addDebugChannel(kCGEDebugFile, "file", "CGE IO debug channel");
-	DebugMan.addDebugChannel(kCGEDebugEngine, "engine", "CGE Engine debug channel");
-
 	_bitmapPalette = nullptr;
 	_pocLight = nullptr;
 	_keyboard = nullptr;
diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp
index af1d1d9676..54f574c041 100644
--- a/engines/cge/detection.cpp
+++ b/engines/cge/detection.cpp
@@ -27,6 +27,14 @@
 #include "common/translation.h"
 
 #include "cge/fileio.h"
+#include "cge/cge.h"
+
+static const DebugChannelDef debugFlagList[] = {
+	{CGE::kCGEDebugBitmap, "bitmap", "CGE Bitmap debug channel"},
+	{CGE::kCGEDebugFile, "file", "CGE IO debug channel"},
+	{CGE::kCGEDebugEngine, "engine", "CGE Engine debug channel"},
+	DEBUG_CHANNEL_END
+};
 
 namespace CGE {
 
@@ -123,6 +131,10 @@ public:
 		return "Soltys (C) 1994-1996 L.K. Avalon";
 	}
 
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
+
 	ADDetectedGame fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const override;
 };
 


Commit: 7a0d9546ce8024561e471921d9b501c30154b0c4
    https://github.com/scummvm/scummvm/commit/7a0d9546ce8024561e471921d9b501c30154b0c4
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
GUI: move kDebugLevelEventRec flag to global flag

Changed paths:
    common/debug.h
    gui/EventRecorder.cpp


diff --git a/common/debug.h b/common/debug.h
index b658af9413..a971bc5ef3 100644
--- a/common/debug.h
+++ b/common/debug.h
@@ -168,6 +168,7 @@ enum GlobalDebugLevels {
 
 static const DebugChannelDef globalDebugChannels[] = {
 	{kDebugGlobalTest, "test", "test global debug flag"},
+	{kDebugLevelEventRec, "EventRec", "Event recorder debug level"},
 	DEBUG_CHANNEL_END
 };
 
diff --git a/gui/EventRecorder.cpp b/gui/EventRecorder.cpp
index a6a3f213a7..ef54acb3db 100644
--- a/gui/EventRecorder.cpp
+++ b/gui/EventRecorder.cpp
@@ -88,8 +88,6 @@ EventRecorder::EventRecorder() {
 	_lastScreenshotTime = 0;
 	_screenshotPeriod = 0;
 	_playbackFile = nullptr;
-
-	DebugMan.addDebugChannel(kDebugLevelEventRec, "EventRec", "Event recorder debug level");
 }
 
 EventRecorder::~EventRecorder() {


Commit: b2f5ee4ab968490de853ea511338f459a5fa2cae
    https://github.com/scummvm/scummvm/commit/b2f5ee4ab968490de853ea511338f459a5fa2cae
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
CGE2: move debug channels to metaEngineDetection

Changed paths:
    engines/cge2/cge2.cpp
    engines/cge2/detection.cpp


diff --git a/engines/cge2/cge2.cpp b/engines/cge2/cge2.cpp
index d988dda28e..48cafe131a 100644
--- a/engines/cge2/cge2.cpp
+++ b/engines/cge2/cge2.cpp
@@ -46,9 +46,6 @@ namespace CGE2 {
 CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription)
 	: Engine(syst), _gameDescription(gameDescription), _randomSource("cge2") {
 
-	// Debug/console setup
-	DebugMan.addDebugChannel(kCGE2DebugOpcode, "opcode", "CGE2 opcode debug channel");
-
 	_resman = nullptr;
 	_vga = nullptr;
 	_midiPlayer = nullptr;
diff --git a/engines/cge2/detection.cpp b/engines/cge2/detection.cpp
index 5e6d03ef43..b369e0d0c0 100644
--- a/engines/cge2/detection.cpp
+++ b/engines/cge2/detection.cpp
@@ -28,6 +28,12 @@
 #include "engines/advancedDetector.h"
 #include "common/translation.h"
 #include "cge2/fileio.h"
+#include "cge2/cge2.h"
+
+static const DebugChannelDef debugFlagList[] = {
+	{CGE2::kCGE2DebugOpcode, "opcode", "CGE2 opcode debug channel"},
+	DEBUG_CHANNEL_END
+};
 
 namespace CGE2 {
 
@@ -115,6 +121,10 @@ public:
 		return "Sfinx (C) 1994-1997 Janusz B. Wisniewski and L.K. Avalon";
 	}
 
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
+
 	ADDetectedGame fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const override;
 };
 


Commit: c80dd052d76cada7cc40bd828fd70c19c6c66c5d
    https://github.com/scummvm/scummvm/commit/c80dd052d76cada7cc40bd828fd70c19c6c66c5d
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
CINE: move debug channels to metaEngineDetection

Changed paths:
    engines/cine/cine.cpp
    engines/cine/detection.cpp


diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp
index 9c3a4cfbae..d9dbfd6927 100644
--- a/engines/cine/cine.cpp
+++ b/engines/cine/cine.cpp
@@ -49,10 +49,6 @@ CineEngine::CineEngine(OSystem *syst, const CINEGameDescription *gameDesc)
 	: Engine(syst),
 	_gameDescription(gameDesc),
 	_rnd("cine") {
-	DebugMan.addDebugChannel(kCineDebugScript,    "Script",    "Script debug level");
-	DebugMan.addDebugChannel(kCineDebugPart,      "Part",      "Part debug level");
-	DebugMan.addDebugChannel(kCineDebugSound,     "Sound",     "Sound debug level");
-	DebugMan.addDebugChannel(kCineDebugCollision, "Collision", "Collision debug level");
 
 	// Setup mixer
 	syncSoundSettings();
diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp
index 561cba8e6c..4f80daf7b8 100644
--- a/engines/cine/detection.cpp
+++ b/engines/cine/detection.cpp
@@ -27,6 +27,7 @@
 #include "common/translation.h"
 
 #include "cine/detection.h"
+#include "cine/cine.h"
 
 static const PlainGameDescriptor cineGames[] = {
 	{"fw", "Future Wars"},
@@ -36,6 +37,14 @@ static const PlainGameDescriptor cineGames[] = {
 
 #include "cine/detection_tables.h"
 
+static const DebugChannelDef debugFlagList[] = {
+	{Cine::kCineDebugScript,    "Script",    "Script debug level"},
+	{Cine::kCineDebugPart,      "Part",      "Part debug level"},
+	{Cine::kCineDebugSound,     "Sound",     "Sound debug level"},
+	{Cine::kCineDebugCollision, "Collision", "Collision debug level"},
+	DEBUG_CHANNEL_END
+};
+
 static const ADExtraGuiOptionsMap optionsList[] = {
 	{
 		GAMEOPTION_ORIGINAL_SAVELOAD,
@@ -76,6 +85,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Cinematique evo 1 (C) Delphine Software";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(CINE_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, CineMetaEngineDetection);


Commit: 5daceeac83c2beb1c1a8dd2054eba54bfd1f3250
    https://github.com/scummvm/scummvm/commit/5daceeac83c2beb1c1a8dd2054eba54bfd1f3250
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
CRUISE: move debug channels to metaEngineDetection

Changed paths:
    engines/cruise/cruise.cpp
    engines/cruise/detection.cpp


diff --git a/engines/cruise/cruise.cpp b/engines/cruise/cruise.cpp
index 90552b2662..5e9dc2dde4 100644
--- a/engines/cruise/cruise.cpp
+++ b/engines/cruise/cruise.cpp
@@ -43,9 +43,6 @@ CruiseEngine *_vm;
 CruiseEngine::CruiseEngine(OSystem * syst, const CRUISEGameDescription *gameDesc)
 	: Engine(syst), _gameDescription(gameDesc), _rnd("cruise") {
 
-	DebugMan.addDebugChannel(kCruiseDebugScript, "scripts", "Scripts debug level");
-	DebugMan.addDebugChannel(kCruiseDebugSound, "sound", "Sound debug level");
-
 	_vm = this;
 	setDebugger(new Debugger());
 	_sound = new PCSound(_mixer, this);
diff --git a/engines/cruise/detection.cpp b/engines/cruise/detection.cpp
index bf76c0dc9d..862503e1ab 100644
--- a/engines/cruise/detection.cpp
+++ b/engines/cruise/detection.cpp
@@ -24,12 +24,19 @@
 #include "engines/advancedDetector.h"
 
 #include "cruise/detection.h"
+#include "cruise/cruise.h"
 
 static const PlainGameDescriptor cruiseGames[] = {
 	{"cruise", "Cruise for a Corpse"},
 	{0, 0}
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{Cruise::kCruiseDebugScript, "scripts", "Scripts debug level"},
+	{Cruise::kCruiseDebugSound, "sound", "Sound debug level"},
+	DEBUG_CHANNEL_END
+};
+
 namespace Cruise {
 
 static const CRUISEGameDescription gameDescriptions[] = {
@@ -187,6 +194,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Cinematique evo 2 (C) Delphine Software";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(CRUISE_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, CruiseMetaEngineDetection);


Commit: c24f589c8f02e4beb23b47d95b2d5ba8e5102f93
    https://github.com/scummvm/scummvm/commit/c24f589c8f02e4beb23b47d95b2d5ba8e5102f93
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
CRYOMNI3D: move debug channels to metaEngineDetection

Changed paths:
    engines/cryomni3d/cryomni3d.cpp
    engines/cryomni3d/detection.cpp


diff --git a/engines/cryomni3d/cryomni3d.cpp b/engines/cryomni3d/cryomni3d.cpp
index 0d7a173d2e..a268935a91 100644
--- a/engines/cryomni3d/cryomni3d.cpp
+++ b/engines/cryomni3d/cryomni3d.cpp
@@ -52,10 +52,6 @@ CryOmni3DEngine::CryOmni3DEngine(OSystem *syst,
 	syncSoundSettings();
 
 	unlockPalette();
-
-	DebugMan.addDebugChannel(kDebugFile, "File", "Track File Accesses");
-	DebugMan.addDebugChannel(kDebugVariable, "Variable", "Track Variable Accesses");
-	DebugMan.addDebugChannel(kDebugSaveLoad, "SaveLoad", "Track Save/Load Function");
 }
 
 CryOmni3DEngine::~CryOmni3DEngine() {
diff --git a/engines/cryomni3d/detection.cpp b/engines/cryomni3d/detection.cpp
index a55914c410..477484609a 100644
--- a/engines/cryomni3d/detection.cpp
+++ b/engines/cryomni3d/detection.cpp
@@ -28,6 +28,7 @@
 #include "common/md5.h"
 
 #include "cryomni3d/detection.h"
+#include "cryomni3d/cryomni3d.h"
 
 namespace CryOmni3D {
 
@@ -36,6 +37,13 @@ static const PlainGameDescriptor cryomni3DGames[] = {
 	{0, 0}
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{CryOmni3D::kDebugFile, "File", "Track File Accesses"},
+	{CryOmni3D::kDebugVariable, "Variable", "Track Variable Accesses"},
+	{CryOmni3D::kDebugSaveLoad, "SaveLoad", "Track Save/Load Function"},
+	DEBUG_CHANNEL_END
+};
+
 } // End of namespace CryOmni3D
 
 #include "cryomni3d/detection_tables.h"
@@ -70,6 +78,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Cryo game Engine (C) 1997-2002 Cryo Interactive";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 } // End of Namespace CryOmni3D


Commit: 467c6594a28b6a83b511d7e5e835f08277d43f61
    https://github.com/scummvm/scummvm/commit/467c6594a28b6a83b511d7e5e835f08277d43f61
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
DRACI: move debug channels to metaEngineDetection

Changed paths:
    engines/draci/detection.cpp
    engines/draci/draci.cpp


diff --git a/engines/draci/detection.cpp b/engines/draci/detection.cpp
index 0f787a0748..eb4150363e 100644
--- a/engines/draci/detection.cpp
+++ b/engines/draci/detection.cpp
@@ -25,6 +25,19 @@
 #include "engines/advancedDetector.h"
 #include "engines/metaengine.h"
 
+#include "draci/draci.h"
+
+static const DebugChannelDef debugFlagList[] = {
+	{Draci::kDraciGeneralDebugLevel, "general", "Draci general debug info"},
+	{Draci::kDraciBytecodeDebugLevel, "bytecode", "GPL bytecode instructions"},
+	{Draci::kDraciArchiverDebugLevel, "archiver", "BAR archiver debug info"},
+	{Draci::kDraciLogicDebugLevel, "logic", "Game logic debug info"},
+	{Draci::kDraciAnimationDebugLevel, "animation", "Animation debug info"},
+	{Draci::kDraciSoundDebugLevel, "sound", "Sound debug info"},
+	{Draci::kDraciWalkingDebugLevel, "walking", "Walking debug info"},
+	DEBUG_CHANNEL_END
+};
+
 static const PlainGameDescriptor draciGames[] = {
 	{ "draci", "Draci Historie" },
 	{ 0, 0 }
@@ -94,6 +107,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Draci Historie (C) 1995 NoSense";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(DRACI_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, DraciMetaEngineDetection);
diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp
index 03ecec72a7..a2f16dc419 100644
--- a/engines/draci/draci.cpp
+++ b/engines/draci/draci.cpp
@@ -71,13 +71,6 @@ const uint kDubbingFrequency = 22050;
 
 DraciEngine::DraciEngine(OSystem *syst, const ADGameDescription *gameDesc)
  : Engine(syst), _rnd("draci") {
-	DebugMan.addDebugChannel(kDraciGeneralDebugLevel, "general", "Draci general debug info");
-	DebugMan.addDebugChannel(kDraciBytecodeDebugLevel, "bytecode", "GPL bytecode instructions");
-	DebugMan.addDebugChannel(kDraciArchiverDebugLevel, "archiver", "BAR archiver debug info");
-	DebugMan.addDebugChannel(kDraciLogicDebugLevel, "logic", "Game logic debug info");
-	DebugMan.addDebugChannel(kDraciAnimationDebugLevel, "animation", "Animation debug info");
-	DebugMan.addDebugChannel(kDraciSoundDebugLevel, "sound", "Sound debug info");
-	DebugMan.addDebugChannel(kDraciWalkingDebugLevel, "walking", "Walking debug info");
 
 	setDebugger(new DraciConsole(this));
 


Commit: d987e1a6b12fac0c89a32a7e6761561dd5262d58
    https://github.com/scummvm/scummvm/commit/d987e1a6b12fac0c89a32a7e6761561dd5262d58
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
DREAMWEB: move debug channels to metaEngineDetection

Changed paths:
    engines/dreamweb/detection.cpp
    engines/dreamweb/dreamweb.cpp


diff --git a/engines/dreamweb/detection.cpp b/engines/dreamweb/detection.cpp
index 6669e37d1a..a208f3fa47 100644
--- a/engines/dreamweb/detection.cpp
+++ b/engines/dreamweb/detection.cpp
@@ -29,12 +29,19 @@
 #include "engines/advancedDetector.h"
 
 #include "dreamweb/detection.h"
+#include "dreamweb/dreamweb.h"
 
 static const PlainGameDescriptor dreamWebGames[] = {
 	{ "dreamweb", "DreamWeb" },
 	{ 0, 0 }
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{DreamWeb::kDebugAnimation, "Animation", "Animation Debug Flag"},
+	{DreamWeb::kDebugSaveLoad, "SaveLoad", "Track Save/Load Function"},
+	DEBUG_CHANNEL_END
+};
+
 #include "dreamweb/detection_tables.h"
 
 static const ADExtraGuiOptionsMap gameGuiOptions[] = {
@@ -81,6 +88,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "DreamWeb (C) Creative Reality";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(DREAMWEB_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, DreamWebMetaEngineDetection);
diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp
index 1f80b13101..c2cc74314b 100644
--- a/engines/dreamweb/dreamweb.cpp
+++ b/engines/dreamweb/dreamweb.cpp
@@ -46,9 +46,6 @@ DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gam
 	_roomDesc(kNumRoomTexts), _freeDesc(kNumFreeTexts),
 	_personText(kNumPersonTexts) {
 
-	DebugMan.addDebugChannel(kDebugAnimation, "Animation", "Animation Debug Flag");
-	DebugMan.addDebugChannel(kDebugSaveLoad, "SaveLoad", "Track Save/Load Function");
-
 	_vSyncPrevTick = 0;
 	_sound = 0;
 	_speed = 1;


Commit: ad4f3672928079cbee689d98c863811fd89dc541
    https://github.com/scummvm/scummvm/commit/ad4f3672928079cbee689d98c863811fd89dc541
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
GLK: move debug channels to metaEngineDetection

Changed paths:
    engines/glk/detection.cpp
    engines/glk/detection.h
    engines/glk/glk.cpp


diff --git a/engines/glk/detection.cpp b/engines/glk/detection.cpp
index af681454c2..ffc9e2d016 100644
--- a/engines/glk/detection.cpp
+++ b/engines/glk/detection.cpp
@@ -30,6 +30,7 @@
 
 #include "glk/detection.h"
 #include "glk/game_description.h"
+#include "glk/glk.h"
 
 #include "glk/adrift/detection.h"
 #include "glk/advsys/detection.h"
@@ -62,6 +63,15 @@
 #include "common/file.h"
 #include "common/translation.h"
 
+static const DebugChannelDef debugFlagList[] = {
+	{Glk::kDebugCore, "core", "Core engine debug level"},
+	{Glk::kDebugScripts, "scripts", "Game scripts"},
+	{Glk::kDebugGraphics, "graphics", "Graphics handling"},
+	{Glk::kDebugSound, "sound", "Sound and Music handling"},
+	{Glk::kDebugSpeech, "speech", "Text to Speech handling"},
+	DEBUG_CHANNEL_END
+};
+
 namespace Glk {
 
 Common::String GlkDetectedGame::getGlkGUIOptions() {
@@ -142,6 +152,10 @@ PlainGameList GlkMetaEngineDetection::getSupportedGames() const {
 	Glk::GameDescriptor gd##SUBENGINE = Glk::SUBENGINE::SUBENGINE##MetaEngine::findGame(gameId); \
 	if (gd##SUBENGINE._description) return gd##SUBENGINE
 
+const DebugChannelDef *GlkMetaEngineDetection::getDebugChannels() const {
+	return debugFlagList;
+}
+
 PlainGameDescriptor GlkMetaEngineDetection::findGame(const char *gameId) const {
 	FIND_GAME(Adrift);
 	FIND_GAME(AdvSys);
diff --git a/engines/glk/detection.h b/engines/glk/detection.h
index 8bd415ed27..e4df7fcf26 100644
--- a/engines/glk/detection.h
+++ b/engines/glk/detection.h
@@ -45,6 +45,8 @@ public:
 		return "Infocom games (C) Infocom\nScott Adams games (C) Scott Adams";
 	}
 
+	const DebugChannelDef *getDebugChannels() const override;
+
 	/**
 	 * Returns a list of games supported by this engine.
 	 */
diff --git a/engines/glk/glk.cpp b/engines/glk/glk.cpp
index a3505443f4..ee04d331a0 100644
--- a/engines/glk/glk.cpp
+++ b/engines/glk/glk.cpp
@@ -53,12 +53,6 @@ GlkEngine::GlkEngine(OSystem *syst, const GlkGameDescription &gameDesc) :
 		_copySelect(false), _terminated(false), _pcSpeaker(nullptr), _loadSaveSlot(-1),
 		gli_register_obj(nullptr), gli_unregister_obj(nullptr), gli_register_arr(nullptr),
 		gli_unregister_arr(nullptr) {
-	// Set up debug channels
-	DebugMan.addDebugChannel(kDebugCore, "core", "Core engine debug level");
-	DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts");
-	DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling");
-	DebugMan.addDebugChannel(kDebugSound, "sound", "Sound and Music handling");
-	DebugMan.addDebugChannel(kDebugSpeech, "speech", "Text to Speech handling");
 
 	g_vm = this;
 }


Commit: e42e1bcb251bb13dfc8240c276a16ee38f768a8d
    https://github.com/scummvm/scummvm/commit/e42e1bcb251bb13dfc8240c276a16ee38f768a8d
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
GNAP: move debug channels to metaEngineDetection

Changed paths:
    engines/gnap/detection.cpp
    engines/gnap/gnap.cpp


diff --git a/engines/gnap/detection.cpp b/engines/gnap/detection.cpp
index 4112876f33..ec71106161 100644
--- a/engines/gnap/detection.cpp
+++ b/engines/gnap/detection.cpp
@@ -34,6 +34,11 @@ static const PlainGameDescriptor gnapGames[] = {
 	{ 0, 0 }
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{Gnap::kDebugBasic, "basic", "Basic debug level"},
+	DEBUG_CHANNEL_END
+};
+
 namespace Gnap {
 
 static const ADGameDescription gameDescriptions[] = {
@@ -90,6 +95,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Gnap (C) Artech Digital Entertainment 1997";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(GNAP_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, GnapMetaEngineDetection);
diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp
index e75be5ddaf..66c1e49085 100644
--- a/engines/gnap/gnap.cpp
+++ b/engines/gnap/gnap.cpp
@@ -94,8 +94,6 @@ static const char *kSceneNames[] = {
 GnapEngine::GnapEngine(OSystem *syst, const ADGameDescription *gd) :
 	Engine(syst), _gameDescription(gd) {
 
-	DebugMan.addDebugChannel(kDebugBasic, "basic", "Basic debug level");
-
 	_random = new Common::RandomSource("gnap");
 
 	Engine::syncSoundSettings();


Commit: 3f74a19d810ffe3f0f02a7f26c4c0fa179aa9b51
    https://github.com/scummvm/scummvm/commit/3f74a19d810ffe3f0f02a7f26c4c0fa179aa9b51
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
GOB: move debug channels to metaEngineDetection

Changed paths:
    engines/gob/detection/detection.cpp
    engines/gob/gob.cpp


diff --git a/engines/gob/detection/detection.cpp b/engines/gob/detection/detection.cpp
index c74cce591e..0c8b422fd3 100644
--- a/engines/gob/detection/detection.cpp
+++ b/engines/gob/detection/detection.cpp
@@ -26,6 +26,23 @@
 #include "gob/dataio.h"
 #include "gob/detection/detection.h"
 #include "gob/detection/tables.h"
+#include "gob/gob.h"
+
+static const DebugChannelDef debugFlagList[] = {
+	{Gob::kDebugFuncOp, "FuncOpcodes", "Script FuncOpcodes debug level"},
+	{Gob::kDebugDrawOp, "DrawOpcodes", "Script DrawOpcodes debug level"},
+	{Gob::kDebugGobOp, "GoblinOpcodes", "Script GoblinOpcodes debug level"},
+	{Gob::kDebugSound, "Sound", "Sound output debug level"},
+	{Gob::kDebugExpression, "Expression", "Expression parser debug level"},
+	{Gob::kDebugGameFlow, "Gameflow", "Gameflow debug level"},
+	{Gob::kDebugFileIO, "FileIO", "File Input/Output debug level"},
+	{Gob::kDebugSaveLoad, "SaveLoad", "Saving/Loading debug level"},
+	{Gob::kDebugGraphics, "Graphics", "Graphics debug level"},
+	{Gob::kDebugVideo, "Video", "IMD/VMD video debug level"},
+	{Gob::kDebugHotspots, "Hotspots", "Hotspots debug level"},
+	{Gob::kDebugDemo, "Demo", "Demo script debug level"},
+	DEBUG_CHANNEL_END
+};
 
 class GobMetaEngineDetection : public AdvancedMetaEngineDetection {
 public:
@@ -38,6 +55,10 @@ public:
 	const char *getName() const override;
 	const char *getOriginalCopyright() const override;
 
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
+
 	ADDetectedGame fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const override;
 
 private:
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp
index fc2426c173..b13842f463 100644
--- a/engines/gob/gob.cpp
+++ b/engines/gob/gob.cpp
@@ -116,19 +116,6 @@ void PauseDialog::handleKeyDown(Common::KeyState state) {
 
 
 GobEngine::GobEngine(OSystem *syst) : Engine(syst), _rnd("gob") {
-	DebugMan.addDebugChannel(kDebugFuncOp, "FuncOpcodes", "Script FuncOpcodes debug level");
-	DebugMan.addDebugChannel(kDebugDrawOp, "DrawOpcodes", "Script DrawOpcodes debug level");
-	DebugMan.addDebugChannel(kDebugGobOp, "GoblinOpcodes", "Script GoblinOpcodes debug level");
-	DebugMan.addDebugChannel(kDebugSound, "Sound", "Sound output debug level");
-	DebugMan.addDebugChannel(kDebugExpression, "Expression", "Expression parser debug level");
-	DebugMan.addDebugChannel(kDebugGameFlow, "Gameflow", "Gameflow debug level");
-	DebugMan.addDebugChannel(kDebugFileIO, "FileIO", "File Input/Output debug level");
-	DebugMan.addDebugChannel(kDebugSaveLoad, "SaveLoad", "Saving/Loading debug level");
-	DebugMan.addDebugChannel(kDebugGraphics, "Graphics", "Graphics debug level");
-	DebugMan.addDebugChannel(kDebugVideo, "Video", "IMD/VMD video debug level");
-	DebugMan.addDebugChannel(kDebugHotspots, "Hotspots", "Hotspots debug level");
-	DebugMan.addDebugChannel(kDebugDemo, "Demo", "Demo script debug level");
-
 	_sound     = 0; _mult     = 0; _game    = 0;
 	_global    = 0; _dataIO   = 0; _goblin  = 0;
 	_vidPlayer = 0; _init     = 0; _inter   = 0;


Commit: 2bb220f54532965ee9af202f2adc865043a716ce
    https://github.com/scummvm/scummvm/commit/2bb220f54532965ee9af202f2adc865043a716ce
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
GROOVIE: move debug channels to metaEngineDetection

Changed paths:
    engines/groovie/detection.cpp
    engines/groovie/groovie.cpp


diff --git a/engines/groovie/detection.cpp b/engines/groovie/detection.cpp
index ea6b2ad5f5..24a3eca514 100644
--- a/engines/groovie/detection.cpp
+++ b/engines/groovie/detection.cpp
@@ -25,11 +25,26 @@
 
 #include "engines/advancedDetector.h"
 #include "groovie/detection.h"
+#include "groovie/groovie.h"
 
 namespace Groovie {
 
 #define GAMEOPTION_T7G_FAST_MOVIE_SPEED  GUIO_GAMEOPTIONS1
 
+static const DebugChannelDef debugFlagList[] = {
+	{Groovie::kDebugVideo, "Video", "Debug video and audio playback"},
+	{Groovie::kDebugResource, "Resource", "Debug resource management"},
+	{Groovie::kDebugScript, "Script", "Debug the scripts"},
+	{Groovie::kDebugUnknown, "Unknown", "Report values of unknown data in files"},
+	{Groovie::kDebugHotspots, "Hotspots", "Show the hotspots"},
+	{Groovie::kDebugCursor, "Cursor", "Debug cursor decompression / switching"},
+	{Groovie::kDebugMIDI, "MIDI", "Debug MIDI / XMIDI files"},
+	{Groovie::kDebugScriptvars, "Scriptvars", "Print out any change to script variables"},
+	{Groovie::kDebugCell, "Cell", "Debug the cell game (in the microscope)"},
+	{Groovie::kDebugFast, "Fast", "Play videos quickly, with no sound (unstable)"},
+	DEBUG_CHANNEL_END
+};
+
 static const PlainGameDescriptor groovieGames[] = {
 	// Games
 	{"t7g", "The 7th Guest"},
@@ -334,6 +349,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Groovie Engine (C) 1990-1996 Trilobyte";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 } // End of namespace Groovie
diff --git a/engines/groovie/groovie.cpp b/engines/groovie/groovie.cpp
index e22fe1019e..11f0a452cb 100644
--- a/engines/groovie/groovie.cpp
+++ b/engines/groovie/groovie.cpp
@@ -54,18 +54,6 @@ GroovieEngine::GroovieEngine(OSystem *syst, const GroovieGameDescription *gd) :
 	_graphicsMan(NULL), _macResFork(NULL), _waitingForInput(false), _font(NULL),
 	_spookyMode(false) {
 
-	// Initialize the custom debug levels
-	DebugMan.addDebugChannel(kDebugVideo, "Video", "Debug video and audio playback");
-	DebugMan.addDebugChannel(kDebugResource, "Resource", "Debug resource management");
-	DebugMan.addDebugChannel(kDebugScript, "Script", "Debug the scripts");
-	DebugMan.addDebugChannel(kDebugUnknown, "Unknown", "Report values of unknown data in files");
-	DebugMan.addDebugChannel(kDebugHotspots, "Hotspots", "Show the hotspots");
-	DebugMan.addDebugChannel(kDebugCursor, "Cursor", "Debug cursor decompression / switching");
-	DebugMan.addDebugChannel(kDebugMIDI, "MIDI", "Debug MIDI / XMIDI files");
-	DebugMan.addDebugChannel(kDebugScriptvars, "Scriptvars", "Print out any change to script variables");
-	DebugMan.addDebugChannel(kDebugCell, "Cell", "Debug the cell game (in the microscope)");
-	DebugMan.addDebugChannel(kDebugFast, "Fast", "Play videos quickly, with no sound (unstable)");
-
 	// Adding the default directories
 	const Common::FSNode gameDataDir(ConfMan.get("path"));
 	SearchMan.addSubDirectoryMatching(gameDataDir, "groovie");


Commit: 9d585ee994608d1475b478e61005d8b2e901050b
    https://github.com/scummvm/scummvm/commit/9d585ee994608d1475b478e61005d8b2e901050b
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
HADESCH: move debug channels to metaEngineDetection

Changed paths:
    engines/hadesch/detection.cpp
    engines/hadesch/hadesch.cpp


diff --git a/engines/hadesch/detection.cpp b/engines/hadesch/detection.cpp
index 9cd399393b..2788f3d81b 100644
--- a/engines/hadesch/detection.cpp
+++ b/engines/hadesch/detection.cpp
@@ -30,6 +30,14 @@
 
 #include "detection_tables.h"
 
+static const DebugChannelDef debugFlagList[] = {
+	{Hadesch::kHadeschDebugGeneral, "general", "General issues"},
+	{Hadesch::kHadeschDebugMessagingSystem, "resources", "Resources"},
+	{Hadesch::kHadeschDebugMessagingSystem, "message_system", "Engine message system"},
+	{Hadesch::kHadeschDebugDialogs, "dialogs", "Dialogs"},
+	DEBUG_CHANNEL_END
+};
+
 namespace Hadesch {
 static const PlainGameDescriptor hadeschGames[] = {
 	{"hadesch", "Hades Challenge"},
@@ -78,6 +86,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Hades Challenge (C) Disney's Interactive";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(HADESCH_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, HadeschMetaEngineDetection);
diff --git a/engines/hadesch/hadesch.cpp b/engines/hadesch/hadesch.cpp
index ef73187432..92ab78a68a 100644
--- a/engines/hadesch/hadesch.cpp
+++ b/engines/hadesch/hadesch.cpp
@@ -74,11 +74,6 @@ static const uint32 cursorids[] = {
 HadeschEngine::HadeschEngine(OSystem *system, const ADGameDescription *desc)
 	: Engine(system), _desc(desc), _rnd("hadesch"), _cheatsEnabled(false) {
 
-	DebugMan.addDebugChannel(kHadeschDebugGeneral, "general", "General issues");
-	DebugMan.addDebugChannel(kHadeschDebugMessagingSystem, "resources", "Resources");
-	DebugMan.addDebugChannel(kHadeschDebugMessagingSystem, "message_system", "Engine message system");
-	DebugMan.addDebugChannel(kHadeschDebugDialogs, "dialogs", "Dialogs");
-
 	g_vm = this;
 	_sceneStartTime = _system->getMillis();
 	_currentTime = 0;


Commit: cd6a9db1162de6a99204f6ebc8f10d2431e64454
    https://github.com/scummvm/scummvm/commit/cd6a9db1162de6a99204f6ebc8f10d2431e64454
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
HOPKINS: move debug channels to metaEngineDetection

Changed paths:
    engines/hopkins/detection.cpp
    engines/hopkins/hopkins.cpp


diff --git a/engines/hopkins/detection.cpp b/engines/hopkins/detection.cpp
index ffaa5b0d38..62526500f2 100644
--- a/engines/hopkins/detection.cpp
+++ b/engines/hopkins/detection.cpp
@@ -25,6 +25,13 @@
 #include "common/translation.h"
 
 #include "hopkins/detection.h"
+#include "hopkins/hopkins.h"
+
+static const DebugChannelDef debugFlagList[] = {
+	{Hopkins::kDebugPath, "Path", "Pathfinding debug level"},
+	{Hopkins::kDebugGraphics, "Graphics", "Graphics debug level"},
+	DEBUG_CHANNEL_END
+};
 
 static const PlainGameDescriptor hopkinsGames[] = {
 	{"hopkins", "Hopkins FBI"},
@@ -81,6 +88,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Hopkins FBI (C) 1997-2003 MP Entertainment";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 
diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp
index ec04bcbb6c..0240a7659f 100644
--- a/engines/hopkins/hopkins.cpp
+++ b/engines/hopkins/hopkins.cpp
@@ -37,8 +37,6 @@ namespace Hopkins {
 
 HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDesc) : Engine(syst),
 		_gameDescription(gameDesc), _randomSource("Hopkins") {
-	DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
-	DebugMan.addDebugChannel(kDebugGraphics, "Graphics", "Graphics debug level");
 	_animMan = new AnimationManager(this);
 	_computer = new ComputerManager(this);
 	_dialog = new DialogsManager(this);


Commit: 58d4dc84c1bbb06e4841ad46bbd31c13e69ad02b
    https://github.com/scummvm/scummvm/commit/58d4dc84c1bbb06e4841ad46bbd31c13e69ad02b
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
HUGO: move debug channels to metaEngineDetection

Changed paths:
    engines/hugo/detection.cpp
    engines/hugo/hugo.cpp


diff --git a/engines/hugo/detection.cpp b/engines/hugo/detection.cpp
index fddc3636d0..f335b07cc0 100644
--- a/engines/hugo/detection.cpp
+++ b/engines/hugo/detection.cpp
@@ -24,6 +24,21 @@
 #include "engines/advancedDetector.h"
 
 #include "hugo/detection.h"
+#include "hugo/hugo.h"
+
+static const DebugChannelDef debugFlagList[] = {
+	{Hugo::kDebugSchedule, "Schedule", "Script Schedule debug level"},
+	{Hugo::kDebugEngine, "Engine", "Engine debug level"},
+	{Hugo::kDebugDisplay, "Display", "Display debug level"},
+	{Hugo::kDebugMouse, "Mouse", "Mouse debug level"},
+	{Hugo::kDebugParser, "Parser", "Parser debug level"},
+	{Hugo::kDebugFile, "File", "File IO debug level"},
+	{Hugo::kDebugRoute, "Route", "Route debug level"},
+	{Hugo::kDebugInventory, "Inventory", "Inventory debug level"},
+	{Hugo::kDebugObject, "Object", "Object debug level"},
+	{Hugo::kDebugMusic, "Music", "Music debug level"},
+	DEBUG_CHANNEL_END
+};
 
 namespace Hugo {
 
@@ -129,6 +144,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Hugo Engine (C) 1989-1997 David P. Gray";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 } // End of namespace Hugo
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp
index 4fb567d18e..3e82c34995 100644
--- a/engines/hugo/hugo.cpp
+++ b/engines/hugo/hugo.cpp
@@ -57,16 +57,6 @@ HugoEngine::HugoEngine(OSystem *syst, const HugoGameDescription *gd) : Engine(sy
 	_screenStates(nullptr), _numStates(0), _score(0), _maxscore(0), _lastTime(0), _curTime(0), _episode(nullptr)
 {
 	_system = syst;
-	DebugMan.addDebugChannel(kDebugSchedule, "Schedule", "Script Schedule debug level");
-	DebugMan.addDebugChannel(kDebugEngine, "Engine", "Engine debug level");
-	DebugMan.addDebugChannel(kDebugDisplay, "Display", "Display debug level");
-	DebugMan.addDebugChannel(kDebugMouse, "Mouse", "Mouse debug level");
-	DebugMan.addDebugChannel(kDebugParser, "Parser", "Parser debug level");
-	DebugMan.addDebugChannel(kDebugFile, "File", "File IO debug level");
-	DebugMan.addDebugChannel(kDebugRoute, "Route", "Route debug level");
-	DebugMan.addDebugChannel(kDebugInventory, "Inventory", "Inventory debug level");
-	DebugMan.addDebugChannel(kDebugObject, "Object", "Object debug level");
-	DebugMan.addDebugChannel(kDebugMusic, "Music", "Music debug level");
 
 	setDebugger(new HugoConsole(this));
 	_rnd = 0;


Commit: 957189213d544c9982957fec6e5d02d371695a25
    https://github.com/scummvm/scummvm/commit/957189213d544c9982957fec6e5d02d371695a25
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
KINGDOM: move debug channels to metaEngineDetection

Changed paths:
    engines/kingdom/detection.cpp
    engines/kingdom/kingdom.cpp


diff --git a/engines/kingdom/detection.cpp b/engines/kingdom/detection.cpp
index 24bddfd5ba..afa749d233 100644
--- a/engines/kingdom/detection.cpp
+++ b/engines/kingdom/detection.cpp
@@ -25,6 +25,13 @@
 #include "engines/advancedDetector.h"
 #include "common/file.h"
 
+#include "kingdom/kingdom.h"
+
+static const DebugChannelDef debugFlagList[] = {
+	{Kingdom::kDebugGeneral, "general", "General debug level"},
+	DEBUG_CHANNEL_END
+};
+
 static const PlainGameDescriptor kingdomGames[] = {
 	{"kingdom", "Kingdom: The Far Reaches"},
 	{0, 0}
@@ -88,6 +95,10 @@ public:
 	virtual const char *getOriginalCopyright() const override {
 		return "Kingdom: The far Reaches (C) 1995 Virtual Image Productions";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(KINGDOM_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, KingdomMetaEngineDetection);
diff --git a/engines/kingdom/kingdom.cpp b/engines/kingdom/kingdom.cpp
index 703bea7363..f8909ce4c9 100644
--- a/engines/kingdom/kingdom.cpp
+++ b/engines/kingdom/kingdom.cpp
@@ -53,8 +53,6 @@ KingdomGame::KingdomGame(OSystem *syst, const ADGameDescription *gameDesc) : Eng
 	_console = nullptr;
 	_rnd = new Common::RandomSource("kingdom");
 
-	DebugMan.addDebugChannel(kDebugGeneral, "general", "General debug level");
-
 	_logic = nullptr;
 
 	_asPtr = nullptr;


Commit: 034be8cc6d205d22dc48f05bf7c9fd044e9d4e76
    https://github.com/scummvm/scummvm/commit/034be8cc6d205d22dc48f05bf7c9fd044e9d4e76
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
KYRA: move debug channels to metaEngineDetection

Changed paths:
    engines/kyra/detection.cpp
    engines/kyra/engine/kyra_v1.cpp


diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp
index c0a8b8a0c2..6b3e3a008a 100644
--- a/engines/kyra/detection.cpp
+++ b/engines/kyra/detection.cpp
@@ -26,9 +26,25 @@
 
 #include "kyra/detection.h"
 #include "kyra/detection_tables.h"
+#include "kyra/kyra_v1.h"
 
 namespace {
 
+static const DebugChannelDef debugFlagList[] = {
+	{Kyra::kDebugLevelScriptFuncs, "ScriptFuncs", "Script function debug level"},
+	{Kyra::kDebugLevelScript, "Script", "Script interpreter debug level"},
+	{Kyra::kDebugLevelSprites, "Sprites", "Sprite debug level"},
+	{Kyra::kDebugLevelScreen, "Screen", "Screen debug level"},
+	{Kyra::kDebugLevelSound, "Sound", "Sound debug level"},
+	{Kyra::kDebugLevelAnimator, "Animator", "Animator debug level"},
+	{Kyra::kDebugLevelMain, "Main", "Generic debug level"},
+	{Kyra::kDebugLevelGUI, "GUI", "GUI debug level"},
+	{Kyra::kDebugLevelSequence, "Sequence", "Sequence debug level"},
+	{Kyra::kDebugLevelMovie, "Movie", "Movie debug level"},
+	{Kyra::kDebugLevelTimer, "Timer", "Timer debug level"},
+	DEBUG_CHANNEL_END
+};
+
 const char *const directoryGlobs[] = {
 	"malcolm",
 	"data", // LOL GOG release
@@ -156,6 +172,10 @@ public:
 		return "Kyra";
 	}
 
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
+
 	const char *getOriginalCopyright() const override {
 		return "The Legend of Kyrandia (C) Westwood Studios"
 #ifdef ENABLE_LOL
diff --git a/engines/kyra/engine/kyra_v1.cpp b/engines/kyra/engine/kyra_v1.cpp
index aee24a7f6e..da5e1e5ad1 100644
--- a/engines/kyra/engine/kyra_v1.cpp
+++ b/engines/kyra/engine/kyra_v1.cpp
@@ -68,19 +68,6 @@ KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags)
 	_mouseX = _mouseY = 0;
 	_transOffsY = 0;
 	_asciiCodeEvents = _kbEventSkip = false;
-
-	// sets up all engine specific debug levels
-	DebugMan.addDebugChannel(kDebugLevelScriptFuncs, "ScriptFuncs", "Script function debug level");
-	DebugMan.addDebugChannel(kDebugLevelScript, "Script", "Script interpreter debug level");
-	DebugMan.addDebugChannel(kDebugLevelSprites, "Sprites", "Sprite debug level");
-	DebugMan.addDebugChannel(kDebugLevelScreen, "Screen", "Screen debug level");
-	DebugMan.addDebugChannel(kDebugLevelSound, "Sound", "Sound debug level");
-	DebugMan.addDebugChannel(kDebugLevelAnimator, "Animator", "Animator debug level");
-	DebugMan.addDebugChannel(kDebugLevelMain, "Main", "Generic debug level");
-	DebugMan.addDebugChannel(kDebugLevelGUI, "GUI", "GUI debug level");
-	DebugMan.addDebugChannel(kDebugLevelSequence, "Sequence", "Sequence debug level");
-	DebugMan.addDebugChannel(kDebugLevelMovie, "Movie", "Movie debug level");
-	DebugMan.addDebugChannel(kDebugLevelTimer, "Timer", "Timer debug level");
 }
 
 void KyraEngine_v1::pauseEngineIntern(bool pause) {


Commit: fb1e15fc3de9102be70f45e6e510b5055755378e
    https://github.com/scummvm/scummvm/commit/fb1e15fc3de9102be70f45e6e510b5055755378e
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
LASTEXPRESS: move debug channels to metaEngineDetection

Changed paths:
    engines/lastexpress/detection.cpp
    engines/lastexpress/lastexpress.cpp


diff --git a/engines/lastexpress/detection.cpp b/engines/lastexpress/detection.cpp
index 4530279c85..bb0121acff 100644
--- a/engines/lastexpress/detection.cpp
+++ b/engines/lastexpress/detection.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "engines/advancedDetector.h"
+#include "lastexpress/lastexpress.h"
 
 namespace LastExpress {
 
@@ -30,6 +31,18 @@ static const PlainGameDescriptor lastExpressGames[] = {
 	{0, 0}
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{LastExpress::kLastExpressDebugGraphics, "Graphics", "Debug graphics & animation/sequence playback"},
+	{LastExpress::kLastExpressDebugResource, "Resource", "Debug resource management"},
+	{LastExpress::kLastExpressDebugCursor, "Cursor", "Debug cursor handling"},
+	{LastExpress::kLastExpressDebugSound, "Sound", "Debug sound playback"},
+	{LastExpress::kLastExpressDebugSubtitle, "Subtitle", "Debug subtitles"},
+	{LastExpress::kLastExpressDebugSavegame, "Savegame", "Debug savegames"},
+	{LastExpress::kLastExpressDebugLogic, "Logic", "Debug logic"},
+	{LastExpress::kLastExpressDebugScenes, "Scenes", "Debug scenes & hotspots"},
+	{LastExpress::kLastExpressDebugUnknown, "Unknown", "Debug unknown data"},
+};
+
 static const ADGameDescription gameDescriptions[] = {
 
 	// The Last Express (English) - US Broderbund Release
@@ -227,6 +240,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "The Last Express (C) 1997 Smoking Car Productions";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 } // End of namespace LastExpress
diff --git a/engines/lastexpress/lastexpress.cpp b/engines/lastexpress/lastexpress.cpp
index b5527d9514..ac3f631b0a 100644
--- a/engines/lastexpress/lastexpress.cpp
+++ b/engines/lastexpress/lastexpress.cpp
@@ -68,17 +68,6 @@ LastExpressEngine::LastExpressEngine(OSystem *syst, const ADGameDescription *gd)
 	// Adding the default directories
 	const Common::FSNode gameDataDir(ConfMan.get("path"));
 	SearchMan.addSubDirectoryMatching(gameDataDir, "data");
-
-	// Initialize the custom debug levels
-	DebugMan.addDebugChannel(kLastExpressDebugGraphics, "Graphics", "Debug graphics & animation/sequence playback");
-	DebugMan.addDebugChannel(kLastExpressDebugResource, "Resource", "Debug resource management");
-	DebugMan.addDebugChannel(kLastExpressDebugCursor, "Cursor", "Debug cursor handling");
-	DebugMan.addDebugChannel(kLastExpressDebugSound, "Sound", "Debug sound playback");
-	DebugMan.addDebugChannel(kLastExpressDebugSubtitle, "Subtitle", "Debug subtitles");
-	DebugMan.addDebugChannel(kLastExpressDebugSavegame, "Savegame", "Debug savegames");
-	DebugMan.addDebugChannel(kLastExpressDebugLogic, "Logic", "Debug logic");
-	DebugMan.addDebugChannel(kLastExpressDebugScenes, "Scenes", "Debug scenes & hotspots");
-	DebugMan.addDebugChannel(kLastExpressDebugUnknown, "Unknown", "Debug unknown data");
 }
 
 LastExpressEngine::~LastExpressEngine() {


Commit: 414d6235b3c5617de596e1747875eb83e41ac59d
    https://github.com/scummvm/scummvm/commit/414d6235b3c5617de596e1747875eb83e41ac59d
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
LILLIPUT: move debug channels to metaEngineDetection

Changed paths:
    engines/lilliput/detection.cpp
    engines/lilliput/lilliput.cpp


diff --git a/engines/lilliput/detection.cpp b/engines/lilliput/detection.cpp
index e8c267dd8a..76cd36df17 100644
--- a/engines/lilliput/detection.cpp
+++ b/engines/lilliput/detection.cpp
@@ -25,6 +25,7 @@
 #include "common/textconsole.h"
 
 #include "lilliput/detection.h"
+#include "lilliput/lilliput.h"
 
 namespace Lilliput {
 
@@ -35,6 +36,15 @@ static const PlainGameDescriptor lilliputGames[] = {
 	{0, 0}
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{Lilliput::kDebugEngine, "Engine", "Engine debug level"},
+	{Lilliput::kDebugScript, "Script", "Script debug level"},
+	{Lilliput::kDebugSound,  "Sound",  "Sound debug level"},
+	{Lilliput::kDebugEngineTBC, "EngineTBC", "Engine debug level"},
+	{Lilliput::kDebugScriptTBC, "ScriptTBC", "Script debug level"},
+	DEBUG_CHANNEL_END
+};
+
 static const LilliputGameDescription gameDescriptions[] = {
 
 	// Robin Hood English
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp
index 5ce305952b..756c12a8d8 100644
--- a/engines/lilliput/lilliput.cpp
+++ b/engines/lilliput/lilliput.cpp
@@ -110,11 +110,6 @@ static const byte _basisPalette[768] = {
 
 LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd) : Engine(syst), _gameDescription(gd) {
 	_system = syst;
-	DebugMan.addDebugChannel(kDebugEngine, "Engine", "Engine debug level");
-	DebugMan.addDebugChannel(kDebugScript, "Script", "Script debug level");
-	DebugMan.addDebugChannel(kDebugSound,  "Sound",  "Sound debug level");
-	DebugMan.addDebugChannel(kDebugEngineTBC, "EngineTBC", "Engine debug level");
-	DebugMan.addDebugChannel(kDebugScriptTBC, "ScriptTBC", "Script debug level");
 
 	setDebugger(new LilliputConsole(this));
 	_rnd = 0;


Commit: acc86e6140d29c72f53ba4f72b8593ccffe36b5a
    https://github.com/scummvm/scummvm/commit/acc86e6140d29c72f53ba4f72b8593ccffe36b5a
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
LURE: move debug channels to metaEngineDetection

Changed paths:
    engines/lure/detection.cpp
    engines/lure/lure.cpp


diff --git a/engines/lure/detection.cpp b/engines/lure/detection.cpp
index c8b0638bb9..ca969c799d 100644
--- a/engines/lure/detection.cpp
+++ b/engines/lure/detection.cpp
@@ -27,6 +27,7 @@
 #include "common/translation.h"
 
 #include "lure/detection.h"
+#include "lure/lure.h"
 
 static const PlainGameDescriptor lureGames[] = {
 	{"lure", "Lure of the Temptress"},
@@ -51,6 +52,16 @@ static const ADExtraGuiOptionsMap optionsList[] = {
 	AD_EXTRA_GUI_OPTIONS_TERMINATOR
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{Lure::kLureDebugScripts, "scripts", "Scripts debugging"},
+	{Lure::kLureDebugAnimations, "animations", "Animations debugging"},
+	{Lure::kLureDebugHotspots, "hotspots", "Hotspots debugging"},
+	{Lure::kLureDebugFights, "fights", "Fights debugging"},
+	{Lure::kLureDebugSounds, "sounds", "Sounds debugging"},
+	{Lure::kLureDebugStrings, "strings", "Strings debugging"},
+	DEBUG_CHANNEL_END
+};
+
 #endif
 
 namespace Lure {
@@ -261,6 +272,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Lure of the Temptress (C) Revolution";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(LURE_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, LureMetaEngineDetection);
diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp
index 6f1634d420..03ad0437a4 100644
--- a/engines/lure/lure.cpp
+++ b/engines/lure/lure.cpp
@@ -41,13 +41,6 @@ static LureEngine *int_engine = NULL;
 
 LureEngine::LureEngine(OSystem *system, const LureGameDescription *gameDesc)
 	: Engine(system), _gameDescription(gameDesc), _rnd("lure") {
-
-	DebugMan.addDebugChannel(kLureDebugScripts, "scripts", "Scripts debugging");
-	DebugMan.addDebugChannel(kLureDebugAnimations, "animations", "Animations debugging");
-	DebugMan.addDebugChannel(kLureDebugHotspots, "hotspots", "Hotspots debugging");
-	DebugMan.addDebugChannel(kLureDebugFights, "fights", "Fights debugging");
-	DebugMan.addDebugChannel(kLureDebugSounds, "sounds", "Sounds debugging");
-	DebugMan.addDebugChannel(kLureDebugStrings, "strings", "Strings debugging");
 }
 
 Common::Error LureEngine::init() {


Commit: eb0412c21f1866e6497250ae0dd66986513caea2
    https://github.com/scummvm/scummvm/commit/eb0412c21f1866e6497250ae0dd66986513caea2
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
MACVENTURE: move debug channels to metaEngineDetection

Changed paths:
    engines/macventure/detection.cpp
    engines/macventure/macventure.cpp
    engines/macventure/macventure.h


diff --git a/engines/macventure/detection.cpp b/engines/macventure/detection.cpp
index 795cefb9d9..327f69e802 100644
--- a/engines/macventure/detection.cpp
+++ b/engines/macventure/detection.cpp
@@ -23,6 +23,7 @@
 #include "base/plugins.h"
 
 #include "engines/advancedDetector.h"
+#include "macventure/macventure.h"
 
 namespace MacVenture {
 
@@ -39,6 +40,17 @@ static const ADGameDescription gameDescriptions[] = {
 
 } // End of namespace MacVenture
 
+static const DebugChannelDef debugFlagList[] = {
+	{MacVenture::kMVDebugMain, "main", "Engine state"},
+	{MacVenture::kMVDebugGUI, "gui", "Gui"},
+	{MacVenture::kMVDebugText, "text", "Text decoders and printers"},
+	{MacVenture::kMVDebugImage, "image", "Image decoders and renderers"},
+	{MacVenture::kMVDebugScript, "script", "Script engine"},
+	{MacVenture::kMVDebugSound, "sound", "Sound decoders"},
+	{MacVenture::kMVDebugContainer, "container", "Containers"},
+	DEBUG_CHANNEL_END
+};
+
 static const PlainGameDescriptor macventureGames[] = {
 	{ "shadowgate", "Shadowgate" },
 	{ "deja_vu", "Deja Vu"},
@@ -68,6 +80,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "(C) ICOM Simulations";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 } // End of namespace MacVenture
diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp
index 40ce781ae0..151d2d7155 100644
--- a/engines/macventure/macventure.cpp
+++ b/engines/macventure/macventure.cpp
@@ -64,8 +64,6 @@ MacVentureEngine::MacVentureEngine(OSystem *syst, const ADGameDescription *gameD
 	_gameDescription = gameDesc;
 	_rnd = new Common::RandomSource("macventure");
 
-	initDebugChannels();
-
 	_resourceManager = NULL;
 	_globalSettings = NULL;
 	_gui = NULL;
@@ -130,16 +128,6 @@ MacVentureEngine::~MacVentureEngine() {
 		delete _dataBundle;
 }
 
-void MacVentureEngine::initDebugChannels() {
-	DebugMan.addDebugChannel(kMVDebugMain, "main", "Engine state");
-	DebugMan.addDebugChannel(kMVDebugGUI, "gui", "Gui");
-	DebugMan.addDebugChannel(kMVDebugText, "text", "Text decoders and printers");
-	DebugMan.addDebugChannel(kMVDebugImage, "image", "Image decoders and renderers");
-	DebugMan.addDebugChannel(kMVDebugScript, "script", "Script engine");
-	DebugMan.addDebugChannel(kMVDebugSound, "sound", "Sound decoders");
-	DebugMan.addDebugChannel(kMVDebugContainer, "container", "Containers");
-}
-
 Common::Error MacVentureEngine::run() {
 	debug("MacVenture::MacVentureEngine::init()");
 	initGraphics(kScreenWidth, kScreenHeight);
diff --git a/engines/macventure/macventure.h b/engines/macventure/macventure.h
index fc8ec3887b..c20f82c370 100644
--- a/engines/macventure/macventure.h
+++ b/engines/macventure/macventure.h
@@ -205,7 +205,6 @@ public:
 	void setInitialFlags();
 	void setNewGameState();
 
-	void initDebugChannels();
 	void reset();
 	void resetInternals();
 	void resetGui();


Commit: a336c3158f1bc0bae1be4b737250a789b387b2c2
    https://github.com/scummvm/scummvm/commit/a336c3158f1bc0bae1be4b737250a789b387b2c2
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
MADS: move debug channels to metaEngineDetection

Changed paths:
    engines/mads/detection.cpp
    engines/mads/mads.cpp


diff --git a/engines/mads/detection.cpp b/engines/mads/detection.cpp
index c3872dc8a8..c76eb88807 100644
--- a/engines/mads/detection.cpp
+++ b/engines/mads/detection.cpp
@@ -28,6 +28,7 @@
 #include "common/translation.h"
 
 #include "mads/detection.h"
+#include "mads/mads.h"
 
 static const PlainGameDescriptor MADSGames[] = {
 	{"dragonsphere", "Dragonsphere"},
@@ -36,6 +37,13 @@ static const PlainGameDescriptor MADSGames[] = {
 	{0, 0}
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{MADS::kDebugPath, "Path", "Pathfinding debug level"},
+	{MADS::kDebugScripts, "scripts", "Game scripts"},
+	{MADS::kDebugGraphics, "graphics", "Graphics handling"},
+	DEBUG_CHANNEL_END
+};
+
 #define GAMEOPTION_EASY_MOUSE          GUIO_GAMEOPTIONS1
 #define GAMEOPTION_ANIMATED_INVENTORY  GUIO_GAMEOPTIONS2
 #define GAMEOPTION_ANIMATED_INTERFACE  GUIO_GAMEOPTIONS3
@@ -131,6 +139,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "MADS (C) Microprose";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(MADS_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, MADSMetaEngineDetection);
diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp
index 6d1c775a81..f24975f2a2 100644
--- a/engines/mads/mads.cpp
+++ b/engines/mads/mads.cpp
@@ -38,11 +38,6 @@ namespace MADS {
 MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) :
 		_gameDescription(gameDesc), Engine(syst), _randomSource("MADS") {
 
-	// Set up debug channels
-	DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
-	DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts");
-	DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling");
-
 	// Initialize game/engine options
 	_easyMouse = true;
 	_invObjectsAnimated = true;


Commit: ad62915be3de00dd8d12d759cc781f95d6d10cab
    https://github.com/scummvm/scummvm/commit/ad62915be3de00dd8d12d759cc781f95d6d10cab
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
MORTEVIELLE: move debug channels to metaEngineDetection

Changed paths:
    engines/mortevielle/detection.cpp
    engines/mortevielle/mortevielle.cpp


diff --git a/engines/mortevielle/detection.cpp b/engines/mortevielle/detection.cpp
index 86da54f159..9d40332dad 100644
--- a/engines/mortevielle/detection.cpp
+++ b/engines/mortevielle/detection.cpp
@@ -24,12 +24,19 @@
 #include "engines/advancedDetector.h"
 
 #include "mortevielle/detection.h"
+#include "mortevielle/mortevielle.h"
 
 static const PlainGameDescriptor MortevielleGame[] = {
 	{"mortevielle", "Mortville Manor"},
 	{0, 0}
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{Mortevielle::kMortevielleCore, "core", "Core debugging"},
+	{Mortevielle::kMortevielleGraphics, "graphics", "Graphics debugging"},
+	DEBUG_CHANNEL_END
+};
+
 #include "mortevielle/detection_tables.h"
 
 class MortevielleMetaEngineDetection : public AdvancedMetaEngineDetection {
@@ -53,6 +60,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Mortville Manor (C) 1987-89 Lankhor";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 
diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp
index 1853f33fe4..a8f15d9780 100644
--- a/engines/mortevielle/mortevielle.cpp
+++ b/engines/mortevielle/mortevielle.cpp
@@ -49,9 +49,6 @@ MortevielleEngine *g_vm;
 
 MortevielleEngine::MortevielleEngine(OSystem *system, const MortevielleGameDescription *gameDesc):
 		Engine(system), _gameDescription(gameDesc), _randomSource("mortevielle") {
-	// Set debug channels
-	DebugMan.addDebugChannel(kMortevielleCore, "core", "Core debugging");
-	DebugMan.addDebugChannel(kMortevielleGraphics, "graphics", "Graphics debugging");
 
 	g_vm = this;
 	setDebugger(new Debugger(this));


Commit: 37e313bada5cfb59120c6531616955ed281bcdfb
    https://github.com/scummvm/scummvm/commit/37e313bada5cfb59120c6531616955ed281bcdfb
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
MYST3: move debug channels to metaEngineDetection

Changed paths:
    engines/myst3/detection.cpp
    engines/myst3/myst3.cpp


diff --git a/engines/myst3/detection.cpp b/engines/myst3/detection.cpp
index bd0782743f..3c343501ad 100644
--- a/engines/myst3/detection.cpp
+++ b/engines/myst3/detection.cpp
@@ -24,6 +24,7 @@
 
 #include "engines/advancedDetector.h"
 #include "engines/myst3/detection.h"
+#include "engines/myst3/myst3.h"
 
 
 namespace Myst3 {
@@ -33,6 +34,14 @@ static const PlainGameDescriptor myst3Games[] = {
 	{ 0, 0 }
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{Myst3::kDebugVariable, "Variable", "Track Variable Accesses"},
+	{Myst3::kDebugSaveLoad, "SaveLoad", "Track Save/Load Function"},
+	{Myst3::kDebugScript, "Script", "Track Script Execution"},
+	{Myst3::kDebugNode, "Node", "Track Node Changes"},
+	DEBUG_CHANNEL_END
+};
+
 static const char *directoryGlobs[] = {
 	"bin",
 	"M3Data",
@@ -208,6 +217,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Myst III Exile (C) Presto Studios";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 } // End of namespace Myst3
diff --git a/engines/myst3/myst3.cpp b/engines/myst3/myst3.cpp
index b4a8433576..3dd74f2cc2 100644
--- a/engines/myst3/myst3.cpp
+++ b/engines/myst3/myst3.cpp
@@ -77,10 +77,6 @@ Myst3Engine::Myst3Engine(OSystem *syst, const Myst3GameDescription *version) :
 		_backgroundSoundScriptLastRoomId(0),
 		_backgroundSoundScriptLastAgeId(0),
 		_transition(0), _frameLimiter(0), _inventoryManualHide(false) {
-	DebugMan.addDebugChannel(kDebugVariable, "Variable", "Track Variable Accesses");
-	DebugMan.addDebugChannel(kDebugSaveLoad, "SaveLoad", "Track Save/Load Function");
-	DebugMan.addDebugChannel(kDebugScript, "Script", "Track Script Execution");
-	DebugMan.addDebugChannel(kDebugNode, "Node", "Track Node Changes");
 
 	// Add subdirectories to the search path to allow running from a full HDD install
 	const Common::FSNode gameDataDir(ConfMan.get("path"));


Commit: 04d03fe7f0ecf04efd3a18066ce2c15291c4d211
    https://github.com/scummvm/scummvm/commit/04d03fe7f0ecf04efd3a18066ce2c15291c4d211
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
NANCY: move debug channels to metaEngineDetection

Changed paths:
    engines/nancy/detection.cpp
    engines/nancy/nancy.cpp


diff --git a/engines/nancy/detection.cpp b/engines/nancy/detection.cpp
index e8b4ee5250..1ae095c280 100644
--- a/engines/nancy/detection.cpp
+++ b/engines/nancy/detection.cpp
@@ -23,6 +23,7 @@
 #include "common/config-manager.h"
 
 #include "engines/nancy/detection.h"
+#include "engines/nancy/nancy.h"
 //#include "engines/nancy/dialogs.h"
 
 const char *const directoryGlobs[] = {
@@ -32,6 +33,13 @@ const char *const directoryGlobs[] = {
 	0
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{Nancy::kDebugEngine, "Engine", "Engine debug level"},
+	{Nancy::kDebugActionRecord, "ActionRecord", "Action Record debug level"},
+	{Nancy::kDebugScene, "Scene", "Scene debug level"},
+	DEBUG_CHANNEL_END
+};
+
 static const PlainGameDescriptor nancyGames[] = {
 	// Games
 	{"vampirediaries", "The Vampire Diaries"},
@@ -236,6 +244,10 @@ public:
 		return "Nancy Drew Engine copyright Her Interactive, 1995-2012";
 	}
 
+	virtual const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
+
 	virtual void registerDefaultSettings(const Common::String &target) const override;
 	//virtual GUI::OptionsContainerWidget *buildEngineOptionsWidgetStatic(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const override;
 };
diff --git a/engines/nancy/nancy.cpp b/engines/nancy/nancy.cpp
index 002424d5f7..c5d9a78195 100644
--- a/engines/nancy/nancy.cpp
+++ b/engines/nancy/nancy.cpp
@@ -55,10 +55,6 @@ NancyEngine *g_nancy;
 NancyEngine::NancyEngine(OSystem *syst, const NancyGameDescription *gd) : Engine(syst), _gameDescription(gd), _system(syst) {
 	g_nancy = this;
 
-	DebugMan.addDebugChannel(kDebugEngine, "Engine", "Engine debug level");
-	DebugMan.addDebugChannel(kDebugActionRecord, "ActionRecord", "Action Record debug level");
-	DebugMan.addDebugChannel(kDebugScene, "Scene", "Scene debug level");
-
 	_randomSource = new Common::RandomSource("Nancy");
 	_randomSource->setSeed(_randomSource->getSeed());
 


Commit: 9c7718465e7bc43594911a3206d0b3347ee4b6ce
    https://github.com/scummvm/scummvm/commit/9c7718465e7bc43594911a3206d0b3347ee4b6ce
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
NGI: move debug channels to metaEngineDetection

Changed paths:
    engines/ngi/detection.cpp
    engines/ngi/ngi.cpp


diff --git a/engines/ngi/detection.cpp b/engines/ngi/detection.cpp
index 9c10b16369..8d75c34c09 100644
--- a/engines/ngi/detection.cpp
+++ b/engines/ngi/detection.cpp
@@ -26,6 +26,22 @@
 #include "common/file.h"
 
 #include "ngi/detection.h"
+#include "ngi/ngi.h"
+
+static const DebugChannelDef debugFlagList[] = {
+	{NGI::kDebugPathfinding, "path", "Pathfinding"},
+	{NGI::kDebugDrawing, "drawing", "Drawing"},
+	{NGI::kDebugLoading, "loading", "Scene loading"},
+	{NGI::kDebugAnimation, "animation", "Animation"},
+	{NGI::kDebugBehavior, "behavior", "Behavior"},
+	{NGI::kDebugMemory, "memory", "Memory management"},
+	{NGI::kDebugEvents, "events", "Event handling"},
+	{NGI::kDebugInventory, "inventory", "Inventory"},
+	{NGI::kDebugSceneLogic, "scenelogic", "Scene Logic"},
+	{NGI::kDebugInteractions, "interactions", "Interactions"},
+	{NGI::kDebugXML, "xml", "XML"},
+	DEBUG_CHANNEL_END
+};
 
 static const PlainGameDescriptor ngiGames[] = {
 	{"ngi", 		"Nikita Game Interface game"},
@@ -171,6 +187,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Full Pipe (C) Pipe Studio";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(NGI_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, NGIMetaEngineDetection);
diff --git a/engines/ngi/ngi.cpp b/engines/ngi/ngi.cpp
index 3d316943ae..5613fc1dab 100644
--- a/engines/ngi/ngi.cpp
+++ b/engines/ngi/ngi.cpp
@@ -57,17 +57,6 @@ NGIEngine::NGIEngine(OSystem *syst, const NGIGameDescription *gameDesc) :
 	_modalObject(nullptr),
 	_currSoundList1(),
 	_mapTable() {
-	DebugMan.addDebugChannel(kDebugPathfinding, "path", "Pathfinding");
-	DebugMan.addDebugChannel(kDebugDrawing, "drawing", "Drawing");
-	DebugMan.addDebugChannel(kDebugLoading, "loading", "Scene loading");
-	DebugMan.addDebugChannel(kDebugAnimation, "animation", "Animation");
-	DebugMan.addDebugChannel(kDebugBehavior, "behavior", "Behavior");
-	DebugMan.addDebugChannel(kDebugMemory, "memory", "Memory management");
-	DebugMan.addDebugChannel(kDebugEvents, "events", "Event handling");
-	DebugMan.addDebugChannel(kDebugInventory, "inventory", "Inventory");
-	DebugMan.addDebugChannel(kDebugSceneLogic, "scenelogic", "Scene Logic");
-	DebugMan.addDebugChannel(kDebugInteractions, "interactions", "Interactions");
-	DebugMan.addDebugChannel(kDebugXML, "xml", "XML");
 
 	// Setup mixer
 	if (!_mixer->isReady()) {


Commit: 3909daf6a2069f499576019e259cfabc20f87e30
    https://github.com/scummvm/scummvm/commit/3909daf6a2069f499576019e259cfabc20f87e30
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
PARALLACTION: move debug channels to metaEngineDetection

Changed paths:
    engines/parallaction/detection.cpp
    engines/parallaction/parallaction.cpp


diff --git a/engines/parallaction/detection.cpp b/engines/parallaction/detection.cpp
index 4e2daf20ec..11e11634bc 100644
--- a/engines/parallaction/detection.cpp
+++ b/engines/parallaction/detection.cpp
@@ -28,6 +28,7 @@
 #include "common/textconsole.h"
 
 #include "parallaction/detection.h"
+#include "parallaction/parallaction.h"
 
 static const PlainGameDescriptor parallactionGames[] = {
 	{"nippon", "Nippon Safes Inc."},
@@ -35,6 +36,20 @@ static const PlainGameDescriptor parallactionGames[] = {
 	{0, 0}
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{Parallaction::kDebugDialogue, "dialogue", "Dialogues debug level"},
+	{Parallaction::kDebugParser, "parser", "Parser debug level"},
+	{Parallaction::kDebugDisk, "disk", "Disk debug level"},
+	{Parallaction::kDebugWalk, "walk", "Walk debug level"},
+	{Parallaction::kDebugGraphics, "gfx", "Gfx debug level"},
+	{Parallaction::kDebugExec, "exec", "Execution debug level"},
+	{Parallaction::kDebugInput, "input", "Input debug level"},
+	{Parallaction::kDebugAudio, "audio", "Audio debug level"},
+	{Parallaction::kDebugMenu, "menu", "Menu debug level"},
+	{Parallaction::kDebugInventory, "inventory", "Inventory debug level"},
+	DEBUG_CHANNEL_END
+};
+
 namespace Parallaction {
 
 static const PARALLACTIONGameDescription gameDescriptions[] = {
@@ -203,6 +218,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Nippon Safes Inc. (C) Dynabyte";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(PARALLACTION_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, ParallactionMetaEngineDetection);
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index 4c4b27275e..7dccb8c044 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -49,16 +49,6 @@ Parallaction::Parallaction(OSystem *syst, const PARALLACTIONGameDescription *gam
 	syncSoundSettings();
 
 	g_vm = this;
-	DebugMan.addDebugChannel(kDebugDialogue, "dialogue", "Dialogues debug level");
-	DebugMan.addDebugChannel(kDebugParser, "parser", "Parser debug level");
-	DebugMan.addDebugChannel(kDebugDisk, "disk", "Disk debug level");
-	DebugMan.addDebugChannel(kDebugWalk, "walk", "Walk debug level");
-	DebugMan.addDebugChannel(kDebugGraphics, "gfx", "Gfx debug level");
-	DebugMan.addDebugChannel(kDebugExec, "exec", "Execution debug level");
-	DebugMan.addDebugChannel(kDebugInput, "input", "Input debug level");
-	DebugMan.addDebugChannel(kDebugAudio, "audio", "Audio debug level");
-	DebugMan.addDebugChannel(kDebugMenu, "menu", "Menu debug level");
-	DebugMan.addDebugChannel(kDebugInventory, "inventory", "Inventory debug level");
 
 	_screenWidth = 0;
 	_screenHeight = 0;


Commit: e955e588d06cbc888a911d7b854f5db1182bafb4
    https://github.com/scummvm/scummvm/commit/e955e588d06cbc888a911d7b854f5db1182bafb4
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
PETKA: move debug channels to metaEngineDetection

Changed paths:
    engines/petka/detection.cpp
    engines/petka/petka.cpp


diff --git a/engines/petka/detection.cpp b/engines/petka/detection.cpp
index 9e5800af43..de81bb7128 100644
--- a/engines/petka/detection.cpp
+++ b/engines/petka/detection.cpp
@@ -24,6 +24,8 @@
 
 #include "engines/advancedDetector.h"
 
+#include "petka/petka.h"
+
 static const PlainGameDescriptor petkaGames[] = {
 	{"petka_demo", "Red Comrades Demo"},
 	{"petka1", "Red Comrades 1: Save the Galaxy"},
@@ -31,6 +33,14 @@ static const PlainGameDescriptor petkaGames[] = {
 	{0, 0}
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{Petka::kPetkaDebugGeneral, "general", "General issues"},
+	{Petka::kPetkaDebugResources, "resources", "Resources"},
+	{Petka::kPetkaDebugMessagingSystem, "message_system", "Engine message system"},
+	{Petka::kPetkaDebugDialogs, "dialogs", "Dialogs"},
+	DEBUG_CHANNEL_END
+};
+
 #include "petka/detection_tables.h"
 
 class PetkaMetaEngineDetection : public AdvancedMetaEngineDetection {
@@ -51,6 +61,10 @@ public:
 	virtual const char *getOriginalCopyright() const override {
 		return "Red Comrades (C) S.K.I.F.";
 	}
+
+	virtual const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(PETKA_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, PetkaMetaEngineDetection);
diff --git a/engines/petka/petka.cpp b/engines/petka/petka.cpp
index aa110dd34f..7f0efce946 100644
--- a/engines/petka/petka.cpp
+++ b/engines/petka/petka.cpp
@@ -53,11 +53,6 @@ PetkaEngine::PetkaEngine(OSystem *system, const ADGameDescription *desc)
 	: Engine(system), _console(nullptr), _fileMgr(nullptr), _resMgr(nullptr),
 	_qsystem(nullptr), _vsys(nullptr), _desc(desc), _videoDec(nullptr), _rnd("petka") {
 
-	DebugMan.addDebugChannel(kPetkaDebugGeneral, "general", "General issues");
-	DebugMan.addDebugChannel(kPetkaDebugResources, "resources", "Resources");
-	DebugMan.addDebugChannel(kPetkaDebugMessagingSystem, "message_system", "Engine message system");
-	DebugMan.addDebugChannel(kPetkaDebugDialogs, "dialogs", "Dialogs");
-
 	_part = 0xFF;
 	_chapter = 0;
 	_shouldChangePart = false;


Commit: e52a3bf7ec5663e1b6abb700351887d10cdf0f02
    https://github.com/scummvm/scummvm/commit/e52a3bf7ec5663e1b6abb700351887d10cdf0f02
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
PLUMBERS: move debug channels to metaEngineDetection

Changed paths:
    engines/plumbers/detection.cpp
    engines/plumbers/plumbers.cpp


diff --git a/engines/plumbers/detection.cpp b/engines/plumbers/detection.cpp
index 635b343279..fdc6c12acd 100644
--- a/engines/plumbers/detection.cpp
+++ b/engines/plumbers/detection.cpp
@@ -25,11 +25,18 @@
 #include "engines/advancedDetector.h"
 #include "engines/game.h"
 
+#include "plumbers/plumbers.h"
+
 static const PlainGameDescriptor plumbersGames[] = {
 	{"plumbers", "Plumbers Don't Wear Ties!"},
 	{0, 0}
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{Plumbers::kDebugGeneral, "general", "General debug level"},
+	DEBUG_CHANNEL_END
+};
+
 namespace Plumbers {
 
 static const ADGameDescription gameDescriptions[] = {
@@ -76,6 +83,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Plumbers Don't Wear Ties (C) 1993-94 Kirin Entertainment";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(PLUMBERS_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, PlumbersMetaEngineDetection);
diff --git a/engines/plumbers/plumbers.cpp b/engines/plumbers/plumbers.cpp
index 9f937790ef..9aa7bc19c6 100644
--- a/engines/plumbers/plumbers.cpp
+++ b/engines/plumbers/plumbers.cpp
@@ -85,8 +85,6 @@ PlumbersGame::PlumbersGame(OSystem *syst, const ADGameDescription *gameDesc) :
 	_totScore = 0;
 	_cheatEnabled = false;
 	_cheatFSM = 0;
-
-	DebugMan.addDebugChannel(kDebugGeneral, "general", "General debug level");
 }
 
 PlumbersGame::~PlumbersGame() {


Commit: 9d0818015eec8f9156bd63f240322369698e8c98
    https://github.com/scummvm/scummvm/commit/9d0818015eec8f9156bd63f240322369698e8c98
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
PRINCE: move debug channels to metaEngineDetection

Changed paths:
    engines/prince/detection.cpp
    engines/prince/prince.cpp


diff --git a/engines/prince/detection.cpp b/engines/prince/detection.cpp
index 80d40df3b6..23590f6855 100644
--- a/engines/prince/detection.cpp
+++ b/engines/prince/detection.cpp
@@ -23,12 +23,19 @@
 #include "engines/advancedDetector.h"
 
 #include "prince/detection.h"
+#include "prince/prince.h"
 
 static const PlainGameDescriptor princeGames[] = {
 	{"prince", "The Prince and the Coward"},
 	{0, 0}
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{Prince::DebugChannel::kScript, "script", "Prince Script debug channel"},
+	{Prince::DebugChannel::kEngine, "engine", "Prince Engine debug channel"},
+	DEBUG_CHANNEL_END
+};
+
 namespace Prince {
 static const PrinceGameDescription gameDescriptions[] = {
 	{
@@ -145,6 +152,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "The Prince and the Coward (C) 1996-97 Metropolis";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(PRINCE_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, PrinceMetaEngineDetection);
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp
index 47ec701b3b..1256d19ded 100644
--- a/engines/prince/prince.cpp
+++ b/engines/prince/prince.cpp
@@ -89,10 +89,6 @@ PrinceEngine::PrinceEngine(OSystem *syst, const PrinceGameDescription *gameDesc)
 	_flcFrameSurface(nullptr), _shadScaleValue(0), _shadLineLen(0), _scaleValue(0), _dialogImage(nullptr), _mobTranslationData(nullptr),
 	_mobTranslationSize(0), _missingVoice(false) {
 
-	// Debug/console setup
-	DebugMan.addDebugChannel(DebugChannel::kScript, "script", "Prince Script debug channel");
-	DebugMan.addDebugChannel(DebugChannel::kEngine, "engine", "Prince Engine debug channel");
-
 	DebugMan.enableDebugChannel("script");
 
 	memset(_audioStream, 0, sizeof(_audioStream));


Commit: 043fda5c4764c41a478bafac7993740b70b7d4ae
    https://github.com/scummvm/scummvm/commit/043fda5c4764c41a478bafac7993740b70b7d4ae
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
PRIVATE: move debug channels to metaEngineDetection

Changed paths:
    engines/private/detection.cpp
    engines/private/private.cpp


diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index 8af66e8c4b..ab85cd184d 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -22,6 +22,14 @@
 
 #include "base/plugins.h"
 #include "engines/advancedDetector.h"
+#include "private/private.h"
+
+static const DebugChannelDef debugFlagList[] = {
+	{Private::kPrivateDebugFunction, "functions", "Function execution debug channel"},
+	{Private::kPrivateDebugCode, "code", "Code execution debug channel"},
+	{Private::kPrivateDebugScript, "script", "Script execution debug channel"},
+	DEBUG_CHANNEL_END
+};
 
 namespace Private {
 static const PlainGameDescriptor privateGames[] = {
@@ -179,6 +187,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Copyright (C) Brooklyn Multimedia";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(PRIVATE_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, PrivateMetaEngineDetection);
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index a6ffba3aa9..910664c4aa 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -52,11 +52,6 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
 	  _maxNumberClicks(0), _sirenWarning(0), _screenW(640), _screenH(480) {
 	_rnd = new Common::RandomSource("private");
 
-	// Debug channels
-	DebugMan.addDebugChannel(kPrivateDebugFunction, "functions", "Function execution debug channel");
-	DebugMan.addDebugChannel(kPrivateDebugCode, "code", "Code execution debug channel");
-	DebugMan.addDebugChannel(kPrivateDebugScript, "script", "Script execution debug channel");
-
 	// Global object for external reference
 	g_private = this;
 


Commit: 3a65856f4c259f715943d516cab43a1d714c106c
    https://github.com/scummvm/scummvm/commit/3a65856f4c259f715943d516cab43a1d714c106c
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
SCI: move debug channels to metaEngineDetection

Changed paths:
    engines/sci/detection.cpp
    engines/sci/sci.cpp


diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index 0ce05246ce..157909aa89 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -33,6 +33,36 @@
 
 #include "sci/detection.h"
 #include "sci/graphics/helpers_detection_enums.h"
+#include "sci/sci.h"
+
+static const DebugChannelDef debugFlagList[] = {
+	{Sci::kDebugLevelError, "Error", "Script error debugging"},
+	{Sci::kDebugLevelNodes, "Lists", "Lists and nodes debugging"},
+	{Sci::kDebugLevelGraphics, "Graphics", "Graphics debugging"},
+	{Sci::kDebugLevelStrings, "Strings", "Strings debugging"},
+	{Sci::kDebugLevelMemory, "Memory", "Memory debugging"},
+	{Sci::kDebugLevelFuncCheck, "Func", "Function parameter debugging"},
+	{Sci::kDebugLevelBresen, "Bresenham", "Bresenham algorithms debugging"},
+	{Sci::kDebugLevelSound, "Sound", "Sound debugging"},
+	{Sci::kDebugLevelBaseSetter, "Base", "Base Setter debugging"},
+	{Sci::kDebugLevelParser, "Parser", "Parser debugging"},
+	{Sci::kDebugLevelSaid, "Said", "Said specs debugging"},
+	{Sci::kDebugLevelFile, "File", "File I/O debugging"},
+	{Sci::kDebugLevelTime, "Time", "Time debugging"},
+	{Sci::kDebugLevelRoom, "Room", "Room number debugging"},
+	{Sci::kDebugLevelAvoidPath, "Pathfinding", "Pathfinding debugging"},
+	{Sci::kDebugLevelDclInflate, "DCL", "DCL inflate debugging"},
+	{Sci::kDebugLevelVM, "VM", "VM debugging"},
+	{Sci::kDebugLevelScripts, "Scripts", "Notifies when scripts are unloaded"},
+	{Sci::kDebugLevelPatcher, "Patcher", "Notifies when scripts or resources are patched"},
+	{Sci::kDebugLevelWorkarounds, "Workarounds", "Notifies when workarounds are triggered"},
+	{Sci::kDebugLevelVideo, "Video", "Video (SEQ, VMD, RBT) debugging"},
+	{Sci::kDebugLevelGame, "Game", "Debug calls from game scripts"},
+	{Sci::kDebugLevelGC, "GC", "Garbage Collector debugging"},
+	{Sci::kDebugLevelResMan, "ResMan", "Resource manager debugging"},
+	{Sci::kDebugLevelOnStartup, "OnStartup", "Enter debugger at start of game"},
+	{Sci::kDebugLevelDebugMode, "DebugMode", "Enable game debug mode at start of game"},
+};
 
 namespace Sci {
 
@@ -434,6 +464,10 @@ public:
 		_matchFullPaths = true;
 	}
 
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
+
 	const char *getEngineId() const override {
 		return "sci";
 	}
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 36765097b3..c230ecb45b 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -111,34 +111,6 @@ SciEngine::SciEngine(OSystem *syst, const ADGameDescription *desc, SciGameId gam
 
 	_forceHiresGraphics = false;
 
-	// Set up the engine specific debug levels
-	DebugMan.addDebugChannel(kDebugLevelError, "Error", "Script error debugging");
-	DebugMan.addDebugChannel(kDebugLevelNodes, "Lists", "Lists and nodes debugging");
-	DebugMan.addDebugChannel(kDebugLevelGraphics, "Graphics", "Graphics debugging");
-	DebugMan.addDebugChannel(kDebugLevelStrings, "Strings", "Strings debugging");
-	DebugMan.addDebugChannel(kDebugLevelMemory, "Memory", "Memory debugging");
-	DebugMan.addDebugChannel(kDebugLevelFuncCheck, "Func", "Function parameter debugging");
-	DebugMan.addDebugChannel(kDebugLevelBresen, "Bresenham", "Bresenham algorithms debugging");
-	DebugMan.addDebugChannel(kDebugLevelSound, "Sound", "Sound debugging");
-	DebugMan.addDebugChannel(kDebugLevelBaseSetter, "Base", "Base Setter debugging");
-	DebugMan.addDebugChannel(kDebugLevelParser, "Parser", "Parser debugging");
-	DebugMan.addDebugChannel(kDebugLevelSaid, "Said", "Said specs debugging");
-	DebugMan.addDebugChannel(kDebugLevelFile, "File", "File I/O debugging");
-	DebugMan.addDebugChannel(kDebugLevelTime, "Time", "Time debugging");
-	DebugMan.addDebugChannel(kDebugLevelRoom, "Room", "Room number debugging");
-	DebugMan.addDebugChannel(kDebugLevelAvoidPath, "Pathfinding", "Pathfinding debugging");
-	DebugMan.addDebugChannel(kDebugLevelDclInflate, "DCL", "DCL inflate debugging");
-	DebugMan.addDebugChannel(kDebugLevelVM, "VM", "VM debugging");
-	DebugMan.addDebugChannel(kDebugLevelScripts, "Scripts", "Notifies when scripts are unloaded");
-	DebugMan.addDebugChannel(kDebugLevelPatcher, "Patcher", "Notifies when scripts or resources are patched");
-	DebugMan.addDebugChannel(kDebugLevelWorkarounds, "Workarounds", "Notifies when workarounds are triggered");
-	DebugMan.addDebugChannel(kDebugLevelVideo, "Video", "Video (SEQ, VMD, RBT) debugging");
-	DebugMan.addDebugChannel(kDebugLevelGame, "Game", "Debug calls from game scripts");
-	DebugMan.addDebugChannel(kDebugLevelGC, "GC", "Garbage Collector debugging");
-	DebugMan.addDebugChannel(kDebugLevelResMan, "ResMan", "Resource manager debugging");
-	DebugMan.addDebugChannel(kDebugLevelOnStartup, "OnStartup", "Enter debugger at start of game");
-	DebugMan.addDebugChannel(kDebugLevelDebugMode, "DebugMode", "Enable game debug mode at start of game");
-
 	const Common::FSNode gameDataDir(ConfMan.get("path"));
 
 	SearchMan.addSubDirectoryMatching(gameDataDir, "actors");	// KQ6 hi-res portraits


Commit: 17efb68cba919e9661c2a9bebfa6fdac6ce1a877
    https://github.com/scummvm/scummvm/commit/17efb68cba919e9661c2a9bebfa6fdac6ce1a877
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
SCUMM: move debug channels to metaEngineDetection

Changed paths:
    engines/scumm/detection.cpp
    engines/scumm/scumm.cpp


diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index 21f89b5e93..d04c837f0b 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -37,6 +37,7 @@
 #include "scumm/detection_tables.h"
 #include "scumm/file.h"
 #include "scumm/file_nes.h"
+#include "scumm/scumm.h"
 
 #pragma mark -
 #pragma mark --- Detection code ---
@@ -51,6 +52,18 @@
 #pragma mark --- Plugin code ---
 #pragma mark -
 
+static const DebugChannelDef debugFlagList[] = {
+		{Scumm::DEBUG_SCRIPTS, "SCRIPTS", "Track script execution"},
+		{Scumm::DEBUG_OPCODES, "OPCODES", "Track opcode execution"},
+		{Scumm::DEBUG_IMUSE, "IMUSE", "Track iMUSE events"},
+		{Scumm::DEBUG_RESOURCE, "RESOURCE", "Track resource loading/management"},
+		{Scumm::DEBUG_VARS, "VARS", "Track variable changes",},
+		{Scumm::DEBUG_ACTORS, "ACTORS", "Actor-related debug"},
+		{Scumm::DEBUG_SOUND, "SOUND", "Sound related debug"},
+		{Scumm::DEBUG_INSANE, "INSANE", "Track INSANE"},
+		{Scumm::DEBUG_SMUSH, "SMUSH", "Track SMUSH"},
+		{Scumm::DEBUG_MOONBASE_AI, "MOONBASEAI", "Track Moonbase AI"}
+};
 
 using namespace Scumm;
 
@@ -60,6 +73,10 @@ public:
 		return "scumm";
 	}
 
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
+
 	const char *getName() const override;
 	const char *getOriginalCopyright() const override;
 
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index cf264c0425..a95891ab40 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -102,20 +102,6 @@ struct dbgChannelDesc {
 };
 
 
-// Debug channel lookup table for Debugger console
-static const dbgChannelDesc debugChannels[] = {
-	{"SCRIPTS", "Track script execution", DEBUG_SCRIPTS},
-	{"OPCODES", "Track opcode execution", DEBUG_OPCODES},
-	{"IMUSE", "Track iMUSE events", DEBUG_IMUSE},
-	{"RESOURCE", "Track resource loading/management", DEBUG_RESOURCE},
-	{"VARS", "Track variable changes", DEBUG_VARS},
-	{"ACTORS", "Actor-related debug", DEBUG_ACTORS},
-	{"SOUND", "Sound related debug", DEBUG_SOUND},
-	{"INSANE", "Track INSANE", DEBUG_INSANE},
-	{"SMUSH", "Track SMUSH", DEBUG_SMUSH},
-	{"MOONBASEAI", "Track Moonbase AI", DEBUG_MOONBASE_AI}
-};
-
 ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
 	: Engine(syst),
 	  _game(dr.game),
@@ -619,10 +605,6 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
 		_herculesBuf = (byte *)malloc(kHercWidth * kHercHeight);
 	}
 
-	// Add debug levels
-	for (int i = 0; i < ARRAYSIZE(debugChannels); ++i)
-		DebugMan.addDebugChannel(debugChannels[i].flag,  debugChannels[i].channel, debugChannels[i].desc);
-
 #ifndef DISABLE_HELP
 	// Create custom GMM dialog providing a help subdialog
 	assert(!_mainMenuDialog);


Commit: 53dcc76913bc09920fa4eb048de2a73b550cac4c
    https://github.com/scummvm/scummvm/commit/53dcc76913bc09920fa4eb048de2a73b550cac4c
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
SHERLOCK: move debug channels to metaEngineDetection

Changed paths:
    engines/sherlock/detection.cpp
    engines/sherlock/sherlock.cpp


diff --git a/engines/sherlock/detection.cpp b/engines/sherlock/detection.cpp
index f226ed82bc..eacc99e25f 100644
--- a/engines/sherlock/detection.cpp
+++ b/engines/sherlock/detection.cpp
@@ -24,6 +24,7 @@
 #include "engines/advancedDetector.h"
 
 #include "sherlock/detection.h"
+#include "sherlock/sherlock.h"
 
 static const PlainGameDescriptor sherlockGames[] = {
 	{ "scalpel", "The Case of the Serrated Scalpel" },
@@ -31,6 +32,14 @@ static const PlainGameDescriptor sherlockGames[] = {
 	{0, 0}
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{Sherlock::kDebugLevelScript, "scripts", "Script debug level"},
+	{Sherlock::kDebugLevelAdLibDriver, "AdLib", "AdLib driver debugging"},
+	{Sherlock::kDebugLevelMT32Driver, "MT32", "MT32 driver debugging"},
+	{Sherlock::kDebugLevelMusic, "Music", "Music debugging"},
+	DEBUG_CHANNEL_END
+};
+
 
 #define GAMEOPTION_ORIGINAL_SAVES	GUIO_GAMEOPTIONS1
 #define GAMEOPTION_FADE_STYLE		GUIO_GAMEOPTIONS2
@@ -137,6 +146,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Sherlock (C) 1992-1996 Mythos Software, (C) 1992-1996 Electronic Arts";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 
diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp
index fa5e9daf56..60faa2ecf6 100644
--- a/engines/sherlock/sherlock.cpp
+++ b/engines/sherlock/sherlock.cpp
@@ -30,11 +30,6 @@ namespace Sherlock {
 
 SherlockEngine::SherlockEngine(OSystem *syst, const SherlockGameDescription *gameDesc) :
 		Engine(syst), _gameDescription(gameDesc), _randomSource("Sherlock") {
-	DebugMan.addDebugChannel(kDebugLevelScript,      "scripts", "Script debug level");
-	DebugMan.addDebugChannel(kDebugLevelAdLibDriver, "AdLib",   "AdLib driver debugging");
-	DebugMan.addDebugChannel(kDebugLevelMT32Driver,  "MT32",    "MT32 driver debugging");
-	DebugMan.addDebugChannel(kDebugLevelMusic,       "Music",   "Music debugging");
-
 	_animation = nullptr;
 	_debugger = nullptr;
 	_events = nullptr;


Commit: 554fb982ab44517980a33efc38d1f3f6897aef1f
    https://github.com/scummvm/scummvm/commit/554fb982ab44517980a33efc38d1f3f6897aef1f
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
SLUDGE: move debug channels to metaEngineDetection

Changed paths:
    engines/sludge/detection.cpp
    engines/sludge/sludge.cpp


diff --git a/engines/sludge/detection.cpp b/engines/sludge/detection.cpp
index de3b543895..5c99a96e87 100644
--- a/engines/sludge/detection.cpp
+++ b/engines/sludge/detection.cpp
@@ -24,7 +24,19 @@
 #include "engines/advancedDetector.h"
 
 #include "sludge/detection.h"
-
+#include "sludge/sludge.h"
+
+
+static const DebugChannelDef debugFlagList[] = {
+	{Sludge::kSludgeDebugFatal, "script", "Script debug level"},
+	{Sludge::kSludgeDebugDataLoad, "loading", "Data loading debug level"},
+	{Sludge::kSludgeDebugStackMachine, "stack", "Stack Machine debug level"},
+	{Sludge::kSludgeDebugBuiltin, "builtin", "Built-in debug level"},
+	{Sludge::kSludgeDebugGraphics, "graphics", "Graphics debug level"},
+	{Sludge::kSludgeDebugZBuffer, "zBuffer", "ZBuffer debug level"},
+	{Sludge::kSludgeDebugSound, "sound", "Sound debug level"},
+	DEBUG_CHANNEL_END
+};
 static const PlainGameDescriptor sludgeGames[] = {
 	{ "sludge",			"Sludge Game" },
 	{ "welcome",		"Welcome Example" },
@@ -81,6 +93,10 @@ public:
 		return "Sludge (C) 2000-2014 Hungry Software and contributors";
 	}
 
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
+
 	// for fall back detection
 	ADDetectedGame fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const override;
 };
diff --git a/engines/sludge/sludge.cpp b/engines/sludge/sludge.cpp
index b940afb074..703107883c 100644
--- a/engines/sludge/sludge.cpp
+++ b/engines/sludge/sludge.cpp
@@ -55,15 +55,6 @@ SludgeEngine::SludgeEngine(OSystem *syst, const SludgeGameDescription *gameDesc)
 	// register your random source
 	_rnd = new Common::RandomSource("sludge");
 
-	// Add debug channels
-	DebugMan.addDebugChannel(kSludgeDebugFatal, "script", "Script debug level");
-	DebugMan.addDebugChannel(kSludgeDebugDataLoad, "loading", "Data loading debug level");
-	DebugMan.addDebugChannel(kSludgeDebugStackMachine, "stack", "Stack Machine debug level");
-	DebugMan.addDebugChannel(kSludgeDebugBuiltin, "builtin", "Built-in debug level");
-	DebugMan.addDebugChannel(kSludgeDebugGraphics, "graphics", "Graphics debug level");
-	DebugMan.addDebugChannel(kSludgeDebugZBuffer, "zBuffer", "ZBuffer debug level");
-	DebugMan.addDebugChannel(kSludgeDebugSound, "sound", "Sound debug level");
-
 	//DebugMan.enableDebugChannel("loading");
 	//DebugMan.enableDebugChannel("builtin");
 


Commit: 0b070c9f062eac3952b833229d34a27e7bf632d1
    https://github.com/scummvm/scummvm/commit/0b070c9f062eac3952b833229d34a27e7bf632d1
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
STARK: move debug channels to metaEngineDetection

Changed paths:
    engines/stark/detection.cpp
    engines/stark/stark.cpp


diff --git a/engines/stark/detection.cpp b/engines/stark/detection.cpp
index 031ccd5079..e60aebe604 100644
--- a/engines/stark/detection.cpp
+++ b/engines/stark/detection.cpp
@@ -24,6 +24,8 @@
 
 #include "common/translation.h"
 
+#include "stark/debug.h"
+
 namespace Stark {
 
 static const PlainGameDescriptor starkGames[] = {
@@ -31,6 +33,16 @@ static const PlainGameDescriptor starkGames[] = {
 	{ nullptr, nullptr }
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{kDebugArchive, "Archive", "Debug the archive loading"},
+	{kDebugXMG, "XMG", "Debug the loading of XMG images"},
+	{kDebugXRC, "XRC", "Debug the loading of XRC resource trees"},
+	{kDebugModding, "Modding", "Debug the loading of modded assets"},
+	{kDebugAnimation, "Animation", "Debug the animation changes"},
+	{kDebugUnknown, "Unknown", "Debug unknown values on the data"},
+	DEBUG_CHANNEL_END
+};
+
 static const ADGameDescription gameDescriptions[] = {
 	// The Longest Journey
 	// English DVD
@@ -391,6 +403,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "(C) Funcom";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 } // End of namespace Stark
diff --git a/engines/stark/stark.cpp b/engines/stark/stark.cpp
index 893745d66a..e8ae24c5cb 100644
--- a/engines/stark/stark.cpp
+++ b/engines/stark/stark.cpp
@@ -63,13 +63,6 @@ StarkEngine::StarkEngine(OSystem *syst, const ADGameDescription *gameDesc) :
 		_frameLimiter(nullptr),
 		_gameDescription(gameDesc),
 		_lastClickTime(0) {
-	// Add the available debug channels
-	DebugMan.addDebugChannel(kDebugArchive, "Archive", "Debug the archive loading");
-	DebugMan.addDebugChannel(kDebugXMG, "XMG", "Debug the loading of XMG images");
-	DebugMan.addDebugChannel(kDebugXRC, "XRC", "Debug the loading of XRC resource trees");
-	DebugMan.addDebugChannel(kDebugModding, "Modding", "Debug the loading of modded assets");
-	DebugMan.addDebugChannel(kDebugAnimation, "Animation", "Debug the animation changes");
-	DebugMan.addDebugChannel(kDebugUnknown, "Unknown", "Debug unknown values on the data");
 
 	addModsToSearchPath();
 }


Commit: 2c93928e5f261f4296fb49c7a4b9e24646ee9f3d
    https://github.com/scummvm/scummvm/commit/2c93928e5f261f4296fb49c7a4b9e24646ee9f3d
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
STARTREK: move debug channels to metaEngineDetection

Changed paths:
    engines/startrek/detection.cpp
    engines/startrek/startrek.cpp


diff --git a/engines/startrek/detection.cpp b/engines/startrek/detection.cpp
index e91a8ef11e..c6e96d52d5 100644
--- a/engines/startrek/detection.cpp
+++ b/engines/startrek/detection.cpp
@@ -28,6 +28,7 @@
 #include "common/file.h"
 
 #include "startrek/detection.h"
+#include "startrek/startrek.h"
 
 static const PlainGameDescriptor starTrekGames[] = {
 	{"st25", "Star Trek: 25th Anniversary"},
@@ -35,6 +36,15 @@ static const PlainGameDescriptor starTrekGames[] = {
 	{0, 0}
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{StarTrek::kDebugSound, "sound", "Sound"},
+	{StarTrek::kDebugGraphics, "graphics", "Graphics"},
+	{StarTrek::kDebugSavegame, "savegame", "Savegames"},
+	{StarTrek::kDebugSpace, "space", "Space and Pseudo-3D"},
+	{StarTrek::kDebugGeneral, "general", "General"},
+	DEBUG_CHANNEL_END
+};
+
 
 namespace StarTrek {
 
@@ -334,6 +344,10 @@ public:
 	StarTrekMetaEngineDetection() : AdvancedMetaEngineDetection(StarTrek::gameDescriptions, sizeof(StarTrek::StarTrekGameDescription), starTrekGames) {
 	}
 
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
+
 	const char *getEngineId() const override {
 		return "startrek";
 	}
diff --git a/engines/startrek/startrek.cpp b/engines/startrek/startrek.cpp
index 4db9a85a7a..95763695c8 100644
--- a/engines/startrek/startrek.cpp
+++ b/engines/startrek/startrek.cpp
@@ -62,12 +62,6 @@ StarTrekEngine::StarTrekEngine(OSystem *syst, const StarTrekGameDescription *gam
 	else if (getGameType() == GType_STJR)
 		error("Star Trek: Judgment Rites is not yet supported");
 
-	DebugMan.addDebugChannel(kDebugSound, "sound", "Sound");
-	DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics");
-	DebugMan.addDebugChannel(kDebugSavegame, "savegame", "Savegames");
-	DebugMan.addDebugChannel(kDebugSpace, "space", "Space and Pseudo-3D");
-	DebugMan.addDebugChannel(kDebugGeneral, "general", "General");
-
 	_gfx = nullptr;
 	_activeMenu = nullptr;
 	_sound = nullptr;


Commit: 489d605cad442097484ed16eac7bb8401fdfbbbc
    https://github.com/scummvm/scummvm/commit/489d605cad442097484ed16eac7bb8401fdfbbbc
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
SUPERNOVA: move debug channels to metaEngineDetection

Changed paths:
    engines/supernova/detection.cpp
    engines/supernova/supernova.cpp


diff --git a/engines/supernova/detection.cpp b/engines/supernova/detection.cpp
index 3800f932cd..40c7a88acd 100644
--- a/engines/supernova/detection.cpp
+++ b/engines/supernova/detection.cpp
@@ -25,9 +25,15 @@
 #include "common/gui_options.h"
 #include "common/translation.h"
 #include "engines/advancedDetector.h"
+#include "supernova/supernova.h"
 
 #define GAMEOPTION_IMPROVED GUIO_GAMEOPTIONS1
 
+static const DebugChannelDef debugFlagList[] = {
+	{Supernova::kDebugGeneral, "general", "Supernova general debug channel"},
+	DEBUG_CHANNEL_END
+};
+
 static const ADExtraGuiOptionsMap optionsList[] = {
 	{
 		GAMEOPTION_IMPROVED,
@@ -117,6 +123,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Mission Supernova (C) 1994 Thomas and Steffen Dingel";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 
diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp
index 52e4a67911..be069d91ac 100644
--- a/engines/supernova/supernova.cpp
+++ b/engines/supernova/supernova.cpp
@@ -99,7 +99,6 @@ SupernovaEngine::SupernovaEngine(OSystem *syst)
 		_MSPart = 0;
 
 	_improved = ConfMan.getBool("improved");
-	DebugMan.addDebugChannel(kDebugGeneral, "general", "Supernova general debug channel");
 }
 
 SupernovaEngine::~SupernovaEngine() {


Commit: 3c283af377f55a1a82c39e9d94dd26f2bd1b7e7f
    https://github.com/scummvm/scummvm/commit/3c283af377f55a1a82c39e9d94dd26f2bd1b7e7f
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
SWORD25: move debug channels to metaEngineDetection

Changed paths:
    engines/sword25/detection.cpp
    engines/sword25/sword25.cpp


diff --git a/engines/sword25/detection.cpp b/engines/sword25/detection.cpp
index 21c1e6af0e..d98d214a55 100644
--- a/engines/sword25/detection.cpp
+++ b/engines/sword25/detection.cpp
@@ -26,12 +26,20 @@
 
 #include "sword25/detection.h"
 #include "sword25/detection_tables.h"
+#include "sword25/sword25.h"
 
 static const PlainGameDescriptor sword25Game[] = {
 	{"sword25", "Broken Sword 2.5"},
 	{0, 0}
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{Sword25::kDebugScript, "Script", "Script debug level"},
+	{Sword25::kDebugScript, "Scripts", "Script debug level"},
+	{Sword25::kDebugSound, "Sound", "Sound debug level"},
+	DEBUG_CHANNEL_END
+};
+
 static const char *directoryGlobs[] = {
 	"system", // Used by extracted dats
 	0
@@ -64,6 +72,10 @@ public:
 		return "Broken Sword 2.5 (C) Malte Thiesen, Daniel Queteschiner and Michael Elsdorfer";
 	}
 
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
+
 	const ExtraGuiOptions getExtraGuiOptions(const Common::String &target) const override;
 };
 
diff --git a/engines/sword25/sword25.cpp b/engines/sword25/sword25.cpp
index 88f6047999..9c5f6294c9 100644
--- a/engines/sword25/sword25.cpp
+++ b/engines/sword25/sword25.cpp
@@ -65,10 +65,6 @@ Sword25Engine::Sword25Engine(OSystem *syst, const ADGameDescription *gameDesc):
 	// Setup mixer
 	syncSoundSettings();
 
-	DebugMan.addDebugChannel(kDebugScript, "Script", "Script debug level");
-	DebugMan.addDebugChannel(kDebugScript, "Scripts", "Script debug level");
-	DebugMan.addDebugChannel(kDebugSound, "Sound", "Sound debug level");
-
 	setDebugger(new Sword25Console(this));
 }
 


Commit: 8c500c9675d0c1aa3c5512f848aa25091ea0898e
    https://github.com/scummvm/scummvm/commit/8c500c9675d0c1aa3c5512f848aa25091ea0898e
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
TEENAGENT: move debug channels to metaEngineDetection

Changed paths:
    engines/teenagent/detection.cpp
    engines/teenagent/teenagent.cpp


diff --git a/engines/teenagent/detection.cpp b/engines/teenagent/detection.cpp
index c39a4302d5..91386667d5 100644
--- a/engines/teenagent/detection.cpp
+++ b/engines/teenagent/detection.cpp
@@ -26,6 +26,22 @@
 #include "common/translation.h"
 
 #include "engines/advancedDetector.h"
+#include "teenagent/teenagent.h"
+
+static const DebugChannelDef debugFlagList[] = {
+	{TeenAgent::kDebugActor, "Actor", "Enable Actor Debug"},
+	{TeenAgent::kDebugAnimation, "Animation", "Enable Animation Debug"},
+	{TeenAgent::kDebugCallbacks, "Callbacks", "Enable Callbacks Debug"},
+	{TeenAgent::kDebugDialog, "Dialog", "Enable Dialog Debug"},
+	{TeenAgent::kDebugFont, "Font", "Enable Font Debug"},
+	{TeenAgent::kDebugInventory, "Inventory", "Enable Inventory Debug"},
+	{TeenAgent::kDebugMusic, "Music", "Enable Music Debug"},
+	{TeenAgent::kDebugObject, "Object", "Enable Object Debug"},
+	{TeenAgent::kDebugPack, "Pack", "Enable Pack Debug"},
+	{TeenAgent::kDebugScene, "Scene", "Enable Scene Debug"},
+	{TeenAgent::kDebugSurface, "Surface", "Enable Surface Debug"},
+	DEBUG_CHANNEL_END
+};
 
 static const PlainGameDescriptor teenAgentGames[] = {
 	{ "teenagent", "Teen Agent" },
@@ -203,6 +219,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "TEENAGENT (C) 1994 Metropolis";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(TEENAGENT_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, TeenAgentMetaEngineDetection);
diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp
index 6a7951c27c..1ee790f2c2 100644
--- a/engines/teenagent/teenagent.cpp
+++ b/engines/teenagent/teenagent.cpp
@@ -54,18 +54,6 @@ namespace TeenAgent {
 
 TeenAgentEngine::TeenAgentEngine(OSystem *system, const ADGameDescription *gd)
 	: Engine(system), _action(kActionNone), _gameDescription(gd), _rnd("teenagent") {
-	DebugMan.addDebugChannel(kDebugActor, "Actor", "Enable Actor Debug");
-	DebugMan.addDebugChannel(kDebugAnimation, "Animation", "Enable Animation Debug");
-	DebugMan.addDebugChannel(kDebugCallbacks, "Callbacks", "Enable Callbacks Debug");
-	DebugMan.addDebugChannel(kDebugDialog, "Dialog", "Enable Dialog Debug");
-	DebugMan.addDebugChannel(kDebugFont, "Font", "Enable Font Debug");
-	DebugMan.addDebugChannel(kDebugInventory, "Inventory", "Enable Inventory Debug");
-	DebugMan.addDebugChannel(kDebugMusic, "Music", "Enable Music Debug");
-	DebugMan.addDebugChannel(kDebugObject, "Object", "Enable Object Debug");
-	DebugMan.addDebugChannel(kDebugPack, "Pack", "Enable Pack Debug");
-	DebugMan.addDebugChannel(kDebugScene, "Scene", "Enable Scene Debug");
-	DebugMan.addDebugChannel(kDebugSurface, "Surface", "Enable Surface Debug");
-
 	music = new MusicPlayer(this);
 	dialog = new Dialog(this);
 	res = new Resources();


Commit: 32f66c21dd48e5c055b39c7df529b83bc0fa0071
    https://github.com/scummvm/scummvm/commit/32f66c21dd48e5c055b39c7df529b83bc0fa0071
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
TESTBED: move debug channels to metaEngineDetection

Changed paths:
    engines/testbed/detection.cpp
    engines/testbed/testbed.cpp


diff --git a/engines/testbed/detection.cpp b/engines/testbed/detection.cpp
index 042c24be06..cad946f753 100644
--- a/engines/testbed/detection.cpp
+++ b/engines/testbed/detection.cpp
@@ -23,12 +23,19 @@
 #include "engines/advancedDetector.h"
 
 #include "base/plugins.h"
+#include "testbed/testbed.h"
 
 static const PlainGameDescriptor testbed_setting[] = {
 	{ "testbed", "Testbed: The Backend Testing Framework" },
 	{ 0, 0 }
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{Testbed::kTestbedLogOutput, "LOG", "Log of test results generated by testbed"},
+	{Testbed::kTestbedEngineDebug, "Debug", "Engine-specific debug statements"},
+	DEBUG_CHANNEL_END
+};
+
 static const ADGameDescription testbedDescriptions[] = {
 	{
 		"testbed",
@@ -59,6 +66,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Copyright (C) ScummVM";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(TESTBED_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, TestbedMetaEngineDetection);
diff --git a/engines/testbed/testbed.cpp b/engines/testbed/testbed.cpp
index 7fbea21d36..2a600f6631 100644
--- a/engines/testbed/testbed.cpp
+++ b/engines/testbed/testbed.cpp
@@ -119,9 +119,6 @@ TestbedEngine::TestbedEngine(OSystem *syst)
 	if (gameRoot.exists()) {
 		SearchMan.addDirectory(gameRoot.getDisplayName(), gameRoot);
 	}
-
-	DebugMan.addDebugChannel(kTestbedLogOutput, "LOG", "Log of test results generated by testbed");
-	DebugMan.addDebugChannel(kTestbedEngineDebug, "Debug", "Engine-specific debug statements");
 	DebugMan.enableDebugChannel("LOG");
 
 	pushTestsuites(_testsuiteList);


Commit: bea68bb58c144173bb05de0118ca5d969c3d6d0f
    https://github.com/scummvm/scummvm/commit/bea68bb58c144173bb05de0118ca5d969c3d6d0f
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
TINSEL: move debug channels to metaEngineDetection

Changed paths:
    engines/tinsel/detection.cpp
    engines/tinsel/tinsel.cpp


diff --git a/engines/tinsel/detection.cpp b/engines/tinsel/detection.cpp
index b5a1e41913..4284eefdf2 100644
--- a/engines/tinsel/detection.cpp
+++ b/engines/tinsel/detection.cpp
@@ -27,6 +27,7 @@
 #include "common/md5.h"
 
 #include "tinsel/detection.h"
+#include "tinsel/tinsel.h"
 
 static const PlainGameDescriptor tinselGames[] = {
 	{"dw", "Discworld"},
@@ -35,6 +36,14 @@ static const PlainGameDescriptor tinselGames[] = {
 	{0, 0}
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{Tinsel::kTinselDebugAnimations, "animations", "Animations debugging"},
+	{Tinsel::kTinselDebugActions, "actions", "Actions debugging"},
+	{Tinsel::kTinselDebugSound, "sound", "Sound debugging"},
+	{Tinsel::kTinselDebugMusic, "music", "Music debugging"},
+	DEBUG_CHANNEL_END
+};
+
 #include "tinsel/detection_tables.h"
 
 class TinselMetaEngineDetection : public AdvancedMetaEngineDetection {
@@ -54,6 +63,10 @@ public:
 		return "Tinsel (C) Psygnosis";
 	}
 
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
+
 	ADDetectedGame fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const override;
 };
 
diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp
index b1207580d4..5381aca1d6 100644
--- a/engines/tinsel/tinsel.cpp
+++ b/engines/tinsel/tinsel.cpp
@@ -908,12 +908,6 @@ const char *const TinselEngine::_textFiles[][3] = {
 TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc) :
 		Engine(syst), _gameDescription(gameDesc), _random("tinsel"),
 		_sound(0), _midiMusic(0), _pcmMusic(0), _bmv(0) {
-	// Register debug flags
-	DebugMan.addDebugChannel(kTinselDebugAnimations, "animations", "Animations debugging");
-	DebugMan.addDebugChannel(kTinselDebugActions, "actions", "Actions debugging");
-	DebugMan.addDebugChannel(kTinselDebugSound, "sound", "Sound debugging");
-	DebugMan.addDebugChannel(kTinselDebugMusic, "music", "Music debugging");
-
 	_vm = this;
 
 	_gameId = 0;


Commit: 8905a28f893dc47d67768858b402aad59a69b648
    https://github.com/scummvm/scummvm/commit/8905a28f893dc47d67768858b402aad59a69b648
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
TITANIC: move debug channels to metaEngineDetection

Changed paths:
    engines/titanic/detection.cpp
    engines/titanic/titanic.cpp


diff --git a/engines/titanic/detection.cpp b/engines/titanic/detection.cpp
index 85b33325a7..307173fd7e 100644
--- a/engines/titanic/detection.cpp
+++ b/engines/titanic/detection.cpp
@@ -26,6 +26,15 @@
 #include "engines/advancedDetector.h"
 
 #include "titanic/detection.h"
+#include "titanic/debugger.h"
+
+static const DebugChannelDef debugFlagList[] = {
+	{Titanic::kDebugCore, "core", "Core engine debug level"},
+	{Titanic::kDebugScripts, "scripts", "Game scripts"},
+	{Titanic::kDebugGraphics, "graphics", "Graphics handling"},
+	{Titanic::kDebugStarfield, "starfield", "Starfield logic"},
+	DEBUG_CHANNEL_END
+};
 
 static const PlainGameDescriptor TitanicGames[] = {
 	{"titanic", "Starship Titanic"},
@@ -51,6 +60,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Starship Titanic (C) The Digital Village";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(TITANIC_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, TitanicMetaEngineDetection);
diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp
index 6afecacfc6..435f9f1885 100644
--- a/engines/titanic/titanic.cpp
+++ b/engines/titanic/titanic.cpp
@@ -69,12 +69,6 @@ TitanicEngine::TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDe
 	_script = nullptr;
 	CMusicRoom::_musicHandler = nullptr;
 	_loadSaveSlot = -1;
-
-	// Set up debug channels
-	DebugMan.addDebugChannel(kDebugCore, "core", "Core engine debug level");
-	DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts");
-	DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling");
-	DebugMan.addDebugChannel(kDebugStarfield, "starfield", "Starfield logic");
 }
 
 TitanicEngine::~TitanicEngine() {


Commit: f58b4c5e59966a6bfdfc95690728a9d12528e25a
    https://github.com/scummvm/scummvm/commit/f58b4c5e59966a6bfdfc95690728a9d12528e25a
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
TONY: move debug channels to metaEngineDetection

Changed paths:
    engines/tony/detection.cpp
    engines/tony/tony.cpp


diff --git a/engines/tony/detection.cpp b/engines/tony/detection.cpp
index 2132653a89..e3eaef688a 100644
--- a/engines/tony/detection.cpp
+++ b/engines/tony/detection.cpp
@@ -25,12 +25,21 @@
 #include "engines/advancedDetector.h"
 
 #include "tony/detection.h"
+#include "tony/tony.h"
 
 static const PlainGameDescriptor tonyGames[] = {
 	{"tony", "Tony Tough and the Night of Roasted Moths"},
 	{0, 0}
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{Tony::kTonyDebugAnimations, "animations", "Animations debugging"},
+	{Tony::kTonyDebugActions, "actions", "Actions debugging"},
+	{Tony::kTonyDebugSound, "sound", "Sound debugging"},
+	{Tony::kTonyDebugMusic, "music", "Music debugging"},
+	DEBUG_CHANNEL_END
+};
+
 #include "tony/detection_tables.h"
 
 static const char *const directoryGlobs[] = {
@@ -57,6 +66,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Tony Tough and the Night of Roasted Moths (C) Protonic Interactive";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(TONY_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, TonyMetaEngineDetection);
diff --git a/engines/tony/tony.cpp b/engines/tony/tony.cpp
index 5c0490c7de..880dddc9b1 100644
--- a/engines/tony/tony.cpp
+++ b/engines/tony/tony.cpp
@@ -45,10 +45,6 @@ TonyEngine::TonyEngine(OSystem *syst, const TonyGameDescription *gameDesc) : Eng
 
 	// Set the up the debugger
 	setDebugger(new Debugger());
-	DebugMan.addDebugChannel(kTonyDebugAnimations, "animations", "Animations debugging");
-	DebugMan.addDebugChannel(kTonyDebugActions, "actions", "Actions debugging");
-	DebugMan.addDebugChannel(kTonyDebugSound, "sound", "Sound debugging");
-	DebugMan.addDebugChannel(kTonyDebugMusic, "music", "Music debugging");
 
 	// Add folders to the search directory list
 	const Common::FSNode gameDataDir(ConfMan.get("path"));


Commit: b50b2251a4a6ce0ce5594837f2d903669d2a614d
    https://github.com/scummvm/scummvm/commit/b50b2251a4a6ce0ce5594837f2d903669d2a614d
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
TOON: move debug channels to metaEngineDetection

Changed paths:
    engines/toon/detection.cpp
    engines/toon/toon.cpp


diff --git a/engines/toon/detection.cpp b/engines/toon/detection.cpp
index c3a3e6b57a..880db46248 100644
--- a/engines/toon/detection.cpp
+++ b/engines/toon/detection.cpp
@@ -23,12 +23,29 @@
 #include "engines/advancedDetector.h"
 
 #include "base/plugins.h"
+#include "toon/toon.h"
 
 static const PlainGameDescriptor toonGames[] = {
 	{ "toon", "Toonstruck" },
 	{ 0, 0 }
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{Toon::kDebugAnim, "Anim", "Animation debug level"},
+	{Toon::kDebugCharacter, "Character", "Character debug level"},
+	{Toon::kDebugAudio, "Audio", "Audio debug level"},
+	{Toon::kDebugHotspot, "Hotspot", "Hotspot debug level"},
+	{Toon::kDebugFont, "Font", "Font debug level"},
+	{Toon::kDebugPath, "Path", "Path debug level"},
+	{Toon::kDebugMovie, "Movie", "Movie debug level"},
+	{Toon::kDebugPicture, "Picture", "Picture debug level"},
+	{Toon::kDebugResource, "Resource", "Resource debug level"},
+	{Toon::kDebugState, "State", "State debug level"},
+	{Toon::kDebugTools, "Tools", "Tools debug level"},
+	{Toon::kDebugText, "Text", "Text debug level"},
+	DEBUG_CHANNEL_END
+};
+
 namespace Toon {
 
 static const ADGameDescription gameDescriptions[] = {
@@ -152,6 +169,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Toonstruck (C) 1996 Virgin Interactive";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(TOON_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, ToonMetaEngineDetection);
diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp
index 375ecdf5fc..0bfe0b45bd 100644
--- a/engines/toon/toon.cpp
+++ b/engines/toon/toon.cpp
@@ -1162,19 +1162,6 @@ ToonEngine::ToonEngine(OSystem *syst, const ADGameDescription *gameDescription)
 	_useAlternativeFont = false;
 	_isDemo = _gameDescription->flags & ADGF_DEMO;
 
-	DebugMan.addDebugChannel(kDebugAnim, "Anim", "Animation debug level");
-	DebugMan.addDebugChannel(kDebugCharacter, "Character", "Character debug level");
-	DebugMan.addDebugChannel(kDebugAudio, "Audio", "Audio debug level");
-	DebugMan.addDebugChannel(kDebugHotspot, "Hotspot", "Hotspot debug level");
-	DebugMan.addDebugChannel(kDebugFont, "Font", "Font debug level");
-	DebugMan.addDebugChannel(kDebugPath, "Path", "Path debug level");
-	DebugMan.addDebugChannel(kDebugMovie, "Movie", "Movie debug level");
-	DebugMan.addDebugChannel(kDebugPicture, "Picture", "Picture debug level");
-	DebugMan.addDebugChannel(kDebugResource, "Resource", "Resource debug level");
-	DebugMan.addDebugChannel(kDebugState, "State", "State debug level");
-	DebugMan.addDebugChannel(kDebugTools, "Tools", "Tools debug level");
-	DebugMan.addDebugChannel(kDebugText, "Text", "Text debug level");
-
 	_resources = NULL;
 	_animationManager = NULL;
 	_moviePlayer = NULL;


Commit: f91930091b69a7ef3c5d320168b0979db464b124
    https://github.com/scummvm/scummvm/commit/f91930091b69a7ef3c5d320168b0979db464b124
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
TOUCHE: move debug channels to metaEngineDetection

Changed paths:
    engines/touche/detection.cpp
    engines/touche/touche.cpp


diff --git a/engines/touche/detection.cpp b/engines/touche/detection.cpp
index 96db953255..e793518a7b 100644
--- a/engines/touche/detection.cpp
+++ b/engines/touche/detection.cpp
@@ -23,12 +23,23 @@
 #include "engines/advancedDetector.h"
 
 #include "base/plugins.h"
+#include "touche/touche.h"
 
 static const PlainGameDescriptor toucheGames[] = {
 	{ "touche", "Touche: The Adventures of the Fifth Musketeer" },
 	{ 0, 0 }
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{Touche::kDebugEngine,   "Engine",   "Engine debug level"},
+	{Touche::kDebugGraphics, "Graphics", "Graphics debug level"},
+	{Touche::kDebugResource, "Resource", "Resource debug level"},
+	{Touche::kDebugOpcodes,  "Opcodes",  "Opcodes debug level"},
+	{Touche::kDebugMenu,     "Menu",     "Menu debug level"},
+	{Touche::kDebugCharset,  "Charset",   "Charset debug level"},
+	DEBUG_CHANNEL_END
+};
+
 namespace Touche {
 
 static const ADGameDescription gameDescriptions[] = {
@@ -142,6 +153,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Touche: The Adventures of the Fifth Musketeer (C) Clipper Software";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(TOUCHE_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, ToucheMetaEngineDetection);
diff --git a/engines/touche/touche.cpp b/engines/touche/touche.cpp
index 39fbed10d3..ed550df5b9 100644
--- a/engines/touche/touche.cpp
+++ b/engines/touche/touche.cpp
@@ -103,13 +103,6 @@ ToucheEngine::ToucheEngine(OSystem *system, Common::Language language)
 
 	SearchMan.addSubDirectoryMatching(gameDataDir, "database");
 
-	DebugMan.addDebugChannel(kDebugEngine,   "Engine",   "Engine debug level");
-	DebugMan.addDebugChannel(kDebugGraphics, "Graphics", "Graphics debug level");
-	DebugMan.addDebugChannel(kDebugResource, "Resource", "Resource debug level");
-	DebugMan.addDebugChannel(kDebugOpcodes,  "Opcodes",  "Opcodes debug level");
-	DebugMan.addDebugChannel(kDebugMenu,     "Menu",     "Menu debug level");
-	DebugMan.addDebugChannel(kDebugCharset,  "Charset",   "Charset debug level");
-
 	setDebugger(new ToucheConsole(this));
 
 	_newEpisodeNum = 0;


Commit: f1a242d44eff974ccbca55d4e6500f4982b6d52f
    https://github.com/scummvm/scummvm/commit/f1a242d44eff974ccbca55d4e6500f4982b6d52f
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
TSAGE: move debug channels to metaEngineDetection

Changed paths:
    engines/tsage/detection.cpp
    engines/tsage/tsage.cpp


diff --git a/engines/tsage/detection.cpp b/engines/tsage/detection.cpp
index ef9b932835..b4e70e92cb 100644
--- a/engines/tsage/detection.cpp
+++ b/engines/tsage/detection.cpp
@@ -25,6 +25,7 @@
 #include "base/plugins.h"
 
 #include "tsage/detection.h"
+#include "tsage/tsage.h"
 
 static const PlainGameDescriptor tSageGameTitles[] = {
 	{ "ringworld", "Ringworld: Revenge of the Patriarch" },
@@ -34,6 +35,11 @@ static const PlainGameDescriptor tSageGameTitles[] = {
 	{ 0, 0 }
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{TsAGE::kRingDebugScripts, "scripts", "Scripts debugging"},
+	DEBUG_CHANNEL_END
+};
+
 #include "tsage/detection_tables.h"
 
 class TSageMetaEngineDetection : public AdvancedMetaEngineDetection {
@@ -52,6 +58,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "(C) Tsunami Media";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(TSAGE_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, TSageMetaEngineDetection);
diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp
index fe99c91855..f3fd65156b 100644
--- a/engines/tsage/tsage.cpp
+++ b/engines/tsage/tsage.cpp
@@ -37,7 +37,6 @@ TSageEngine *g_vm = NULL;
 TSageEngine::TSageEngine(OSystem *system, const tSageGameDescription *gameDesc) : Engine(system),
 		_gameDescription(gameDesc) {
 	g_vm = this;
-	DebugMan.addDebugChannel(kRingDebugScripts, "scripts", "Scripts debugging");
 
 	if (g_vm->getGameID() == GType_Ringworld) {
 		if (g_vm->getFeatures() & GF_DEMO)


Commit: cad09bb63bd31ab7ce61b4385868daf5d5d04df4
    https://github.com/scummvm/scummvm/commit/cad09bb63bd31ab7ce61b4385868daf5d5d04df4
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
VOYEUR: move debug channels to metaEngineDetection

Changed paths:
    engines/voyeur/detection.cpp
    engines/voyeur/voyeur.cpp


diff --git a/engines/voyeur/detection.cpp b/engines/voyeur/detection.cpp
index 30011a62cd..db3a04c18b 100644
--- a/engines/voyeur/detection.cpp
+++ b/engines/voyeur/detection.cpp
@@ -26,12 +26,18 @@
 #include "common/memstream.h"
 #include "engines/advancedDetector.h"
 #include "voyeur/detection.h"
+#include "voyeur/voyeur.h"
 
 static const PlainGameDescriptor voyeurGames[] = {
 	{"voyeur", "Voyeur"},
 	{0, 0}
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{Voyeur::kDebugScripts, "scripts", "Game scripts"},
+	DEBUG_CHANNEL_END
+};
+
 #include "voyeur/detection_tables.h"
 
 class VoyeurMetaEngineDetection : public AdvancedMetaEngineDetection {
@@ -51,6 +57,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Voyeur (C) Philips P.O.V. Entertainment Group";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(VOYEUR_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, VoyeurMetaEngineDetection);
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 0219488b62..138722fdd2 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -63,8 +63,6 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
 	_voyeurArea = AREA_NONE;
 	_loadGameSlot = -1;
 
-	DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts");
-
 	_stampLibPtr = nullptr;
 	_controlGroupPtr = nullptr;
 	_stampData = nullptr;


Commit: a8afd02783b69431a68a5a675ec591c955a4c0ae
    https://github.com/scummvm/scummvm/commit/a8afd02783b69431a68a5a675ec591c955a4c0ae
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
WINTERMUTE: move debug channels to metaEngineDetection

Changed paths:
    engines/wintermute/detection.cpp
    engines/wintermute/wintermute.cpp


diff --git a/engines/wintermute/detection.cpp b/engines/wintermute/detection.cpp
index fa363c60e9..321fd40d4c 100644
--- a/engines/wintermute/detection.cpp
+++ b/engines/wintermute/detection.cpp
@@ -32,6 +32,17 @@
 
 #include "wintermute/detection.h"
 #include "wintermute/detection_tables.h"
+#include "wintermute/wintermute.h"
+
+static const DebugChannelDef debugFlagList[] = {
+	{Wintermute::kWintermuteDebugLog, "enginelog", "Covers the same output as the log-file in WME"},
+	{Wintermute::kWintermuteDebugSaveGame, "savegame", "Savegames"},
+	{Wintermute::kWintermuteDebugFont, "font", "Text-drawing-related messages"},
+	{Wintermute::kWintermuteDebugFileAccess, "file-access", "Non-critical problems like missing files"},
+	{Wintermute::kWintermuteDebugAudio, "audio", "audio-playback-related issues"},
+	{Wintermute::kWintermuteDebugGeneral, "general", "various issues not covered by any of the above"},
+	DEBUG_CHANNEL_END
+};
 
 namespace Wintermute {
 
@@ -89,6 +100,10 @@ public:
 		return "Copyright (C) 2011 Jan Nedoma";
 	}
 
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
+
 	ADDetectedGame fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const override {
 		/**
 		 * Fallback detection for Wintermute heavily depends on engine resources, so it's not possible
diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp
index 22bf6275c6..dc106d229c 100644
--- a/engines/wintermute/wintermute.cpp
+++ b/engines/wintermute/wintermute.cpp
@@ -71,14 +71,6 @@ WintermuteEngine::WintermuteEngine(OSystem *syst, const WMEGameDescription *desc
 	const Common::FSNode gameDataDir(ConfMan.get("path"));
 	//SearchMan.addSubDirectoryMatching(gameDataDir, "sound");
 
-	// Here is the right place to set up the engine specific debug channels
-	DebugMan.addDebugChannel(kWintermuteDebugLog, "enginelog", "Covers the same output as the log-file in WME");
-	DebugMan.addDebugChannel(kWintermuteDebugSaveGame, "savegame", "Savegames");
-	DebugMan.addDebugChannel(kWintermuteDebugFont, "font", "Text-drawing-related messages");
-	DebugMan.addDebugChannel(kWintermuteDebugFileAccess, "file-access", "Non-critical problems like missing files");
-	DebugMan.addDebugChannel(kWintermuteDebugAudio, "audio", "audio-playback-related issues");
-	DebugMan.addDebugChannel(kWintermuteDebugGeneral, "general", "various issues not covered by any of the above");
-
 	_game = nullptr;
 	_debugger = nullptr;
 	_dbgController = nullptr;


Commit: 5bdaf49328df3ea4a5d7c0782bfeea9ae8698c56
    https://github.com/scummvm/scummvm/commit/5bdaf49328df3ea4a5d7c0782bfeea9ae8698c56
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
XEEN: move debug channels to metaEngineDetection

Changed paths:
    engines/xeen/detection.cpp
    engines/xeen/xeen.cpp


diff --git a/engines/xeen/detection.cpp b/engines/xeen/detection.cpp
index 1378ae2b04..60a7737804 100644
--- a/engines/xeen/detection.cpp
+++ b/engines/xeen/detection.cpp
@@ -25,6 +25,7 @@
 #include "common/translation.h"
 
 #include "xeen/detection.h"
+#include "xeen/xeen.h"
 
 static const PlainGameDescriptor XeenGames[] = {
 	{ "cloudsofxeen", "Might and Magic IV: Clouds of Xeen" },
@@ -34,6 +35,14 @@ static const PlainGameDescriptor XeenGames[] = {
 	{0, 0}
 };
 
+static const DebugChannelDef debugFlagList[] = {
+	{Xeen::kDebugPath, "Path", "Pathfinding debug level"},
+	{Xeen::kDebugScripts, "scripts", "Game scripts"},
+	{Xeen::kDebugGraphics, "graphics", "Graphics handling"},
+	{Xeen::kDebugSound, "sound", "Sound processing"},
+	DEBUG_CHANNEL_END
+};
+
 #define GAMEOPTION_SHOW_ITEM_COSTS	GUIO_GAMEOPTIONS1
 #define GAMEOPTION_DURABLE_ARMOR	GUIO_GAMEOPTIONS2
 
@@ -82,6 +91,10 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Xeen (C) 1992-1993 New World Computing, Inc.";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(XEEN_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, XeenMetaEngineDetection);
diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp
index eda132c9a5..f568a38d2e 100644
--- a/engines/xeen/xeen.cpp
+++ b/engines/xeen/xeen.cpp
@@ -35,11 +35,6 @@ XeenEngine *g_vm = nullptr;
 
 XeenEngine::XeenEngine(OSystem *syst, const XeenGameDescription *gameDesc)
 		: Engine(syst), _gameDescription(gameDesc), _randomSource("Xeen") {
-	// Set up debug channels
-	DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
-	DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts");
-	DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling");
-	DebugMan.addDebugChannel(kDebugSound, "sound", "Sound processing");
 
 	_combat = nullptr;
 	_debugger = nullptr;


Commit: b41b540a03600a5ee2a35af7db5267d303fcf7da
    https://github.com/scummvm/scummvm/commit/b41b540a03600a5ee2a35af7db5267d303fcf7da
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
AGI: delete adding debug channels in preagi

Changed paths:
    engines/agi/preagi.cpp


diff --git a/engines/agi/preagi.cpp b/engines/agi/preagi.cpp
index 320c53416f..5a3c53fec9 100644
--- a/engines/agi/preagi.cpp
+++ b/engines/agi/preagi.cpp
@@ -37,17 +37,6 @@ PreAgiEngine::PreAgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) :
 	// Setup mixer
 	syncSoundSettings();
 
-	DebugMan.addDebugChannel(kDebugLevelMain, "Main", "Generic debug level");
-	DebugMan.addDebugChannel(kDebugLevelResources, "Resources", "Resources debugging");
-	DebugMan.addDebugChannel(kDebugLevelSprites, "Sprites", "Sprites debugging");
-	DebugMan.addDebugChannel(kDebugLevelInventory, "Inventory", "Inventory debugging");
-	DebugMan.addDebugChannel(kDebugLevelInput, "Input", "Input events debugging");
-	DebugMan.addDebugChannel(kDebugLevelMenu, "Menu", "Menu debugging");
-	DebugMan.addDebugChannel(kDebugLevelScripts, "Scripts", "Scripts debugging");
-	DebugMan.addDebugChannel(kDebugLevelSound, "Sound", "Sound debugging");
-	DebugMan.addDebugChannel(kDebugLevelText, "Text", "Text output debugging");
-	DebugMan.addDebugChannel(kDebugLevelSavegame, "Savegame", "Saving & restoring game debugging");
-
 	memset(&_debug, 0, sizeof(struct AgiDebug));
 
 	_speakerHandle = new Audio::SoundHandle();


Commit: dd14b7b34a4409e40a4bef04a8b649501c254872
    https://github.com/scummvm/scummvm/commit/dd14b7b34a4409e40a4bef04a8b649501c254872
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
GRIM: move debug flags to metaEngineDetection

Changed paths:
    engines/grim/debug.cpp
    engines/grim/detection.cpp
    engines/grim/grim.cpp


diff --git a/engines/grim/debug.cpp b/engines/grim/debug.cpp
index b1d0beb562..0f51252ff1 100644
--- a/engines/grim/debug.cpp
+++ b/engines/grim/debug.cpp
@@ -27,26 +27,6 @@
 namespace Grim {
 
 void Debug::registerDebugChannels() {
-	DebugMan.addDebugChannel(Info, "info", "");
-	DebugMan.addDebugChannel(Warning, "warning", "");
-	DebugMan.addDebugChannel(Error, "error", "");
-	DebugMan.addDebugChannel(Engine, "engine", "");
-	DebugMan.addDebugChannel(Lua, "lua", "");
-	DebugMan.addDebugChannel(Bitmaps, "bitmaps", "");
-	DebugMan.addDebugChannel(Models, "models", "");
-	DebugMan.addDebugChannel(Actors, "actors", "");
-	DebugMan.addDebugChannel(Costumes, "costumes", "");
-	DebugMan.addDebugChannel(Chores, "chores", "");
-	DebugMan.addDebugChannel(Fonts, "fonts", "");
-	DebugMan.addDebugChannel(Keyframes, "keyframes", "");
-	DebugMan.addDebugChannel(Movie, "movie", "");
-	DebugMan.addDebugChannel(Sound, "sound", "");
-	DebugMan.addDebugChannel(Scripts, "scripts", "");
-	DebugMan.addDebugChannel(Sets, "sets", "");
-	DebugMan.addDebugChannel(TextObjects, "textobjects", "");
-	DebugMan.addDebugChannel(Patchr, "patchr", "");
-	DebugMan.addDebugChannel(Lipsync, "lipsync", "");
-	DebugMan.addDebugChannel(Sprites, "sprites", "");
 }
 
 bool Debug::isChannelEnabled(DebugChannel chan) {
diff --git a/engines/grim/detection.cpp b/engines/grim/detection.cpp
index 30f0138b02..135e4bece8 100644
--- a/engines/grim/detection.cpp
+++ b/engines/grim/detection.cpp
@@ -24,6 +24,31 @@
 #include "engines/grim/detection.h"
 
 #include "common/translation.h"
+#include "engines/grim/debug.h"
+
+static const DebugChannelDef debugFlagList[] = {
+	{Grim::Debug::Info, "info", ""},
+	{Grim::Debug::Warning, "warning", ""},
+	{Grim::Debug::Error, "error", ""},
+	{Grim::Debug::Engine, "engine", ""},
+	{Grim::Debug::Lua, "lua", ""},
+	{Grim::Debug::Bitmaps, "bitmaps", ""},
+	{Grim::Debug::Models, "models", ""},
+	{Grim::Debug::Actors, "actors", ""},
+	{Grim::Debug::Costumes, "costumes", ""},
+	{Grim::Debug::Chores, "chores", ""},
+	{Grim::Debug::Fonts, "fonts", ""},
+	{Grim::Debug::Keyframes, "keyframes", ""},
+	{Grim::Debug::Movie, "movie", ""},
+	{Grim::Debug::Sound, "sound", ""},
+	{Grim::Debug::Scripts, "scripts", ""},
+	{Grim::Debug::Sets, "sets", ""},
+	{Grim::Debug::TextObjects, "textobjects", ""},
+	{Grim::Debug::Patchr, "patchr", ""},
+	{Grim::Debug::Lipsync, "lipsync", ""},
+	{Grim::Debug::Sprites, "sprites", ""},
+	DEBUG_CHANNEL_END
+};
 
 namespace Grim {
 
@@ -598,6 +623,10 @@ public:
 		return "LucasArts GrimE Games (C) LucasArts";
 	}
 
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
+
 };
 
 } // End of namespace Grim
diff --git a/engines/grim/grim.cpp b/engines/grim/grim.cpp
index 0a8a538da9..4672e69617 100644
--- a/engines/grim/grim.cpp
+++ b/engines/grim/grim.cpp
@@ -186,8 +186,6 @@ GrimEngine::GrimEngine(OSystem *syst, uint32 gameFlags, GrimGameType gameType, C
 	SearchMan.addSubDirectoryMatching(gameDataDir, "credits");
 	SearchMan.addSubDirectoryMatching(gameDataDir, "widescreen");
 
-	Debug::registerDebugChannels();
-
 
 	//Remastered:
 	if (getGameFlags() & ADGF_REMASTERED) {


Commit: 5feac6bdff632fb06fabf7e2f5fbad406f8423d7
    https://github.com/scummvm/scummvm/commit/5feac6bdff632fb06fabf7e2f5fbad406f8423d7
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
BASE: add list-all-debugflags and list-debugflags to commandLine

Changed paths:
    base/commandLine.cpp
    engines/metaengine.h


diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index f71b75859b..bb6a143bc2 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -546,6 +546,12 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha
 			DO_LONG_COMMAND("list-all-games")
 			END_COMMAND
 
+			DO_LONG_COMMAND("list-all-debugflags")
+			END_COMMAND
+
+			DO_LONG_COMMAND("list-debugflags")
+			END_COMMAND
+
 			DO_LONG_COMMAND("list-engines")
 			END_COMMAND
 
@@ -944,6 +950,33 @@ static void listTargets() {
 		printf("%s\n", i->c_str());
 }
 
+static void printDebugFlags(const DebugChannelDef *debugChannels) {
+	if (!debugChannels)
+		return;
+	for (uint i = 0; debugChannels[i].channel != 0; i++) {
+		printf("%-15s %s\n", debugChannels[i].name, debugChannels[i].description);
+	}
+}
+
+/** List global debug flags*/
+static void listGlobalDebugFlags() {
+	printDebugFlags(globalDebugChannels);
+}
+
+/** List all engine specified debug channels */
+static void listAllEngineDebugFlags() {
+	printf("Flag name       Flag description                                           \n");
+
+	const PluginList &plugins = EngineMan.getPlugins();
+	for (PluginList::const_iterator iter = plugins.begin(); iter != plugins.end(); ++iter) {
+		const MetaEngineDetection &metaEngine = (*iter)->get<MetaEngineDetection>();
+		printf("--------------- ------------------------------------------------------\n");
+		printf("ID=%-12s Name=%s\n", metaEngine.getEngineId(), metaEngine.getName());
+		printDebugFlags(metaEngine.getDebugChannels());
+	}
+
+}
+
 /** List all saves states for the given target. */
 static Common::Error listSaves(const Common::String &singleTarget) {
 	Common::Error result = Common::kNoError;
@@ -1427,6 +1460,12 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
 	if (command == "list-targets") {
 		listTargets();
 		return true;
+	} else if (command == "list-all-debugflags") {
+		listAllEngineDebugFlags();
+		return true;
+	} else if (command == "list-debugflags") {
+		listGlobalDebugFlags();
+		return true;
 	} else if (command == "list-games") {
 		listGames();
 		return true;
diff --git a/engines/metaengine.h b/engines/metaengine.h
index 401b939026..e5604903f5 100644
--- a/engines/metaengine.h
+++ b/engines/metaengine.h
@@ -171,7 +171,6 @@ public:
 	}
 
 	virtual const DebugChannelDef *getDebugChannels() const {
-		warning("Using the default implementation of getDebugChannels");
 		return NULL;
 	}
 


Commit: d147ab855f30a3453f83bff946af50f05afa517c
    https://github.com/scummvm/scummvm/commit/d147ab855f30a3453f83bff946af50f05afa517c
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
BASE: add listing the engine specified debugflags in commandline

Changed paths:
    base/commandLine.cpp


diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index bb6a143bc2..4c6face6ec 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -549,8 +549,10 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha
 			DO_LONG_COMMAND("list-all-debugflags")
 			END_COMMAND
 
-			DO_LONG_COMMAND("list-debugflags")
-			END_COMMAND
+			DO_OPTION_OPT(0, "list-debugflags", "global")
+				ensureFirstCommand(command, "list-debugflags");
+				command = "list-debugflags";
+			END_OPTION
 
 			DO_LONG_COMMAND("list-engines")
 			END_COMMAND
@@ -958,9 +960,24 @@ static void printDebugFlags(const DebugChannelDef *debugChannels) {
 	}
 }
 
-/** List global debug flags*/
-static void listGlobalDebugFlags() {
-	printDebugFlags(globalDebugChannels);
+/** List debug flags*/
+static void listDebugFlags(const Common::String &engineID) {
+	if (engineID == "global")
+		printDebugFlags(globalDebugChannels);
+	else {
+		const PluginList &plugins = EngineMan.getPlugins();
+		for (PluginList::const_iterator iter = plugins.begin(); iter != plugins.end(); ++iter) {
+			const MetaEngineDetection &metaEngine = (*iter)->get<MetaEngineDetection>();
+			if (metaEngine.getEngineId() == engineID) {
+				printf("Flag name       Flag description                                           \n");
+				printf("--------------- ------------------------------------------------------\n");
+				printf("ID=%-12s Name=%s\n", metaEngine.getEngineId(), metaEngine.getName());
+				printDebugFlags(metaEngine.getDebugChannels());
+				return;
+			}
+		}
+		printf("Cannot find engine %s\n", engineID.c_str());
+	}
 }
 
 /** List all engine specified debug channels */
@@ -1464,7 +1481,7 @@ bool processSettings(Common::String &command, Common::StringMap &settings, Commo
 		listAllEngineDebugFlags();
 		return true;
 	} else if (command == "list-debugflags") {
-		listGlobalDebugFlags();
+		listDebugFlags(settings["list-debugflags"]);
 		return true;
 	} else if (command == "list-games") {
 		listGames();


Commit: 649661a6da4231ddd30b5406c370aa474d87f4f6
    https://github.com/scummvm/scummvm/commit/649661a6da4231ddd30b5406c370aa474d87f4f6
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
BASE: add clarification for list-debugflags when typing help

Changed paths:
    base/commandLine.cpp


diff --git a/base/commandLine.cpp b/base/commandLine.cpp
index 4c6face6ec..8b49072092 100644
--- a/base/commandLine.cpp
+++ b/base/commandLine.cpp
@@ -73,6 +73,9 @@ static const char HELP_STRING[] =
 	"  -t, --list-targets       Display list of configured targets and exit\n"
 	"  --list-engines           Display list of suppported engines and exit\n"
 	"  --list-all-engines       Display list of all detection engines and exit\n"
+	"  --list-debugflags=engine Display list of engine specified debugflags\n"
+	"                           if engine=global or engine is not specified, then it will list global debugflags\n"
+	"  --list-all-debugflags    Display list of all engine specified debugflags\n"
 	"  --list-saves             Display a list of saved games for the target specified\n"
 	"                           with --game=TARGET, or all targets if none is specified\n"
 	"  -a, --add                Add all games from current or specified directory.\n"


Commit: 6d1aece1a80a419bfc5534ade85d1073660b3a0e
    https://github.com/scummvm/scummvm/commit/6d1aece1a80a419bfc5534ade85d1073660b3a0e
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
COMMON: remove kDebugGlobalTest flag

Changed paths:
    common/debug.h


diff --git a/common/debug.h b/common/debug.h
index a971bc5ef3..d2a464b8ae 100644
--- a/common/debug.h
+++ b/common/debug.h
@@ -162,12 +162,10 @@ extern bool gDebugChannelsOnly;
 
 /** Global constant for EventRecorder debug channel. */
 enum GlobalDebugLevels {
-	kDebugLevelEventRec = 1 << 30,
-	kDebugGlobalTest = 1 << 29
+	kDebugLevelEventRec = 1 << 30
 };
 
 static const DebugChannelDef globalDebugChannels[] = {
-	{kDebugGlobalTest, "test", "test global debug flag"},
 	{kDebugLevelEventRec, "EventRec", "Event recorder debug level"},
 	DEBUG_CHANNEL_END
 };


Commit: 361c723e8aabadae9fca2a3373671ac47f4807c6
    https://github.com/scummvm/scummvm/commit/361c723e8aabadae9fca2a3373671ac47f4807c6
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
ENGINE: introduce kDebugGlobalDetection which is used for print debug messages of advancedDetector

Changed paths:
    common/debug.h
    engines/advancedDetector.cpp


diff --git a/common/debug.h b/common/debug.h
index d2a464b8ae..d300f15ac7 100644
--- a/common/debug.h
+++ b/common/debug.h
@@ -162,11 +162,13 @@ extern bool gDebugChannelsOnly;
 
 /** Global constant for EventRecorder debug channel. */
 enum GlobalDebugLevels {
+	kDebugGlobalDetection = 1 << 29,
 	kDebugLevelEventRec = 1 << 30
 };
 
 static const DebugChannelDef globalDebugChannels[] = {
 	{kDebugLevelEventRec, "EventRec", "Event recorder debug level"},
+	{kDebugGlobalDetection, "Detection", "debug messages for advancedDetector"},
 	DEBUG_CHANNEL_END
 };
 
diff --git a/engines/advancedDetector.cpp b/engines/advancedDetector.cpp
index c6e42f7702..57a29bf981 100644
--- a/engines/advancedDetector.cpp
+++ b/engines/advancedDetector.cpp
@@ -391,7 +391,7 @@ Common::Error AdvancedMetaEngineDetection::createInstance(OSystem *syst, Engine
 		return Common::kUserCanceled;
 	}
 
-	debug(2, "Running %s", gameDescriptor.description.c_str());
+	debugC(2, kDebugGlobalDetection, "Running %s", gameDescriptor.description.c_str());
 	initSubSystems(agdDesc.desc);
 
 	PluginList pl = EngineMan.getPlugins(PLUGIN_TYPE_ENGINE);
@@ -541,7 +541,7 @@ ADDetectedGames AdvancedMetaEngineDetection::detectGame(const Common::FSNode &pa
 	const ADGameDescription *g;
 	const byte *descPtr;
 
-	debug(3, "Starting detection in dir '%s'", parent.getPath().c_str());
+	debugC(3, kDebugGlobalDetection, "Starting detection in dir '%s'", parent.getPath().c_str());
 
 	// Check which files are included in some ADGameDescription *and* whether
 	// they are present. Compute MD5s and file sizes for the available files.
@@ -556,7 +556,7 @@ ADDetectedGames AdvancedMetaEngineDetection::detectGame(const Common::FSNode &pa
 
 			FileProperties tmp;
 			if (getFileProperties(allFiles, *g, fname, tmp)) {
-				debug(3, "> '%s': '%s'", fname.c_str(), tmp.md5.c_str());
+				debugC(3, kDebugGlobalDetection, "> '%s': '%s'", fname.c_str(), tmp.md5.c_str());
 			}
 
 			// Both positive and negative results are cached to avoid
@@ -603,18 +603,18 @@ ADDetectedGames AdvancedMetaEngineDetection::detectGame(const Common::FSNode &pa
 				continue;
 
 			if (fileDesc->md5 != nullptr && fileDesc->md5 != filesProps[tstr].md5) {
-				debug(3, "MD5 Mismatch. Skipping (%s) (%s)", fileDesc->md5, filesProps[tstr].md5.c_str());
+				debugC(3, kDebugGlobalDetection, "MD5 Mismatch. Skipping (%s) (%s)", fileDesc->md5, filesProps[tstr].md5.c_str());
 				game.hasUnknownFiles = true;
 				continue;
 			}
 
 			if (fileDesc->fileSize != -1 && fileDesc->fileSize != filesProps[tstr].size) {
-				debug(3, "Size Mismatch. Skipping");
+				debugC(3, kDebugGlobalDetection, "Size Mismatch. Skipping");
 				game.hasUnknownFiles = true;
 				continue;
 			}
 
-			debug(3, "Matched file: %s", tstr.c_str());
+			debugC(3, kDebugGlobalDetection, "Matched file: %s", tstr.c_str());
 			curFilesMatched++;
 		}
 
@@ -633,11 +633,11 @@ ADDetectedGames AdvancedMetaEngineDetection::detectGame(const Common::FSNode &pa
 		}
 
 		if (allFilesPresent && !game.hasUnknownFiles) {
-			debug(2, "Found game: %s (%s %s/%s) (%d)", g->gameId, g->extra,
+			debugC(2, kDebugGlobalDetection, "Found game: %s (%s %s/%s) (%d)", g->gameId, g->extra,
 			 getPlatformDescription(g->platform), getLanguageDescription(g->language), i);
 
 			if (curFilesMatched > maxFilesMatched) {
-				debug(2, " ... new best match, removing all previous candidates");
+				debugC(2, kDebugGlobalDetection, " ... new best match, removing all previous candidates");
 				maxFilesMatched = curFilesMatched;
 
 				matched.clear();	// Remove any prior, lower ranked matches.
@@ -645,12 +645,12 @@ ADDetectedGames AdvancedMetaEngineDetection::detectGame(const Common::FSNode &pa
 			} else if (curFilesMatched == maxFilesMatched) {
 				matched.push_back(game);
 			} else {
-				debug(2, " ... skipped");
+				debugC(2, kDebugGlobalDetection, " ... skipped");
 			}
 
 			gotAnyMatchesWithAllFiles = true;
 		} else {
-			debug(5, "Skipping game: %s (%s %s/%s) (%d)", g->gameId, g->extra,
+			debugC(5, kDebugGlobalDetection, "Skipping game: %s (%s %s/%s) (%d)", g->gameId, g->extra,
 			 getPlatformDescription(g->platform), getLanguageDescription(g->language), i);
 		}
 	}
@@ -671,7 +671,7 @@ ADDetectedGame AdvancedMetaEngineDetection::detectGameFilebased(const FileMap &a
 		bool fileMissing = false;
 
 		for (filenames = ptr->filenames; *filenames; ++filenames) {
-			debug(3, "++ %s", *filenames);
+			debugC(3, kDebugGlobalDetection, "++ %s", *filenames);
 			if (!allFiles.contains(*filenames)) {
 				fileMissing = true;
 				break;
@@ -681,12 +681,12 @@ ADDetectedGame AdvancedMetaEngineDetection::detectGameFilebased(const FileMap &a
 		}
 
 		if (!fileMissing) {
-			debug(4, "Matched: %s", agdesc->gameId);
+			debugC(4, kDebugGlobalDetection, "Matched: %s", agdesc->gameId);
 
 			if (numMatchedFiles > maxNumMatchedFiles) {
 				maxNumMatchedFiles = numMatchedFiles;
 
-				debug(4, "and overridden");
+				debugC(4, kDebugGlobalDetection, "and overridden");
 
 				ADDetectedGame game(agdesc);
 				game.hasUnknownFiles = true;


Commit: d7dfc152292ec98bb84835a678c8fd189a12dc03
    https://github.com/scummvm/scummvm/commit/d7dfc152292ec98bb84835a678c8fd189a12dc03
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
DIRECTOR: fix code style problem

Changed paths:
    engines/director/detection.cpp


diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index 82009282d8..1c225f47f6 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -187,7 +187,7 @@ static const char *directoryGlobs[] = {
 	0
 };
 
-static DebugChannelDef debugFlagList[] = {
+static const DebugChannelDef debugFlagList[] = {
 	{Director::kDebugCompile, "compile", "Lingo Compilation"},
 	{Director::kDebugCompileOnly, "compileonly", "Skip Lingo code execution"},
 	{Director::kDebugDesktop, "desktop", "Show the Classic Mac desktop"},


Commit: 5f74ffcf0ada9e44a556cb8c002f69f6b97ea631
    https://github.com/scummvm/scummvm/commit/5f74ffcf0ada9e44a556cb8c002f69f6b97ea631
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
ADL: move debug messages in detection into kDebugGlobalDetection channel

Changed paths:
    engines/adl/detection.cpp


diff --git a/engines/adl/detection.cpp b/engines/adl/detection.cpp
index 6372dfd485..5fab9057c7 100644
--- a/engines/adl/detection.cpp
+++ b/engines/adl/detection.cpp
@@ -364,7 +364,7 @@ bool AdlMetaEngineDetection::addFileProps(const FileMap &allFiles, Common::Strin
 	fileProps.size = computeMD5(allFiles[fname], fileProps.md5, 16384);
 
 	if (fileProps.size != -1) {
-		debug(3, "> '%s': '%s'", fname.c_str(), fileProps.md5.c_str());
+		debugC(3, kDebugGlobalDetection, "> '%s': '%s'", fname.c_str(), fileProps.md5.c_str());
 		filePropsMap[fname] = fileProps;
 	}
 
@@ -379,7 +379,7 @@ ADDetectedGames AdlMetaEngineDetection::detectGame(const Common::FSNode &parent,
 	if (!matched.empty())
 		return matched;
 
-	debug(3, "Starting disk image detection in dir '%s'", parent.getPath().c_str());
+	debugC(3, kDebugGlobalDetection, "Starting disk image detection in dir '%s'", parent.getPath().c_str());
 
 	FilePropertiesMap filesProps;
 
@@ -433,30 +433,30 @@ ADDetectedGames AdlMetaEngineDetection::detectGame(const Common::FSNode &parent,
 				continue;
 
 			if (fDesc.md5 && fDesc.md5 != filesProps[fileName].md5) {
-				debug(3, "MD5 Mismatch. Skipping (%s) (%s)", fDesc.md5, filesProps[fileName].md5.c_str());
+				debugC(3, kDebugGlobalDetection, "MD5 Mismatch. Skipping (%s) (%s)", fDesc.md5, filesProps[fileName].md5.c_str());
 				game.hasUnknownFiles = true;
 				continue;
 			}
 
 			if (fDesc.fileSize != -1 && fDesc.fileSize != filesProps[fileName].size) {
-				debug(3, "Size Mismatch. Skipping");
+				debugC(3, kDebugGlobalDetection, "Size Mismatch. Skipping");
 				game.hasUnknownFiles = true;
 				continue;
 			}
 
-			debug(3, "Matched file: %s", fileName.c_str());
+			debugC(3, kDebugGlobalDetection, "Matched file: %s", fileName.c_str());
 		}
 
 		// This assumes that the detection table groups together games that have the same gameId and platform
 		if (allFilesPresent) {
 			if (!game.hasUnknownFiles) {
-				debug(2, "Found game: %s (%s/%s) (%d)", game.desc->gameId, getPlatformDescription(game.desc->platform), getLanguageDescription(game.desc->language), g);
+				debugC(2, kDebugGlobalDetection, "Found game: %s (%s/%s) (%d)", game.desc->gameId, getPlatformDescription(game.desc->platform), getLanguageDescription(game.desc->language), g);
 				// If we just added an unknown variant for this game and platform, remove it
 				if (!matched.empty() && strcmp(matched.back().desc->gameId, game.desc->gameId) == 0 && matched.back().desc->platform == game.desc->platform)
 					matched.pop_back();
 				matched.push_back(game);
 			} else {
-				debug(5, "Skipping game: %s (%s/%s) (%d)", game.desc->gameId, getPlatformDescription(game.desc->platform), getLanguageDescription(game.desc->language), g);
+				debugC(5, kDebugGlobalDetection, "Skipping game: %s (%s/%s) (%d)", game.desc->gameId, getPlatformDescription(game.desc->platform), getLanguageDescription(game.desc->language), g);
 				// If we already added a known or unknown variant for this game and platform, don't add another
 				if (matched.empty() || strcmp(matched.back().desc->gameId, game.desc->gameId) != 0 || matched.back().desc->platform != game.desc->platform)
 					matched.push_back(game);


Commit: 263d27a89baca463a3cc4fdfa78bb9e8b05dc28f
    https://github.com/scummvm/scummvm/commit/263d27a89baca463a3cc4fdfa78bb9e8b05dc28f
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
SCUMM: move debug messages in detection into kDebugGlobalDetection channel

Changed paths:
    engines/scumm/detection_internal.h


diff --git a/engines/scumm/detection_internal.h b/engines/scumm/detection_internal.h
index 2fe897e912..81e16c2db0 100644
--- a/engines/scumm/detection_internal.h
+++ b/engines/scumm/detection_internal.h
@@ -155,7 +155,7 @@ static BaseScummFile *openDiskImage(const Common::FSNode &node, const GameFilena
 	}
 
 	if (diskImg->open(disk1.c_str()) && diskImg->openSubFile("00.LFL")) {
-		debug(0, "Success");
+		debugC(0, kDebugGlobalDetection, "Success");
 		return diskImg;
 	}
 	delete diskImg;
@@ -214,7 +214,7 @@ static Common::Language detectLanguage(const Common::FSList &fslist, byte id, Co
 	Common::FSNode fontFile;
 
 	if (searchFSNode(fslist, "chinese_gb16x12.fnt", fontFile)) {
-		debug(0, "Chinese detected");
+		debugC(0, kDebugGlobalDetection, "Chinese detected");
 		return Common::ZH_CNA;
 	}
 
@@ -222,7 +222,7 @@ static Common::Language detectLanguage(const Common::FSList &fslist, byte id, Co
 		// Detect Korean fan translated games
 		Common::FSNode langFile;
 		if (searchFSNode(fslist, "korean.trs", langFile)) {
-			debug(0, "Korean fan translation detected");
+			debugC(0, kDebugGlobalDetection, "Korean fan translation detected");
 			return Common::KO_KOR;
 		}
 
@@ -454,7 +454,7 @@ static void detectGames(const Common::FSList &fslist, Common::List<DetectorResul
 			if (isDiskImg) {
 				tmp = openDiskImage(d.node, gfp);
 
-				debug(2, "Falling back to disk-based detection");
+				debugC(2, kDebugGlobalDetection, "Falling back to disk-based detection");
 			} else {
 				tmp = d.node.createReadStream();
 			}
@@ -475,7 +475,7 @@ static void detectGames(const Common::FSList &fslist, Common::List<DetectorResul
 
 					// Print some debug info.
 					int filesize = tmp->size();
-					debug(1, "SCUMM detector found matching file '%s' with MD5 %s, size %d\n",
+					debugC(1, kDebugGlobalDetection, "SCUMM detector found matching file '%s' with MD5 %s, size %d\n",
 						file.c_str(), md5str.c_str(), filesize);
 
 					// Sanity check: We *should* have found a matching gameid/variant at this point.


Commit: 9f1f800d5a2b960acf6a55ba73abafb85fb7a981
    https://github.com/scummvm/scummvm/commit/9f1f800d5a2b960acf6a55ba73abafb85fb7a981
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
SCUMM: add forward declaration of FontSJIS

Changed paths:
    engines/scumm/scumm.h


diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 3c815866a7..6f2eac4e69 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -63,6 +63,9 @@ namespace Common {
 class SeekableReadStream;
 class WriteStream;
 }
+namespace Graphics {
+class FontSJIS;
+}
 
 /**
  * This is the namespace of the SCUMM engine.


Commit: 859d9acef360591e3e5243a1005352641632215b
    https://github.com/scummvm/scummvm/commit/859d9acef360591e3e5243a1005352641632215b
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
ENGINE: add doxygen comments fo DebugChannelDef and getDebugChannels

Changed paths:
    engines/metaengine.h


diff --git a/engines/metaengine.h b/engines/metaengine.h
index e5604903f5..7cfbfe0487 100644
--- a/engines/metaengine.h
+++ b/engines/metaengine.h
@@ -74,12 +74,18 @@ struct ExtraGuiOption {
 	bool defaultState;         /*!< Default state of the checkbox (checked or not). */
 };
 
+/**
+ * debug channels structure
+ */
 struct DebugChannelDef {
-	uint32 channel;
-	const char *name;
-	const char *description;
+	uint32 channel;				/*!< enum value, channel id, e.g. kDebugGlobalDetection */
+	const char *name;			/*!< name of debug channel, e.g. "detection" */
+	const char *description;	/*!< description of debug channel, e.g. "track scripts" */
 };
 
+/**
+ * delimiter of the array of DebugChannelDef
+ */
 #define DEBUG_CHANNEL_END {0, NULL, NULL}
 
 /**
@@ -170,6 +176,13 @@ public:
 		return ExtraGuiOptions();
 	}
 
+	/**
+	 * Return a list of engine specified debug channels
+	 *
+	 * If engine has no specified debug channels or not supported yet, then it will return NULL
+	 *
+	 * @return A list of engine specified debug channels
+	 */
 	virtual const DebugChannelDef *getDebugChannels() const {
 		return NULL;
 	}


Commit: 6dfe6ad51a71d7e5d6cc7b473ded7d89d275ba13
    https://github.com/scummvm/scummvm/commit/6dfe6ad51a71d7e5d6cc7b473ded7d89d275ba13
Author: ysj1173886760 (1173886760 at qq.com)
Date: 2021-05-22T01:34:57+02:00

Commit Message:
ASYLUM: move debugchannels to metaEngineDetection

Changed paths:
    engines/asylum/asylum.cpp
    engines/asylum/detection.cpp


diff --git a/engines/asylum/asylum.cpp b/engines/asylum/asylum.cpp
index fb628a3005..4d39cac650 100644
--- a/engines/asylum/asylum.cpp
+++ b/engines/asylum/asylum.cpp
@@ -91,22 +91,6 @@ AsylumEngine::AsylumEngine(OSystem *system, const ADGameDescription *gd) : Engin
 	SearchMan.addSubDirectoryMatching(gameDataDir, "data/vids");
 	SearchMan.addSubDirectoryMatching(gameDataDir, "data/music");
 
-	// Initialize custom debug levels
-	DebugMan.addDebugChannel(kDebugLevelMain,      "Main",      "Generic debug level");
-	DebugMan.addDebugChannel(kDebugLevelResources, "Resources", "Resources debugging");
-	DebugMan.addDebugChannel(kDebugLevelSprites,   "Sprites",   "Sprites debugging");
-	DebugMan.addDebugChannel(kDebugLevelInput,     "Input",     "Input events debugging");
-	DebugMan.addDebugChannel(kDebugLevelMenu,      "Menu",      "Menu debugging");
-	DebugMan.addDebugChannel(kDebugLevelScripts,   "Scripts",   "Scripts debugging");
-	DebugMan.addDebugChannel(kDebugLevelSound,     "Sound",     "Sound debugging");
-	DebugMan.addDebugChannel(kDebugLevelSavegame,  "Savegame",  "Saving & restoring game debugging");
-	DebugMan.addDebugChannel(kDebugLevelScene,     "Scene",     "Scene process and draw debugging");
-	DebugMan.addDebugChannel(kDebugLevelObjects,   "Objects",   "Debug Object objects");
-	DebugMan.addDebugChannel(kDebugLevelActor,     "Actor",     "Debug Actor");
-	DebugMan.addDebugChannel(kDebugLevelEncounter, "Encounter", "Debug Encounter");
-	DebugMan.addDebugChannel(kDebugLevelVideo,     "Video",     "Debug Video");
-	DebugMan.addDebugChannel(kDebugLevelCommands,  "Commands",  "Script commands debugging");
-
 	// Initialize random number source
 	_rnd = new Common::RandomSource("asylum");
 }
diff --git a/engines/asylum/detection.cpp b/engines/asylum/detection.cpp
index adfe5564dc..ff3e28e186 100644
--- a/engines/asylum/detection.cpp
+++ b/engines/asylum/detection.cpp
@@ -24,6 +24,25 @@
 #include "base/plugins.h"
 
 #include "asylum/detection_table.h"
+#include "asylum/asylum.h"
+
+static const DebugChannelDef debugFlagList[] = {
+	{Asylum::kDebugLevelMain,      "Main",      "Generic debug level"},
+	{Asylum::kDebugLevelResources, "Resources", "Resources debugging"},
+	{Asylum::kDebugLevelSprites,   "Sprites",   "Sprites debugging"},
+	{Asylum::kDebugLevelInput,     "Input",     "Input events debugging"},
+	{Asylum::kDebugLevelMenu,      "Menu",      "Menu debugging"},
+	{Asylum::kDebugLevelScripts,   "Scripts",   "Scripts debugging"},
+	{Asylum::kDebugLevelSound,     "Sound",     "Sound debugging"},
+	{Asylum::kDebugLevelSavegame,  "Savegame",  "Saving & restoring game debugging"},
+	{Asylum::kDebugLevelScene,     "Scene",     "Scene process and draw debugging"},
+	{Asylum::kDebugLevelObjects,   "Objects",   "Debug Object objects"},
+	{Asylum::kDebugLevelActor,     "Actor",     "Debug Actor"},
+	{Asylum::kDebugLevelEncounter, "Encounter", "Debug Encounter"},
+	{Asylum::kDebugLevelVideo,     "Video",     "Debug Video"},
+	{Asylum::kDebugLevelCommands,  "Commands",  "Script commands debugging"},
+	DEBUG_CHANNEL_END
+};
 
 class AsylumMetaEngineDetection : public AdvancedMetaEngineDetection {
 public:
@@ -48,6 +67,10 @@ public:
 	const char *getOriginalCopyright() const {
 		return "Sanitarium (c) ASC Games";
 	}
+
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
+	}
 };
 
 REGISTER_PLUGIN_STATIC(ASYLUM_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, AsylumMetaEngineDetection);




More information about the Scummvm-git-logs mailing list