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

mgerhardy noreply at scummvm.org
Sat Oct 17 16:32:20 UTC 2026


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

Summary:
e338649289 MACS2: resume the music after loading


Commit: e33864928985ae869e64a8ee20c367f2a290f78b
    https://github.com/scummvm/scummvm/commit/e33864928985ae869e64a8ee20c367f2a290f78b
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2026-10-17T18:31:13+02:00

Commit Message:
MACS2: resume the music after loading

this was previously only working for the original menus - and
not when loading via gmm - this might fix #17336

might because I currently can't properly test sound stuff
in my current setup

Changed paths:
    engines/macs2/saveload.cpp
    engines/macs2/scriptexecutor.cpp
    engines/macs2/scriptexecutor.h
    engines/macs2/view1.cpp


diff --git a/engines/macs2/saveload.cpp b/engines/macs2/saveload.cpp
index fc3c40703e5..379f49a2e6e 100644
--- a/engines/macs2/saveload.cpp
+++ b/engines/macs2/saveload.cpp
@@ -785,6 +785,10 @@ Common::Error Macs2Engine::syncGameV1(Common::Serializer &s) {
 			view1->startFadingWithSpeed(8);
 		}
 		view1->presentFrame();
+
+		// Binary resumes music only when closing the save/load panel (button 7).
+		// ScummVM launcher/GMM/ActionBar loads never hit that path, so restart here.
+		_scriptExecutor->resumeActiveMusic();
 	}
 
 	return Common::kNoError;
diff --git a/engines/macs2/scriptexecutor.cpp b/engines/macs2/scriptexecutor.cpp
index aea4496357a..3cf99667445 100644
--- a/engines/macs2/scriptexecutor.cpp
+++ b/engines/macs2/scriptexecutor.cpp
@@ -2865,6 +2865,28 @@ OpcodeResult Script::ScriptExecutor::scriptStopPcmSound() {
 	return OpcodeResult::Continue;
 }
 
+bool Script::ScriptExecutor::resumeActiveMusic() {
+	// Mirrors the original save/load panel close (button 7): if music is enabled
+	// and the sound system is active, restart the saved active music slot.
+	if (!_musicEnabled || !_soundSystemActive)
+		return false;
+
+	const uint16 slot = _activeMusicSlot;
+	if (slot < 1 || slot > 2 || _musicSlots[slot - 1].empty())
+		return false;
+
+	if (!_engine->getMusic()->playSongData(_musicSlots[slot - 1]))
+		return false;
+
+	// Original adlibTickHandler resets master volume to 0 (full). ScummVM layers
+	// user volume on top via scaledMusicVolume.
+	_musicControlMode = 0;
+	_musicControlStep = 0;
+	_musicControlVolume = 0;
+	_engine->getMusic()->setVolume(_engine->scaledMusicVolume(0));
+	return true;
+}
+
 OpcodeResult Script::ScriptExecutor::scriptLoadMusicSlot() {
 	const uint16 slotID = scriptReadValue16();
 	const uint8 resourceIndex = readByte();
diff --git a/engines/macs2/scriptexecutor.h b/engines/macs2/scriptexecutor.h
index 65a9921d90b..0e43d2c414c 100644
--- a/engines/macs2/scriptexecutor.h
+++ b/engines/macs2/scriptexecutor.h
@@ -511,6 +511,13 @@ public:
 
 	Macs2::Macs2Engine *_engine;
 
+	/**
+	 * Restart the active music slot if music is enabled and the system is active.
+	 * Used after save load and when closing the original save/load panel (button 7).
+	 * Returns true if playback was started.
+	 */
+	bool resumeActiveMusic();
+
 	// Button 8 skip from handleInput (1008:e8bf)
 	bool skipToEndOfSkippableSection();
 
diff --git a/engines/macs2/view1.cpp b/engines/macs2/view1.cpp
index e64bc06a682..0a36ea26dbc 100644
--- a/engines/macs2/view1.cpp
+++ b/engines/macs2/view1.cpp
@@ -3865,17 +3865,7 @@ void View1::handleOriginalSaveLoadClick(const Common::Point &pos) {
 				}
 			} else if (i == 7) {
 				// Binary: if music enabled AND sound active, play active music
-				if (exec->_musicEnabled && exec->_soundSystemActive) {
-					const uint16 slot = exec->_activeMusicSlot;
-					if (slot != 0 && !exec->_musicSlots[slot - 1].empty() &&
-						g_engine->getMusic()->playSongData(exec->_musicSlots[slot - 1])) {
-						// Original's adlibTickHandler resets g_bAdlibMasterVolume=0 (full volume).
-						// ScummVM layers user volume on top via scaledMusicVolume, so re-apply it.
-						exec->_musicControlMode = 0;
-						exec->_musicControlVolume = 0;
-						g_engine->getMusic()->setVolume(g_engine->scaledMusicVolume(0));
-					}
-				}
+				exec->resumeActiveMusic();
 			}
 		} else {
 			// Button NOT hit - reset confirm flags for buttons 5/6




More information about the Scummvm-git-logs mailing list