[Scummvm-git-logs] scummvm master -> 51d52b1680f184f6bfb3c09aa74c8428f1559263

athrxx noreply at scummvm.org
Thu Jan 2 16:39:04 UTC 2025


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

Summary:
4f31b1e4ff SCUMM: (v6/7/Mac) - sync mute setting between GMM and Mac gui
51d52b1680 SCI: (CGA/Hercules) - fix value clipping typo


Commit: 4f31b1e4ffddf18c0e57fd31cf83493d8c328b8a
    https://github.com/scummvm/scummvm/commit/4f31b1e4ffddf18c0e57fd31cf83493d8c328b8a
Author: athrxx (athrxx at scummvm.org)
Date: 2025-01-02T17:37:32+01:00

Commit Message:
SCUMM: (v6/7/Mac) - sync mute setting between GMM and Mac gui

The GMM has a "mute all" checkbox, the Mac gui allows muting sfx
and music separately. This commit aims at getting these options in
sync.

Changed paths:
    engines/scumm/macgui/macgui_v6.cpp
    engines/scumm/scumm.cpp


diff --git a/engines/scumm/macgui/macgui_v6.cpp b/engines/scumm/macgui/macgui_v6.cpp
index 04ee75c7829..ec18eb71d8e 100644
--- a/engines/scumm/macgui/macgui_v6.cpp
+++ b/engines/scumm/macgui/macgui_v6.cpp
@@ -194,14 +194,16 @@ bool MacV6Gui::handleMenu(int id, Common::String &name) {
 		return true;
 
 	case 500:	// Music
-		_vm->_soundEnabled ^= 2;
+		_vm->_soundEnabled = (_vm->_soundEnabled & ~8) ^ 2;
 		ConfMan.setBool("music_mute", !(_vm->_soundEnabled & 2));
+		ConfMan.setBool("mute", (_vm->_soundEnabled == 0 && _vm->_voiceMode == 2));
 		syncSoundSettings = true;
 		break;
 
 	case 501:	// Effects
-		_vm->_soundEnabled ^= 1;
+		_vm->_soundEnabled = (_vm->_soundEnabled & ~8) ^ 1;
 		ConfMan.setBool("sfx_mute", !(_vm->_soundEnabled & 1));
+		ConfMan.setBool("mute", (_vm->_soundEnabled == 0 && _vm->_voiceMode == 2));
 		syncSoundSettings = true;
 		break;
 
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 8ee6db85093..441fa526f55 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -2423,18 +2423,11 @@ void ScummEngine::syncSoundSettings() {
 	int soundVolumeMusic = ConfMan.getInt("music_volume");
 	int soundVolumeSfx = ConfMan.getInt("sfx_volume");
 
-	bool mute = false;
-
-	if (ConfMan.hasKey("mute")) {
-		mute = ConfMan.getBool("mute");
-
-		if (mute)
-			soundVolumeMusic = soundVolumeSfx = 0;
-	}
-
-	_soundEnabled = ((ConfMan.hasKey("music_mute") && ConfMan.getBool("music_mute")) ? 0 : 2) | ((ConfMan.hasKey("sfx_mute") && ConfMan.getBool("sfx_mute")) ? 0 : 1);
+	bool mute = (ConfMan.hasKey("mute") && ConfMan.getBool("mute"));
 
 	if (_game.version >= 6 && _game.platform == Common::kPlatformMacintosh) {
+		_soundEnabled = mute ? 8 : ((ConfMan.hasKey("music_mute") && ConfMan.getBool("music_mute") && _soundEnabled != 8) ? 0 : 2) | ((ConfMan.hasKey("sfx_mute") && ConfMan.getBool("sfx_mute") && _soundEnabled != 8) ? 0 : 1);
+
 		if (_game.version == 6) {
 			if (!(_soundEnabled & 2))
 				soundVolumeMusic = 0;
@@ -2442,6 +2435,8 @@ void ScummEngine::syncSoundSettings() {
 			_mixer->muteSoundType(Audio::Mixer::kMusicSoundType, !(_soundEnabled & 2));
 		}
 		_mixer->muteSoundType(Audio::Mixer::kSFXSoundType, !(_soundEnabled & 1));
+	} else if (mute) {
+		soundVolumeMusic = soundVolumeSfx = 0;
 	}
 
 	if (_musicEngine) {


Commit: 51d52b1680f184f6bfb3c09aa74c8428f1559263
    https://github.com/scummvm/scummvm/commit/51d52b1680f184f6bfb3c09aa74c8428f1559263
Author: athrxx (athrxx at scummvm.org)
Date: 2025-01-02T17:37:39+01:00

Commit Message:
SCI: (CGA/Hercules) - fix value clipping typo

(not relevant in practice, since we don't pass invalid arguments,
but it unnecessarily triggers the static analyzers)

Changed paths:
    engines/sci/graphics/drivers/cgabw.cpp
    engines/sci/graphics/drivers/hercules.cpp


diff --git a/engines/sci/graphics/drivers/cgabw.cpp b/engines/sci/graphics/drivers/cgabw.cpp
index cab0c390eb5..3a7f9ef6ad8 100644
--- a/engines/sci/graphics/drivers/cgabw.cpp
+++ b/engines/sci/graphics/drivers/cgabw.cpp
@@ -213,7 +213,7 @@ GfxDriver *SCI0_CGABWDriver_create(int rgbRendering, ...) {
 	static const uint32 monochromeColors[] = { 0xffbf66, 0x66ff66, 0xffffff };
 	va_list args;
 	va_start(args, rgbRendering);
-	int config = CLIP<int>(va_arg(args, int), 0, ARRAYSIZE(monochromeColors));
+	int config = CLIP<int>(va_arg(args, int), 0, ARRAYSIZE(monochromeColors) - 1);
 	va_end(args);
 
 	return new SCI0_CGABWDriver(monochromeColors[config], rgbRendering != 0);
diff --git a/engines/sci/graphics/drivers/hercules.cpp b/engines/sci/graphics/drivers/hercules.cpp
index 116b5a95ee9..f5731a87ba6 100644
--- a/engines/sci/graphics/drivers/hercules.cpp
+++ b/engines/sci/graphics/drivers/hercules.cpp
@@ -187,7 +187,7 @@ GfxDriver *SCI0_HerculesDriver_create(int rgbRendering, ...) {
 	static const uint32 monochromeColors[] = { 0xffbf66, 0x66ff66, 0xffffff };
 	va_list args;
 	va_start(args, rgbRendering);
-	int config = CLIP<int>(va_arg(args, int), 0, ARRAYSIZE(monochromeColors));
+	int config = CLIP<int>(va_arg(args, int), 0, ARRAYSIZE(monochromeColors) - 1);
 	va_end(args);
 
 	return new SCI0_HerculesDriver(monochromeColors[config], rgbRendering != 0, false);




More information about the Scummvm-git-logs mailing list