[Scummvm-git-logs] scummvm master -> 76161cce3f334c6ef3225d9e732cba91db5c12f9

bluegr bluegr at gmail.com
Sun May 24 09:46:20 UTC 2020


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:
a4e01b46f4 SCI: fix #10907 - Wrong music when restoring games
76161cce3f SCI: Adjust comment


Commit: a4e01b46f4a6eb5885dc0dd1faf4985342162727
    https://github.com/scummvm/scummvm/commit/a4e01b46f4a6eb5885dc0dd1faf4985342162727
Author: Zvika Haramaty (haramaty.zvika at gmail.com)
Date: 2020-05-24T12:42:58+03:00

Commit Message:
SCI: fix #10907 - Wrong music when restoring games

Changed paths:
    engines/sci/engine/savegame.cpp
    engines/sci/sound/soundcmd.cpp
    engines/sci/sound/soundcmd.h


diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 3308f59027..9ebebb3848 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -752,7 +752,7 @@ void SoundCommandParser::reconstructPlayList() {
 			if (_soundVersion >= SCI_VERSION_1_EARLY)
 				writeSelectorValue(_segMan, entry->soundObj, SELECTOR(vol), entry->volume);
 
-			processPlaySound(entry->soundObj, entry->playBed);
+			processPlaySound(entry->soundObj, entry->playBed, true);
 		}
 	}
 }
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index 8b5ed42c1c..e96db19e35 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -175,7 +175,7 @@ reg_t SoundCommandParser::kDoSoundPlay(EngineState *s, int argc, reg_t *argv) {
 	return s->r_acc;
 }
 
-void SoundCommandParser::processPlaySound(reg_t obj, bool playBed) {
+void SoundCommandParser::processPlaySound(reg_t obj, bool playBed, bool restoring) {
 	MusicEntry *musicSlot = _music->getSlot(obj);
 	if (!musicSlot) {
 		warning("kDoSound(play): Slot not found (%04x:%04x), initializing it manually", PRINT_REG(obj));
@@ -188,7 +188,14 @@ void SoundCommandParser::processPlaySound(reg_t obj, bool playBed) {
 			error("Failed to initialize uninitialized sound slot");
 	}
 
-	int resourceId = getSoundResourceId(obj);
+	int resourceId;
+	if (!restoring)
+		resourceId = getSoundResourceId(obj);
+	else
+		// fix bug #10907 - the game was saved while track A was playing, but track B was initialized, waiting to be played later
+		// therefore, musicSlot->resourceId reflects the actual track that was playing (A), while getSoundResourceId(obj)
+		// is reflecting the track that's waiting to be played later (B)
+		resourceId = musicSlot->resourceId;
 
 	if (musicSlot->resourceId != resourceId) { // another sound loaded into struct
 		processDisposeSound(obj);
diff --git a/engines/sci/sound/soundcmd.h b/engines/sci/sound/soundcmd.h
index cac3ff794b..23556877d7 100644
--- a/engines/sci/sound/soundcmd.h
+++ b/engines/sci/sound/soundcmd.h
@@ -66,7 +66,7 @@ public:
 	void printPlayList(Console *con);
 	void printSongInfo(reg_t obj, Console *con);
 
-	void processPlaySound(reg_t obj, bool playBed);
+	void processPlaySound(reg_t obj, bool playBed, bool restoring = false);
 	void processStopSound(reg_t obj, bool sampleFinishedPlaying);
 	void initSoundResource(MusicEntry *newSound);
 


Commit: 76161cce3f334c6ef3225d9e732cba91db5c12f9
    https://github.com/scummvm/scummvm/commit/76161cce3f334c6ef3225d9e732cba91db5c12f9
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2020-05-24T12:42:59+03:00

Commit Message:
SCI: Adjust comment

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


diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index e96db19e35..1ab9658c8b 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -192,9 +192,9 @@ void SoundCommandParser::processPlaySound(reg_t obj, bool playBed, bool restorin
 	if (!restoring)
 		resourceId = getSoundResourceId(obj);
 	else
-		// fix bug #10907 - the game was saved while track A was playing, but track B was initialized, waiting to be played later
-		// therefore, musicSlot->resourceId reflects the actual track that was playing (A), while getSoundResourceId(obj)
-		// is reflecting the track that's waiting to be played later (B)
+		// Handle cases where a game was saved while track A was playing, but track B was initialized, waiting to be played later.
+		// In such cases, musicSlot->resourceId contains the actual track that was playing (A), while getSoundResourceId(obj)
+		// contains the track that's waiting to be played later (B) - bug #10907.
 		resourceId = musicSlot->resourceId;
 
 	if (musicSlot->resourceId != resourceId) { // another sound loaded into struct




More information about the Scummvm-git-logs mailing list