[Scummvm-git-logs] scummvm master -> 7cbdbcad8282afae353c4ca4a425168165d5b0af

sev- noreply at scummvm.org
Fri Oct 10 23:40:17 UTC 2025


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

Summary:
e5b06d7680 COMMON: FORMAT: Avoid adding '\0' to strings when partsing WinExe version
d99c8b5139 DIRECTOR: LINGO: Implement 'the spriteNum' fr behaviors
9bce21ebd8 DIRECTOR: Fix parsing media format name from CastInfo
966f2e0177 DIRECTOR: Implemented ediM sound parsing, so far for AIFF sounds
973e1fb9af DIRECTOR: Let MoaStreamDecoder own the cast member stream
7cbdbcad82 DIRECTOR: Implement proper handling of main sound channels


Commit: e5b06d7680e647e9b4c9cddc20a9ff9b4d60de37
    https://github.com/scummvm/scummvm/commit/e5b06d7680e647e9b4c9cddc20a9ff9b4d60de37
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-10-10T20:31:21+02:00

Commit Message:
COMMON: FORMAT: Avoid adding '\0' to strings when partsing WinExe version

Changed paths:
    common/formats/winexe_pe.cpp


diff --git a/common/formats/winexe_pe.cpp b/common/formats/winexe_pe.cpp
index 65db10ee032..5736c69c45d 100644
--- a/common/formats/winexe_pe.cpp
+++ b/common/formats/winexe_pe.cpp
@@ -289,8 +289,11 @@ WinResources::VersionInfo *PEResources::parseVersionInfo(SeekableReadStream *res
 
 		if (type != 0) {	// text
 			Common::U32String value;
-			for (int j = 0; j < valLen; j++)
-				value += res->readUint16LE();
+			for (int j = 0; j < valLen; j++) {
+				uint16 ch = res->readUint16LE();
+				if (ch)
+					value += ch;
+			}
 
 			info->hash.setVal(key.encode(), value);
 		} else {


Commit: d99c8b513906a8801f7af52ad1912edbf99e4bf3
    https://github.com/scummvm/scummvm/commit/d99c8b513906a8801f7af52ad1912edbf99e4bf3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-10-10T22:22:50+02:00

Commit Message:
DIRECTOR: LINGO: Implement 'the spriteNum' fr behaviors

Changed paths:
    engines/director/lingo/lingo-object.cpp


diff --git a/engines/director/lingo/lingo-object.cpp b/engines/director/lingo/lingo-object.cpp
index bbc809a4da1..5149f7d72d0 100644
--- a/engines/director/lingo/lingo-object.cpp
+++ b/engines/director/lingo/lingo-object.cpp
@@ -579,7 +579,13 @@ bool ScriptContext::hasProp(const Common::String &propName) {
 				&& (_properties["ancestor"].u.obj->getObjType() & (kScriptObj | kXtraObj))) {
 			return _properties["ancestor"].u.obj->hasProp(propName);
 		}
+
+		// This is used by behaviors
+		if (propName.equalsIgnoreCase("spriteNum")) {
+			return true;
+		}
 	}
+
 	return false;
 }
 
@@ -596,6 +602,11 @@ Datum ScriptContext::getProp(const Common::String &propName) {
 			debugC(3, kDebugLingoExec, "Getting prop '%s' from ancestor: <%s>", propName.c_str(), _properties["ancestor"].asString(true).c_str());
 			return _properties["ancestor"].u.obj->getProp(propName);
 		}
+
+		// This is used by behaviors
+		if (propName.equalsIgnoreCase("spriteNum")) {
+			return Datum((int)g_director->getCurrentMovie()->_currentSpriteNum);
+		}
 	}
 	_propertyNames.push_back(propName);
 	return _properties[propName]; // return new property


Commit: 9bce21ebd887bf59e7ce6c2d0877af9ceeac39aa
    https://github.com/scummvm/scummvm/commit/9bce21ebd887bf59e7ce6c2d0877af9ceeac39aa
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-10-10T22:57:18+02:00

Commit Message:
DIRECTOR: Fix parsing media format name from CastInfo

Changed paths:
    engines/director/cast.cpp


diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index c6e124be85a..1a6a2639cd3 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -1934,7 +1934,7 @@ void Cast::loadCastInfo(Common::SeekableReadStreamEndian &stream, uint16 id) {
 		}
 		// fallthrough
 	case 16:
-		ci->mediaFormatName = castInfo.strings[2].readString();
+		ci->mediaFormatName = castInfo.strings[16].readString();
 		dumpS = Common::String::format("mediaFormatName: '%s', ", ci->mediaFormatName.c_str()) + dumpS;
 		// fallthrough
 	case 15:


Commit: 966f2e01773b3403a4d0f7ef37bb8561705fd4c9
    https://github.com/scummvm/scummvm/commit/966f2e01773b3403a4d0f7ef37bb8561705fd4c9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-10-11T00:06:35+02:00

Commit Message:
DIRECTOR: Implemented ediM sound parsing, so far for AIFF sounds

Changed paths:
    engines/director/castmember/sound.cpp
    engines/director/sound.cpp
    engines/director/sound.h


diff --git a/engines/director/castmember/sound.cpp b/engines/director/castmember/sound.cpp
index b4d50eb37b8..3e290ac3daa 100644
--- a/engines/director/castmember/sound.cpp
+++ b/engines/director/castmember/sound.cpp
@@ -107,7 +107,19 @@ void SoundCastMember::load() {
 				delete sndData;
 			} else if (it.tag == MKTAG('e', 'd', 'i', 'M')) {
 				Common::SeekableReadStreamEndian *sndData = _cast->getResource(it.tag, it.index);
-				warning("SoundCastMember::load(): STUB: ediM resource in sound cast member %d", _castId);
+				Common::String format =  _cast->getCastMemberInfo(_castId)->mediaFormatName.c_str();
+
+				if (!_audio) {
+					if (format.equalsIgnoreCase("kMoaCfFormat_AIFF")) {
+						_audio = new MoaStreamDecoder(format, sndData);
+						_loaded = true;
+						return;
+					} else {
+						warning("SoundCastMember::load(): Unsupported ediM format '%s' in sound cast member %d", format.c_str(), _castId);
+					}
+				} else {
+					warning("SoundCastMember::load(): Multiple ediM resources in sound cast member %d", _castId);
+				}
 				delete sndData;
 			}
 		}
diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp
index 76ba577ab6f..33b3e013ccc 100644
--- a/engines/director/sound.cpp
+++ b/engines/director/sound.cpp
@@ -976,8 +976,45 @@ Audio::AudioStream *AudioFileDecoder::getAudioStream(bool looping, bool forPuppe
 	return nullptr;
 }
 
-MoaSoundFormatDecoder::MoaSoundFormatDecoder() {
+MoaStreamDecoder::MoaStreamDecoder(Common::String &format, Common::SeekableReadStreamEndian *stream)
+		: AudioDecoder() {
+	_format = format;
+	_stream = stream;
+}
+
+MoaStreamDecoder::~MoaStreamDecoder() {
+	if (_stream) {
+		delete _stream;
+		_stream = nullptr;
+	}
+}
+
+Audio::AudioStream *MoaStreamDecoder::getAudioStream(bool looping, bool forPuppet, DisposeAfterUse::Flag disposeAfterUse) {
+	if (!_stream)
+		return nullptr;
+
+	// Make sure we're at the start of the stream
+	_stream->seek(0, SEEK_SET);
+
+	Audio::RewindableAudioStream *stream = nullptr;
+	if (_format.equalsIgnoreCase("kMoaCfFormat_AIFF")) {
+		stream = Audio::makeAIFFStream(_stream, disposeAfterUse);
+	} else {
+		warning("Unsupported Moa stream type '%s'", _format.c_str());
+		delete _stream;
+	}
+
+	if (stream) {
+		if (looping) {
+			return new Audio::LoopingAudioStream(stream, 0);
+		}
+		return stream;
+	}
+
+	return nullptr;
+}
 
+MoaSoundFormatDecoder::MoaSoundFormatDecoder() {
 }
 
 MoaSoundFormatDecoder::~MoaSoundFormatDecoder() {
diff --git a/engines/director/sound.h b/engines/director/sound.h
index 03daf800d72..d457b6aacd6 100644
--- a/engines/director/sound.h
+++ b/engines/director/sound.h
@@ -289,6 +289,18 @@ private:
 	Common::MacResManager *_macresman;
 };
 
+class MoaStreamDecoder : public AudioDecoder {
+public:
+	MoaStreamDecoder(Common::String &format, Common::SeekableReadStreamEndian *stream);
+	~MoaStreamDecoder();
+
+	Audio::AudioStream *getAudioStream(bool looping = false, bool forPuppet = false, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES) override;
+
+private:
+	Common::String _format;
+	Common::SeekableReadStreamEndian *_stream;
+};
+
 // Source: mixsnd.h in the Director 7 XDK
 struct MoaSoundFormat {
 	int32 offset;


Commit: 973e1fb9af20e0c0c1f6012d790b9e81c9daca87
    https://github.com/scummvm/scummvm/commit/973e1fb9af20e0c0c1f6012d790b9e81c9daca87
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-10-11T00:09:48+02:00

Commit Message:
DIRECTOR: Let MoaStreamDecoder own the cast member stream

Changed paths:
    engines/director/sound.cpp


diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp
index 33b3e013ccc..fdb7d1c6148 100644
--- a/engines/director/sound.cpp
+++ b/engines/director/sound.cpp
@@ -998,7 +998,7 @@ Audio::AudioStream *MoaStreamDecoder::getAudioStream(bool looping, bool forPuppe
 
 	Audio::RewindableAudioStream *stream = nullptr;
 	if (_format.equalsIgnoreCase("kMoaCfFormat_AIFF")) {
-		stream = Audio::makeAIFFStream(_stream, disposeAfterUse);
+		stream = Audio::makeAIFFStream(_stream, DisposeAfterUse::NO);
 	} else {
 		warning("Unsupported Moa stream type '%s'", _format.c_str());
 		delete _stream;


Commit: 7cbdbcad8282afae353c4ca4a425168165d5b0af
    https://github.com/scummvm/scummvm/commit/7cbdbcad8282afae353c4ca4a425168165d5b0af
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-10-11T01:39:36+02:00

Commit Message:
DIRECTOR: Implement proper handling of main sound channels

Perhaps, this behavior is the same for pre-D6, needs to be tested

Fixes skipping intro in melements

Changed paths:
    engines/director/score.cpp
    engines/director/score.h


diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index e33bf72e05a..651df313e30 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -694,6 +694,9 @@ void Score::update() {
 	if (!_vm->_playbackPaused)
 		killScriptInstances(_nextFrame ? _nextFrame : _curFrameNumber + 1);
 
+	CastMemberID oldSound1 = _currentFrame->_mainChannels.sound1;
+	CastMemberID oldSound2 = _currentFrame->_mainChannels.sound2;
+
 	// change current frame and load frame data, if required
 	updateCurrentFrame();
 
@@ -765,8 +768,23 @@ void Score::update() {
 		_disableGoPlayUpdateStage = prevDis;
 	}
 
+	bool sound1Changed = true;
+	bool sound2Changed = true;
+
+	if (_version >= kFileVer600 && !_firstRun) {
+		// We check if the sound channels have changed, and only restart
+		// the sound if they have. Even if the sound was stopped
+		//
+		// We need to check _firstRun, because we come here with the
+		// first frame already loaded.
+		sound1Changed = oldSound1 != _currentFrame->_mainChannels.sound1;
+		sound2Changed = oldSound2 != _currentFrame->_mainChannels.sound2;
+	}
+
+	_firstRun = false;
+
 	// Window is drawn between the prepareFrame and enterFrame events (Lingo in a Nutshell, p.100)
-	renderFrame(_curFrameNumber);
+	renderFrame(_curFrameNumber, kRenderModeNormal, sound1Changed, sound2Changed);
 	_window->_newMovieStarted = false;
 
 	// then call the stepMovie hook (if one exists)
@@ -823,7 +841,7 @@ void Score::update() {
 
 }
 
-void Score::renderFrame(uint16 frameId, RenderMode mode) {
+void Score::renderFrame(uint16 frameId, RenderMode mode, bool sound1Changed, bool sound2Changed) {
 	uint32 start = g_system->getMillis(false);
 	// Force cursor update if a new movie's started.
 	if (_window->_newMovieStarted)
@@ -848,7 +866,7 @@ void Score::renderFrame(uint16 frameId, RenderMode mode) {
 			renderPaletteCycle(mode);
 	}
 
-	playSoundChannel(false);
+	playSoundChannel(false, sound1Changed, sound2Changed);
 	playQueuedSound(); // this is currently only used in FPlayXObj
 
 	if (_cursorDirty) {
@@ -1757,7 +1775,7 @@ Channel *Score::getChannelById(uint16 id) {
 	return _channels[id];
 }
 
-void Score::playSoundChannel(bool puppetOnly) {
+void Score::playSoundChannel(bool puppetOnly, bool sound1Changed, bool sound2Changed) {
 	DirectorSound *sound = _window->getSoundManager();
 	CastMemberID sound1 = _currentFrame->_mainChannels.sound1;
 	CastMemberID sound2 = _currentFrame->_mainChannels.sound2;
@@ -1776,7 +1794,7 @@ void Score::playSoundChannel(bool puppetOnly) {
 
 	if (sound->isChannelPuppet(1)) {
 		sound->playPuppetSound(1);
-	} else if (!puppetOnly) {
+	} else if (!puppetOnly && sound1Changed) {
 		if (_currentFrame->_mainChannels.soundType1 >= kMinSampledMenu && _currentFrame->_mainChannels.soundType1 <= kMaxSampledMenu) {
 			sound->playExternalSound(_currentFrame->_mainChannels.soundType1, _currentFrame->_mainChannels.sound1.member, 1);
 		} else {
@@ -1786,7 +1804,7 @@ void Score::playSoundChannel(bool puppetOnly) {
 
 	if (sound->isChannelPuppet(2)) {
 		sound->playPuppetSound(2);
-	} else if (!puppetOnly) {
+	} else if (!puppetOnly && sound2Changed) {
 		if (_currentFrame->_mainChannels.soundType2 >= kMinSampledMenu && _currentFrame->_mainChannels.soundType2 <= kMaxSampledMenu) {
 			sound->playExternalSound(_currentFrame->_mainChannels.soundType2, _currentFrame->_mainChannels.sound2.member, 2);
 		} else {
diff --git a/engines/director/score.h b/engines/director/score.h
index 3c67966bf43..bec69ff42a8 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -127,7 +127,7 @@ public:
 	bool refreshPointersForCastLib(uint16 castLib);
 
 	bool renderTransition(uint16 frameId, RenderMode mode);
-	void renderFrame(uint16 frameId, RenderMode mode = kRenderModeNormal);
+	void renderFrame(uint16 frameId, RenderMode mode = kRenderModeNormal, bool sound1Changed = true, bool sound2Changed = true);
 	void incrementFilmLoops();
 	void updateSprites(RenderMode mode = kRenderModeNormal, bool withClean = false);
 	bool renderPrePaletteCycle(RenderMode mode = kRenderModeNormal);
@@ -139,7 +139,7 @@ public:
 
 	void invalidateRectsForMember(CastMember *member);
 
-	void playSoundChannel(bool puppetOnly);
+	void playSoundChannel(bool puppetOnly, bool sound1Changed = true, bool sound2Changed = true);
 
 	Common::String formatChannelInfo();
 	bool processFrozenPlayScript();
@@ -247,6 +247,7 @@ private:
 	DirectorSound *_soundManager;
 
 	int _previousBuildBotBuild = -1;
+	bool _firstRun = true;
 };
 
 } // End of namespace Director




More information about the Scummvm-git-logs mailing list