[Scummvm-git-logs] scummvm master -> b86688e71704b78dadefbe7dd5ded41dd1d4ae4f

sev- noreply at scummvm.org
Thu Dec 28 00:44:59 UTC 2023


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

Summary:
3a1701536f AGI: Avoid using bitfields in debugC()
6090788468 DIRECTOR: Avoid using bitfields in debugC
7fa224c45e GROOVIE: Avoid using bitfields in debugC()
c647a64345 LASTEXPRESS: Avoid using bitfields in debugC()
8c8eee7d1c NGI: Avoid using bitfields in debugC()
4ccdf1f992 WINTERMUTE: Avoid using bitfields in debugC()
bf3117e935 COMMON: Switch debug channels to a hashmap
18ef024b4e DIRECTOR: Turn debug channels into a sequential enum
b86688e717 CREATE_ENGINE: Switch debug channels to a sequential enum


Commit: 3a1701536f993451bf6077c542efaa87affb11b7
    https://github.com/scummvm/scummvm/commit/3a1701536f993451bf6077c542efaa87affb11b7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-12-28T01:41:10+01:00

Commit Message:
AGI: Avoid using bitfields in debugC()

Changed paths:
    engines/agi/op_cmd.cpp
    engines/agi/op_test.cpp
    engines/agi/saveload.cpp


diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index 6388dffa62f..177a0a90057 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -1997,7 +1997,7 @@ void cmdDistance(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
 void cmdAcceptInput(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
 	TextMgr *textMgr = state->_vm->_text;
 
-	debugC(4, kDebugLevelScripts | kDebugLevelInput, "input normal");
+	debugC(4, kDebugLevelInput, "input normal");
 
 	textMgr->promptEnable();
 	textMgr->promptRedraw();
@@ -2006,7 +2006,7 @@ void cmdAcceptInput(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
 void cmdPreventInput(AgiGame *state, AgiEngine *vm, uint8 *parameter) {
 	TextMgr *textMgr = state->_vm->_text;
 
-	debugC(4, kDebugLevelScripts | kDebugLevelInput, "no input");
+	debugC(4, kDebugLevelInput, "no input");
 
 	textMgr->promptDisable();
 
diff --git a/engines/agi/op_test.cpp b/engines/agi/op_test.cpp
index 4d204ce97ef..61df9e51833 100644
--- a/engines/agi/op_test.cpp
+++ b/engines/agi/op_test.cpp
@@ -129,7 +129,7 @@ void condHaveKey(AgiGame *state, AgiEngine *vm, uint8 *p) {
 	uint16 key = vm->processAGIEvents();
 	vm->cycleInnerLoopInactive();
 	if (key) {
-		debugC(5, kDebugLevelScripts | kDebugLevelInput, "keypress = %02x", key);
+		debugC(5, kDebugLevelInput, "keypress = %02x", key);
 		vm->setVar(VM_VAR_KEY, key);
 		state->testResult = 1;
 		return;
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index 70ee112ec25..bf62f856209 100644
--- a/engines/agi/saveload.cpp
+++ b/engines/agi/saveload.cpp
@@ -74,12 +74,12 @@ int AgiEngine::saveGame(const Common::String &fileName, const Common::String &de
 	Common::OutSaveFile *out;
 	int result = errOK;
 
-	debugC(3, kDebugLevelMain | kDebugLevelSavegame, "AgiEngine::saveGame(%s, %s)", fileName.c_str(), descriptionString.c_str());
+	debugC(3, kDebugLevelSavegame, "AgiEngine::saveGame(%s, %s)", fileName.c_str(), descriptionString.c_str());
 	if (!(out = _saveFileMan->openForSaving(fileName))) {
 		warning("Can't create file '%s', game not saved", fileName.c_str());
 		return errBadFileOpen;
 	} else {
-		debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Successfully opened %s for writing", fileName.c_str());
+		debugC(3, kDebugLevelSavegame, "Successfully opened %s for writing", fileName.c_str());
 	}
 
 	out->writeUint32BE(AGIflag);
@@ -102,7 +102,7 @@ int AgiEngine::saveGame(const Common::String &fileName, const Common::String &de
 	out->write(description, 31);
 
 	out->writeByte(SAVEGAME_CURRENT_VERSION);
-	debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing save game version (%d)", SAVEGAME_CURRENT_VERSION);
+	debugC(5, kDebugLevelSavegame, "Writing save game version (%d)", SAVEGAME_CURRENT_VERSION);
 
 	// Thumbnail
 	Graphics::saveThumbnail(*out);
@@ -116,19 +116,19 @@ int AgiEngine::saveGame(const Common::String &fileName, const Common::String &de
 	uint32 playTime = g_engine->getTotalPlayTime() / 1000;
 
 	out->writeUint32BE(saveDate);
-	debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing save date (%d)", saveDate);
+	debugC(5, kDebugLevelSavegame, "Writing save date (%d)", saveDate);
 	out->writeUint16BE(saveTime);
-	debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing save time (%d)", saveTime);
+	debugC(5, kDebugLevelSavegame, "Writing save time (%d)", saveTime);
 	// Version 9+: save seconds of current time as well
 	out->writeByte(curTime.tm_sec & 0xFF);
 	out->writeUint32BE(playTime);
-	debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing play time (%d)", playTime);
+	debugC(5, kDebugLevelSavegame, "Writing play time (%d)", playTime);
 
 	out->writeByte(2); // was _game.state, 2 = STATE_RUNNING
 
 	Common::strlcpy(gameIDstring, _game.id, 8);
 	out->write(gameIDstring, 8);
-	debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing game id (%s, %s)", gameIDstring, _game.id);
+	debugC(5, kDebugLevelSavegame, "Writing game id (%s, %s)", gameIDstring, _game.id);
 
 	const char *tmp = getGameMD5();
 	// As reported in bug report #4582 "AGI: Crash when saving fallback-matched game"
@@ -335,10 +335,10 @@ int AgiEngine::saveGame(const Common::String &fileName, const Common::String &de
 		warning("Can't write file '%s'. (Disk full?)", fileName.c_str());
 		result = errIOError;
 	} else
-		debugC(1, kDebugLevelMain | kDebugLevelSavegame, "Saved game %s in file %s", descriptionString.c_str(), fileName.c_str());
+		debugC(1, kDebugLevelSavegame, "Saved game %s in file %s", descriptionString.c_str(), fileName.c_str());
 
 	delete out;
-	debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Closed %s", fileName.c_str());
+	debugC(3, kDebugLevelSavegame, "Closed %s", fileName.c_str());
 
 	return result;
 }
@@ -354,18 +354,18 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
 	bool totalPlayTimeWasSet = false;
 	byte oldLoopFlag = 0;
 
-	debugC(3, kDebugLevelMain | kDebugLevelSavegame, "AgiEngine::loadGame(%s)", fileName.c_str());
+	debugC(3, kDebugLevelSavegame, "AgiEngine::loadGame(%s)", fileName.c_str());
 
 	if (!(in = _saveFileMan->openForLoading(fileName))) {
 		warning("Can't open file '%s', game not loaded", fileName.c_str());
 		return errBadFileOpen;
 	} else {
-		debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Successfully opened %s for reading", fileName.c_str());
+		debugC(3, kDebugLevelSavegame, "Successfully opened %s for reading", fileName.c_str());
 	}
 
 	uint32 typea = in->readUint32BE();
 	if (typea == AGIflag) {
-		debugC(6, kDebugLevelMain | kDebugLevelSavegame, "Has AGI flag, good start");
+		debugC(6, kDebugLevelSavegame, "Has AGI flag, good start");
 	} else {
 		warning("This doesn't appear to be an AGI savegame, game not restored");
 		delete in;
@@ -382,7 +382,7 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
 		if (descriptionPos >= sizeof(description))
 			error("saved game description is corrupt");
 	}
-	debugC(6, kDebugLevelMain | kDebugLevelSavegame, "Description is: %s", description);
+	debugC(6, kDebugLevelSavegame, "Description is: %s", description);
 
 	saveVersion = in->readByte();
 	if (saveVersion < 2)    // is the save game pre-ScummVM?
@@ -732,7 +732,7 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
 		_gfx->setAGIPal(in->readSint16BE());
 
 	delete in;
-	debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Closed %s", fileName.c_str());
+	debugC(3, kDebugLevelSavegame, "Closed %s", fileName.c_str());
 
 	setFlag(VM_FLAG_RESTORE_JUST_RAN, true);
 
@@ -793,7 +793,7 @@ int AgiEngine::scummVMSaveLoadDialog(bool isSave) {
 
 int AgiEngine::doSave(int slot, const Common::String &desc) {
 	Common::String fileName = getSaveStateName(slot);
-	debugC(8, kDebugLevelMain | kDebugLevelResources, "file is [%s]", fileName.c_str());
+	debugC(8, kDebugLevelResources, "file is [%s]", fileName.c_str());
 
 	// Make sure all graphics was blitted to screen. This fixes bug
 	// #4790: "AGI: Ego partly erased in Load/Save thumbnails"
@@ -805,7 +805,7 @@ int AgiEngine::doSave(int slot, const Common::String &desc) {
 
 int AgiEngine::doLoad(int slot, bool showMessages) {
 	Common::String fileName = getSaveStateName(slot);
-	debugC(8, kDebugLevelMain | kDebugLevelResources, "file is [%s]", fileName.c_str());
+	debugC(8, kDebugLevelResources, "file is [%s]", fileName.c_str());
 
 	_sprites->eraseSprites();
 	_sound->stopSound();
@@ -864,14 +864,14 @@ bool AgiEngine::getSavegameInformation(int16 slotId, Common::String &saveDescrip
 	saveTime = 0;
 	saveIsValid = false;
 
-	debugC(4, kDebugLevelMain | kDebugLevelSavegame, "Current game id is %s", _targetName.c_str());
+	debugC(4, kDebugLevelSavegame, "Current game id is %s", _targetName.c_str());
 
 	if (!(in = _saveFileMan->openForLoading(fileName))) {
-		debugC(4, kDebugLevelMain | kDebugLevelSavegame, "File %s does not exist", fileName.c_str());
+		debugC(4, kDebugLevelSavegame, "File %s does not exist", fileName.c_str());
 		return false;
 
 	} else {
-		debugC(4, kDebugLevelMain | kDebugLevelSavegame, "Successfully opened %s for reading", fileName.c_str());
+		debugC(4, kDebugLevelSavegame, "Successfully opened %s for reading", fileName.c_str());
 
 		uint32 type = in->readUint32BE();
 
@@ -882,7 +882,7 @@ bool AgiEngine::getSavegameInformation(int16 slotId, Common::String &saveDescrip
 			return true;
 		}
 
-		debugC(6, kDebugLevelMain | kDebugLevelSavegame, "Has AGI flag, good start");
+		debugC(6, kDebugLevelSavegame, "Has AGI flag, good start");
 		if (in->read(saveGameDescription, 31) != 31) {
 			warning("unexpected EOF");
 			delete in;


Commit: 60907884688e51b1d04283209d41eeaab76fb7e6
    https://github.com/scummvm/scummvm/commit/60907884688e51b1d04283209d41eeaab76fb7e6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-12-28T01:41:10+01:00

Commit Message:
DIRECTOR: Avoid using bitfields in debugC

Changed paths:
    engines/director/castmember/digitalvideo.cpp
    engines/director/lingo/lingo-preprocessor.cpp
    engines/director/lingo/lingo-the.cpp


diff --git a/engines/director/castmember/digitalvideo.cpp b/engines/director/castmember/digitalvideo.cpp
index 5273cd525d2..2b2a7108f8a 100644
--- a/engines/director/castmember/digitalvideo.cpp
+++ b/engines/director/castmember/digitalvideo.cpp
@@ -105,7 +105,7 @@ bool DigitalVideoCastMember::loadVideo(Common::String path) {
 		return false;
 	}
 
-	debugC(2, kDebugLoading | kDebugImages, "Loading video %s -> %s", path.c_str(), location.toString(Common::Path::kNativeSeparator).c_str());
+	debugC(2, kDebugLoading, "Loading video %s -> %s", path.c_str(), location.toString(Common::Path::kNativeSeparator).c_str());
 	bool result = _video->loadFile(location);
 	if (!result) {
 		delete _video;
diff --git a/engines/director/lingo/lingo-preprocessor.cpp b/engines/director/lingo/lingo-preprocessor.cpp
index f5dfa0572d5..02e0849113a 100644
--- a/engines/director/lingo/lingo-preprocessor.cpp
+++ b/engines/director/lingo/lingo-preprocessor.cpp
@@ -68,11 +68,11 @@ static Common::U32String nexttok(const Common::u32char_type_t *s, const Common::
 Common::U32String LingoCompiler::codePreprocessor(const Common::U32String &code, LingoArchive *archive, ScriptType type, CastMemberID id, uint32 flags) {
 	const Common::u32char_type_t *s = code.c_str();
 	Common::U32String res;
-	if (debugChannelSet(2, kDebugParse | kDebugPreprocess)) {
+	if (debugChannelSet(2, kDebugPreprocess)) {
 		Common::String movie = g_director->getCurrentPath();
 		if (archive)
 			movie += archive->cast->getMacName();
-		debugC(2, kDebugParse | kDebugPreprocess, "LingoCompiler::codePreprocessor: \"%s\", %s, %d, %d", movie.c_str(),  scriptType2str(type), id.member, id.castLib);
+		debugC(2, kDebugPreprocess, "LingoCompiler::codePreprocessor: \"%s\", %s, %d, %d", movie.c_str(),  scriptType2str(type), id.member, id.castLib);
 	}
 
 	// We start from processing the continuation symbols
@@ -202,7 +202,7 @@ Common::U32String LingoCompiler::codePreprocessor(const Common::U32String &code,
 				continuationCount++;
 			}
 		}
-		debugC(2, kDebugParse | kDebugPreprocess, "line %d: '%s'", linenumber, line.encode().c_str());
+		debugC(2, kDebugPreprocess, "line %d: '%s'", linenumber, line.encode().c_str());
 
 		if (!defFound && (type == kMovieScript || type == kCastScript) && (g_director->getVersion() < 400 || g_director->getCurrentMovie()->_allowOutdatedLingo)) {
 			tok = nexttok(line.c_str());
@@ -215,7 +215,7 @@ Common::U32String LingoCompiler::codePreprocessor(const Common::U32String &code,
 			}
 
 			if (!defFound) {
-				debugC(2, kDebugParse | kDebugPreprocess, "skipping line before first definition");
+				debugC(2, kDebugPreprocess, "skipping line before first definition");
 				for (int i = 0; i < continuationCount; i++) {
 					res += CONTINUATION;
 				}
@@ -243,7 +243,7 @@ Common::U32String LingoCompiler::codePreprocessor(const Common::U32String &code,
 
 			res1 = Common::U32String::format("%S \"%S\"", tok.c_str(), contLine);
 
-			debugC(2, kDebugParse | kDebugPreprocess, "wrapped mci command into quotes");
+			debugC(2, kDebugPreprocess, "wrapped mci command into quotes");
 		}
 
 		res1 = patchLingoCode(res1, archive, type, id, linenumber);
@@ -259,7 +259,7 @@ Common::U32String LingoCompiler::codePreprocessor(const Common::U32String &code,
 	// Make the parser happier when there is no newline at the end
 	res += '\n';
 
-	debugC(2, kDebugParse | kDebugPreprocess, "#############\n%s\n#############", res.encode().c_str());
+	debugC(2, kDebugPreprocess, "#############\n%s\n#############", res.encode().c_str());
 
 	return res;
 }
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 13d21e1a0f0..94c5edb0909 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -361,9 +361,8 @@ const char *Lingo::field2str(int id) {
 	warning("Lingo::getTheEntity(): Unprocessed getting entity %s", entity2str(entity));
 
 Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
-	if (debugChannelSet(3, kDebugLingoThe | kDebugLingoExec)) {
-		debugC(3, kDebugLingoThe | kDebugLingoExec, "Lingo::getTheEntity(%s, %s, %s)", entity2str(entity), id.asString(true).c_str(), field2str(field));
-	}
+	debugC(3, kDebugLingoThe, "Lingo::getTheEntity(%s, %s, %s)", entity2str(entity), id.asString(true).c_str(), field2str(field));
+	debugC(3, kDebugLingoExec, "Lingo::getTheEntity(%s, %s, %s)", entity2str(entity), id.asString(true).c_str(), field2str(field));
 
 	Datum d;
 	Movie *movie = _vm->getCurrentMovie();
@@ -921,9 +920,8 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
 	warning("Lingo::setTheEntity: Attempt to set read-only entity %s", entity2str(entity));
 
 void Lingo::setTheEntity(int entity, Datum &id, int field, Datum &d) {
-	if (debugChannelSet(3, kDebugLingoThe | kDebugLingoExec)) {
-		debugC(3, kDebugLingoThe | kDebugLingoExec, "Lingo::setTheEntity(%s, %s, %s, %s)", entity2str(entity), id.asString(true).c_str(), field2str(field), d.asString(true).c_str());
-	}
+	debugC(3, kDebugLingoThe, "Lingo::setTheEntity(%s, %s, %s, %s)", entity2str(entity), id.asString(true).c_str(), field2str(field), d.asString(true).c_str());
+	debugC(3, kDebugLingoExec, "Lingo::setTheEntity(%s, %s, %s, %s)", entity2str(entity), id.asString(true).c_str(), field2str(field), d.asString(true).c_str());
 
 	Movie *movie = _vm->getCurrentMovie();
 	Score *score = movie->getScore();


Commit: 7fa224c45ea1dc597bccc5bc32dad0d1c468c8e1
    https://github.com/scummvm/scummvm/commit/7fa224c45ea1dc597bccc5bc32dad0d1c468c8e1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-12-28T01:41:10+01:00

Commit Message:
GROOVIE: Avoid using bitfields in debugC()

Changed paths:
    engines/groovie/cursor.cpp
    engines/groovie/video/vdx.cpp


diff --git a/engines/groovie/cursor.cpp b/engines/groovie/cursor.cpp
index 4d601da6a5e..3667e2ba7af 100644
--- a/engines/groovie/cursor.cpp
+++ b/engines/groovie/cursor.cpp
@@ -107,7 +107,7 @@ Cursor_t7g::Cursor_t7g(uint8 *img, uint8 *pal) :
 	_img = img + 5;
 
 	debugC(1, kDebugCursor, "Groovie::Cursor: width: %d, height: %d, frames:%d", _width, _height, _numFrames);
-	debugC(1, kDebugCursor | kDebugUnknown, "Groovie::Cursor: elinor: 0x%02X (%d), 0x%02X (%d)", elinor1, elinor1, elinor2, elinor2);
+	debugC(1, kDebugCursor, "Groovie::Cursor: elinor: 0x%02X (%d), 0x%02X (%d)", elinor1, elinor1, elinor2, elinor2);
 }
 
 void Cursor_t7g::enable() {
diff --git a/engines/groovie/video/vdx.cpp b/engines/groovie/video/vdx.cpp
index 96bdbec2bc6..aecb076eaff 100644
--- a/engines/groovie/video/vdx.cpp
+++ b/engines/groovie/video/vdx.cpp
@@ -125,11 +125,11 @@ uint16 VDXPlayer::loadInternal() {
 
 	// Skip unknown data: 6 bytes, ref Martine
 	tmp = _file->readUint16LE();
-	debugC(2, kDebugVideo | kDebugUnknown, "Groovie::VDX: Martine1 = 0x%04X", tmp);
+	debugC(2, kDebugVideo, "Groovie::VDX: Martine1 = 0x%04X", tmp);
 	tmp = _file->readUint16LE();
-	debugC(2, kDebugVideo | kDebugUnknown, "Groovie::VDX: Martine2 = 0x%04X", tmp);
+	debugC(2, kDebugVideo, "Groovie::VDX: Martine2 = 0x%04X", tmp);
 	tmp = _file->readUint16LE();
-	debugC(2, kDebugVideo | kDebugUnknown, "Groovie::VDX: Martine3 (FPS?) = %d", tmp);
+	debugC(2, kDebugVideo, "Groovie::VDX: Martine3 (FPS?) = %d", tmp);
 
 	return tmp;
 }
@@ -150,7 +150,7 @@ bool VDXPlayer::playFrameInternal() {
 		if (_file->eos())
 			break;
 
-		debugC(5, kDebugVideo | kDebugUnknown, "Groovie::VDX: Edward = 0x%04X", tmp);
+		debugC(5, kDebugVideo, "Groovie::VDX: Edward = 0x%04X", tmp);
 
 		// Read the chunk data and decompress if needed
 		if (compSize)


Commit: c647a6434595b6b83ff49f859a1b6eac83703f19
    https://github.com/scummvm/scummvm/commit/c647a6434595b6b83ff49f859a1b6eac83703f19
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-12-28T01:41:10+01:00

Commit Message:
LASTEXPRESS: Avoid using bitfields in debugC()

Changed paths:
    engines/lastexpress/data/animation.cpp


diff --git a/engines/lastexpress/data/animation.cpp b/engines/lastexpress/data/animation.cpp
index bc4c19fcb71..670228c4565 100644
--- a/engines/lastexpress/data/animation.cpp
+++ b/engines/lastexpress/data/animation.cpp
@@ -116,7 +116,7 @@ bool Animation::process() {
 		case kChunkTypeUnknown1:
 		case kChunkTypeUnknown2:
 		case kChunkTypeUnknown5:
-			debugC(9, kLastExpressDebugGraphics | kLastExpressDebugUnknown, "  info chunk: type 0x%.4x (size %d)", _currentChunk->type, _currentChunk->size);
+			debugC(9, kLastExpressDebugGraphics, "  info chunk: type 0x%.4x (size %d)", _currentChunk->type, _currentChunk->size);
 			assert (_currentChunk->frame == 0);
 			//TODO: _currentChunk->size?
 			break;
@@ -129,7 +129,7 @@ bool Animation::process() {
 			break;
 
 		case kChunkTypeUnknown4:
-			debugC(9, kLastExpressDebugGraphics | kLastExpressDebugUnknown, "  info block 4");
+			debugC(9, kLastExpressDebugGraphics, "  info block 4");
 			assert (_currentChunk->frame == 0 && _currentChunk->size == 0);
 			//TODO unknown type of chunk
 			break;


Commit: 8c8eee7d1c774c2051cb2034a020554425da38ac
    https://github.com/scummvm/scummvm/commit/8c8eee7d1c774c2051cb2034a020554425da38ac
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-12-28T01:41:10+01:00

Commit Message:
NGI: Avoid using bitfields in debugC()

Changed paths:
    engines/ngi/gameloader.cpp
    engines/ngi/inventory.cpp


diff --git a/engines/ngi/gameloader.cpp b/engines/ngi/gameloader.cpp
index 2c8d05782dc..7e7d52cf14f 100644
--- a/engines/ngi/gameloader.cpp
+++ b/engines/ngi/gameloader.cpp
@@ -549,7 +549,7 @@ PicAniInfoList GameLoader::savePicAniInfos(Scene *sc, int flag1, int flag2) {
 		}
 	}
 
-	debugC(4, kDebugBehavior | kDebugAnimation, "savePicAniInfos: Stored %d infos", res.size());
+	debugC(4, kDebugBehavior, "savePicAniInfos: Stored %d infos", res.size());
 
 	return res;
 }
diff --git a/engines/ngi/inventory.cpp b/engines/ngi/inventory.cpp
index eb7791a84ba..6b817309739 100644
--- a/engines/ngi/inventory.cpp
+++ b/engines/ngi/inventory.cpp
@@ -30,7 +30,7 @@
 namespace NGI {
 
 bool Inventory::load(MfcArchive &file) {
-	debugC(5, kDebugLoading | kDebugInventory, "Inventory::load()");
+	debugC(5, kDebugLoading, "Inventory::load()");
 
 	_sceneId = file.readUint16LE();
 	int numInvs = file.readUint32LE();


Commit: 4ccdf1f992694c6667fce9071e5bc6660102dc0b
    https://github.com/scummvm/scummvm/commit/4ccdf1f992694c6667fce9071e5bc6660102dc0b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-12-28T01:41:10+01:00

Commit Message:
WINTERMUTE: Avoid using bitfields in debugC()

Changed paths:
    engines/wintermute/base/base_file_manager.cpp
    engines/wintermute/base/file/base_package.cpp


diff --git a/engines/wintermute/base/base_file_manager.cpp b/engines/wintermute/base/base_file_manager.cpp
index 449f8ab25da..9731d3d281e 100644
--- a/engines/wintermute/base/base_file_manager.cpp
+++ b/engines/wintermute/base/base_file_manager.cpp
@@ -97,20 +97,20 @@ byte *BaseFileManager::readWholeFile(const Common::String &filename, uint32 *siz
 	Common::SeekableReadStream *file = openFile(filename);
 	if (!file) {
 		if (mustExist) {
-			debugC(kWintermuteDebugFileAccess | kWintermuteDebugLog, "Error opening file '%s'", filename.c_str());
+			debugC(kWintermuteDebugFileAccess, "Error opening file '%s'", filename.c_str());
 		}
 		return nullptr;
 	}
 
 	buffer = new byte[file->size() + 1];
 	if (buffer == nullptr) {
-		debugC(kWintermuteDebugFileAccess | kWintermuteDebugLog, "Error allocating buffer for file '%s' (%d bytes)", filename.c_str(), (int)file->size() + 1);
+		debugC(kWintermuteDebugFileAccess, "Error allocating buffer for file '%s' (%d bytes)", filename.c_str(), (int)file->size() + 1);
 		closeFile(file);
 		return nullptr;
 	}
 
 	if (file->read(buffer, (uint32)file->size()) != (uint32)file->size()) {
-		debugC(kWintermuteDebugFileAccess | kWintermuteDebugLog, "Error reading file '%s'", filename.c_str());
+		debugC(kWintermuteDebugFileAccess, "Error reading file '%s'", filename.c_str());
 		closeFile(file);
 		delete[] buffer;
 		return nullptr;
@@ -192,7 +192,7 @@ bool BaseFileManager::registerPackages(const Common::FSList &fslist) {
 
 //////////////////////////////////////////////////////////////////////////
 bool BaseFileManager::registerPackages() {
-	debugC(kWintermuteDebugFileAccess | kWintermuteDebugLog, "Scanning packages");
+	debugC(kWintermuteDebugFileAccess, "Scanning packages");
 
 	// We need game flags to perform some game-specific hacks.
 	uint32 flags = BaseEngine::instance().getFlags();
@@ -321,7 +321,7 @@ bool BaseFileManager::registerPackages() {
 		}
 	}
 
-//	debugC(kWintermuteDebugFileAccess | kWintermuteDebugLog, "  Registered %d files in %d package(s)", _files.size(), _packages.size());
+//	debugC(kWintermuteDebugFileAccess, "  Registered %d files in %d package(s)", _files.size(), _packages.size());
 
 	return STATUS_OK;
 }
diff --git a/engines/wintermute/base/file/base_package.cpp b/engines/wintermute/base/file/base_package.cpp
index 02ab29391b7..51e7477b131 100644
--- a/engines/wintermute/base/file/base_package.cpp
+++ b/engines/wintermute/base/file/base_package.cpp
@@ -132,13 +132,13 @@ PackageSet::PackageSet(Common::FSNode file, const Common::String &filename, bool
 	TPackageHeader hdr;
 	hdr.readFromStream(stream);
 	if (hdr._magic1 != PACKAGE_MAGIC_1 || hdr._magic2 != PACKAGE_MAGIC_2 || hdr._packageVersion > PACKAGE_VERSION) {
-		debugC(kWintermuteDebugFileAccess | kWintermuteDebugLog, "  Invalid header in package file '%s'. Ignoring.", filename.c_str());
+		debugC(kWintermuteDebugFileAccess, "  Invalid header in package file '%s'. Ignoring.", filename.c_str());
 		delete stream;
 		return;
 	}
 
 	if (hdr._packageVersion != PACKAGE_VERSION) {
-		debugC(kWintermuteDebugFileAccess | kWintermuteDebugLog, "  Warning: package file '%s' is outdated.", filename.c_str());
+		debugC(kWintermuteDebugFileAccess, "  Warning: package file '%s' is outdated.", filename.c_str());
 	}
 	_priority = hdr._priority;
 	_version  = hdr._gameVersion;


Commit: bf3117e935609a16b6eda15c95c12dae61bffbc1
    https://github.com/scummvm/scummvm/commit/bf3117e935609a16b6eda15c95c12dae61bffbc1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-12-28T01:41:10+01:00

Commit Message:
COMMON: Switch debug channels to a hashmap

We used to use a bitfield there, which was restricting the total
number of flags to 32 (unless we switch to uint64, which is suboptimal).
Moreover, with the introduction of the global debug flags, we have
even fewer bits to flip, and this shared nature was restricting
the introduction of more global debug channels.

The goal for the bitfield was to make it possible to put a debug message into
more than one channel. But this feature was practically not used by the engines.
This was removed by the previous commits.

This commit turns the debug channels into a hashmap and puts the global channel
IDs after 100000.

There is no absolute need to renumber the existing debug channels, but
I could follow with an engine or two.

Changed paths:
    common/debug-channels.h
    common/debug.cpp
    common/debug.h
    engines/scumm/debugger.cpp
    gui/debugger.cpp


diff --git a/common/debug-channels.h b/common/debug-channels.h
index 8c1d63c19e8..239ef2cf777 100644
--- a/common/debug-channels.h
+++ b/common/debug-channels.h
@@ -47,15 +47,14 @@ class DebugManager : public Singleton<DebugManager> {
 public:
 
 	struct DebugChannel {
-		DebugChannel() : channel(0), enabled(false) {}
+		DebugChannel() : channel(0) {}
 		DebugChannel(uint32 c, const String &n, const String &d)
-			: name(n), description(d), channel(c), enabled(false) {}
+			: name(n), description(d), channel(c) {}
 
 		String name; /*!< Name of the channel */
 		String description; /*!< Description of the channel */
 
-		uint32 channel; /*!< Channel number. */
-		bool enabled; /*!< Whether the channel is enabled. */
+		uint32 channel; /*!< Channel ID */
 	};
 
 	/**
@@ -74,7 +73,7 @@ public:
 	 * specific debug channels. Those functions will only show output, when *both* criteria
 	 * are satisfied.
 	 *
-	 * @param channel     Channel flag (should be OR-able i.e. first one should be 1 then 2, 4, etc.).
+	 * @param channel     Channel ID.
 	 * @param name        The option name that is used in the debugger/on the command line to enable
 	 *                    this special debug level (case will be ignored).
 	 * @param description The description that shows up in the debugger.
@@ -121,7 +120,7 @@ public:
 	/**
 	 * @overload bool disableDebugChannel(uint32 channel)
 	 *
-	 * @param channel The debug channel
+	 * @param channel The debug channel ID
 	 * @return true on success, false on failure
 	 */
 	bool disableDebugChannel(uint32 channel);
@@ -153,9 +152,10 @@ public:
 
 private:
 	typedef HashMap<String, DebugChannel, IgnoreCase_Hash, IgnoreCase_EqualTo> DebugChannelMap;
+	typedef HashMap<uint32, bool> EnabledChannelsMap;
 
 	DebugChannelMap _debugChannels;
-	uint32 _debugChannelsEnabled;
+	EnabledChannelsMap _debugChannelsEnabled;
 	uint32 _globalChannelsMask;
 
 	friend class Singleton<SingletonBaseType>;
diff --git a/common/debug.cpp b/common/debug.cpp
index ec13cc0e45e..34da705bd0e 100644
--- a/common/debug.cpp
+++ b/common/debug.cpp
@@ -50,8 +50,7 @@ struct DebugLevelComperator {
 
 } // end of anonymous namespace
 
-DebugManager::DebugManager() :
-	_debugChannelsEnabled(0) {
+DebugManager::DebugManager() {
 	addDebugChannels(gDebugChannels);
 
 	// Create global debug channels mask
@@ -88,20 +87,22 @@ void DebugManager::addAllDebugChannels(const DebugChannelDef *channels) {
 }
 
 void DebugManager::removeAllDebugChannels() {
-	uint32 globalChannels = _debugChannelsEnabled & _globalChannelsMask;
-	_debugChannelsEnabled = 0;
+	EnabledChannelsMap oldMap = _debugChannelsEnabled;
+
+	_debugChannelsEnabled.clear();
 	_debugChannels.clear();
 	addDebugChannels(gDebugChannels);
 
-	_debugChannelsEnabled |= globalChannels;
+	for (DebugChannelMap::iterator i = _debugChannels.begin(); i != _debugChannels.end(); ++i)
+		if (oldMap.contains(i->_value.channel))
+			_debugChannelsEnabled[i->_value.channel] = oldMap[i->_value.channel];
 }
 
 bool DebugManager::enableDebugChannel(const String &name) {
 	DebugChannelMap::iterator i = _debugChannels.find(name);
 
 	if (i != _debugChannels.end()) {
-		_debugChannelsEnabled |= i->_value.channel;
-		i->_value.enabled = true;
+		_debugChannelsEnabled[i->_value.channel] = true;
 
 		return true;
 	} else {
@@ -110,7 +111,7 @@ bool DebugManager::enableDebugChannel(const String &name) {
 }
 
 bool DebugManager::enableDebugChannel(uint32 channel) {
-	_debugChannelsEnabled |= channel;
+	_debugChannelsEnabled[channel] = true;
 	return true;
 }
 
@@ -118,8 +119,7 @@ bool DebugManager::disableDebugChannel(const String &name) {
 	DebugChannelMap::iterator i = _debugChannels.find(name);
 
 	if (i != _debugChannels.end()) {
-		_debugChannelsEnabled &= ~i->_value.channel;
-		i->_value.enabled = false;
+		_debugChannelsEnabled[i->_value.channel] = false;
 
 		return true;
 	} else {
@@ -128,7 +128,7 @@ bool DebugManager::disableDebugChannel(const String &name) {
 }
 
 bool DebugManager::disableDebugChannel(uint32 channel) {
-	_debugChannelsEnabled &= ~channel;
+	_debugChannelsEnabled[channel] = false;
 	return true;
 }
 
@@ -156,7 +156,7 @@ bool DebugManager::isDebugChannelEnabled(uint32 channel, bool enforce) {
 	if (gDebugLevel == 11 && enforce == false)
 		return true;
 	else
-		return (_debugChannelsEnabled & channel) != 0;
+		return (_debugChannelsEnabled.contains(channel) && _debugChannelsEnabled[channel] == true);
 }
 
 void DebugManager::addDebugChannels(const DebugChannelDef *channels) {
diff --git a/common/debug.h b/common/debug.h
index 2fb3c05ab0a..6939fc3a7a0 100644
--- a/common/debug.h
+++ b/common/debug.h
@@ -161,8 +161,8 @@ extern bool gDebugChannelsOnly;
 
 /** Global constant for EventRecorder debug channel. */
 enum GlobalDebugLevels {
-	kDebugGlobalDetection = 1 << 29,
-	kDebugLevelEventRec = 1 << 30
+	kDebugGlobalDetection = 100000,
+	kDebugLevelEventRec
 };
 
 extern const DebugChannelDef gDebugChannels[];
diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp
index 514df849968..db6d6e7c1e2 100644
--- a/engines/scumm/debugger.cpp
+++ b/engines/scumm/debugger.cpp
@@ -1036,9 +1036,11 @@ bool ScummDebugger::Cmd_Debug(int argc, const char **argv) {
 	if (argc <= 1) {
 		debugPrintf("Available debug channels:\n");
 		for (Common::DebugManager::DebugChannelList::const_iterator i = lvls.begin(); i != lvls.end(); ++i) {
-			debugPrintf("%c%s - %s (%s)\n", i->enabled ? '+' : ' ',
+			bool enabled = DebugMan.isDebugChannelEnabled(i->channel);
+
+			debugPrintf("%c%s - %s (%s)\n", enabled ? '+' : ' ',
 					i->name.c_str(), i->description.c_str(),
-					i->enabled ? "enabled" : "disabled");
+					enabled ? "enabled" : "disabled");
 		}
 		return true;
 	}
diff --git a/gui/debugger.cpp b/gui/debugger.cpp
index 0fc30b80610..469b11eb63d 100644
--- a/gui/debugger.cpp
+++ b/gui/debugger.cpp
@@ -786,9 +786,11 @@ bool Debugger::cmdDebugFlagsList(int argc, const char **argv) {
 		return true;
 	}
 	for (Common::DebugManager::DebugChannelList::const_iterator i = debugLevels.begin(); i != debugLevels.end(); ++i) {
-		debugPrintf("%c%s - %s (%s)\n", i->enabled ? '+' : ' ',
+		bool enabled = DebugMan.isDebugChannelEnabled(i->channel);
+
+		debugPrintf("%c%s - %s (%s)\n", enabled ? '+' : ' ',
 				i->name.c_str(), i->description.c_str(),
-				i->enabled ? "enabled" : "disabled");
+				enabled ? "enabled" : "disabled");
 	}
 	debugPrintf("\n");
 	return true;


Commit: 18ef024b4e35de4ff6887e6cf1772c153ad069a8
    https://github.com/scummvm/scummvm/commit/18ef024b4e35de4ff6887e6cf1772c153ad069a8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-12-28T01:41:11+01:00

Commit Message:
DIRECTOR: Turn debug channels into a sequential enum

Changed paths:
    engines/director/director.h


diff --git a/engines/director/director.h b/engines/director/director.h
index e5155108851..bad39232397 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -62,29 +62,29 @@ class CastMember;
 class Stxt;
 
 enum {
-	kDebugLingoExec		= 1 << 0,
-	kDebugCompile		= 1 << 1,
-	kDebugLoading		= 1 << 2,
-	kDebugImages		= 1 << 3,
-	kDebugText			= 1 << 4,
-	kDebugEvents		= 1 << 5,
-	kDebugParse			= 1 << 6,
-	kDebugCompileOnly	= 1 << 7,
-	kDebugSlow			= 1 << 8,
-	kDebugFast			= 1 << 9,
-	kDebugNoLoop		= 1 << 10,
-	kDebugNoBytecode	= 1 << 11,
-	kDebugFewFramesOnly	= 1 << 12,
-	kDebugPreprocess	= 1 << 13,
-	kDebugScreenshot	= 1 << 14,
-	kDebugDesktop		= 1 << 15,
-	kDebug32bpp			= 1 << 16,
-	kDebugEndVideo		= 1 << 17,
-	kDebugLingoStrict	= 1 << 18,
-	kDebugSound			= 1 << 19,
-	kDebugConsole		= 1 << 20,
-	kDebugXObj			= 1 << 21,
-	kDebugLingoThe		= 1 << 22,
+	kDebugLingoExec	= 1,
+	kDebugCompile,
+	kDebugLoading,
+	kDebugImages,
+	kDebugText,
+	kDebugEvents,
+	kDebugParse,
+	kDebugCompileOnly,
+	kDebugSlow,
+	kDebugFast,
+	kDebugNoLoop,
+	kDebugNoBytecode,
+	kDebugFewFramesOnly,
+	kDebugPreprocess,
+	kDebugScreenshot,
+	kDebugDesktop,
+	kDebug32bpp,
+	kDebugEndVideo,
+	kDebugLingoStrict,
+	kDebugSound,
+	kDebugConsole,
+	kDebugXObj,
+	kDebugLingoThe,
 };
 
 enum {


Commit: b86688e71704b78dadefbe7dd5ded41dd1d4ae4f
    https://github.com/scummvm/scummvm/commit/b86688e71704b78dadefbe7dd5ded41dd1d4ae4f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-12-28T01:41:11+01:00

Commit Message:
CREATE_ENGINE: Switch debug channels to a sequential enum

Changed paths:
    devtools/create_engine/files/detection.h


diff --git a/devtools/create_engine/files/detection.h b/devtools/create_engine/files/detection.h
index 83fbbcb6cd8..d43ef0df3d5 100644
--- a/devtools/create_engine/files/detection.h
+++ b/devtools/create_engine/files/detection.h
@@ -27,11 +27,11 @@
 namespace Xyzzy {
 
 enum XyzzyDebugChannels {
-	kDebugGraphics = 1 << 0,
-	kDebugPath     = 1 << 1,
-	kDebugScan     = 1 << 2,
-	kDebugFilePath = 1 << 3,
-	kDebugScript   = 1 << 4,
+	kDebugGraphics = 1,
+	kDebugPath,
+	kDebugScan,
+	kDebugFilePath,
+	kDebugScript,
 };
 
 extern const PlainGameDescriptor xyzzyGames[];




More information about the Scummvm-git-logs mailing list