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

bluegr noreply at scummvm.org
Thu Jun 2 08:20:00 UTC 2022


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

Summary:
cab7e386f2 SCI: fix regression from c2975276 (fix music handling during auto-save)


Commit: cab7e386f2f79bc608e28a273dc7c96902ce3afa
    https://github.com/scummvm/scummvm/commit/cab7e386f2f79bc608e28a273dc7c96902ce3afa
Author: athrxx (athrxx at scummvm.org)
Date: 2022-06-02T11:19:58+03:00

Commit Message:
SCI: fix regression from c2975276 (fix music handling during auto-save)

This is really a necessary fix, so recommended for merging before the release.

The negative global pause counter (that I really added only for the GMM/autosave situation) may not be used from within kDoSoundPause. It causes issues, the counter will go out of the expected range (also, the "Music also seems to randomly disappear when saving / restoring games" mentioned in ticket no. 13496 might be related to this).

I didn't see this, since we were focussed on SCI0. But it can be easily tested with e. g. LSL1 VGA. Just save right at the start and restore the game, it will call kDoSoundPause and trigger the issue...

Changed paths:
    engines/sci/sound/music.h
    engines/sci/sound/soundcmd.cpp


diff --git a/engines/sci/sound/music.h b/engines/sci/sound/music.h
index f30d7d5cd3b..3fd988d69da 100644
--- a/engines/sci/sound/music.h
+++ b/engines/sci/sound/music.h
@@ -193,6 +193,7 @@ private:
 public:
 	void clearPlayList();
 	void pauseAll(bool pause);
+	bool isAllPaused() const { return (_globalPause > 0); }
 	void resetGlobalPauseCounter();
 	void stopAll();
 	void stopAllSamples();
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index 12cc153d9c9..1a8d9b35119 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -369,7 +369,11 @@ reg_t SoundCommandParser::kDoSoundPause(EngineState *s, int argc, reg_t *argv) {
 		(_soundVersion < SCI_VERSION_2 && !obj.getSegment()) ||
 		(_soundVersion >= SCI_VERSION_2 && obj.isNull())
 	) {
-		_music->pauseAll(shouldPause);
+		// Don't unpause here, if the sound is already unpaused. The negative global pause counter
+		// that we introduced to accomodate our special needs during GMM save/load and autosave
+		// operations is not meant to be used here and will cause glitches.
+		if (_music->isAllPaused() || shouldPause)
+			_music->pauseAll(shouldPause);
 #ifdef ENABLE_SCI32
 		if (_soundVersion >= SCI_VERSION_2_1_EARLY) {
 			if (shouldPause) {




More information about the Scummvm-git-logs mailing list