[Scummvm-git-logs] scummvm branch-2-9 -> 5dfc17cc8fdcb72c96d96a6985963a638f8b0851

sev- noreply at scummvm.org
Sun Nov 24 22:09:13 UTC 2024


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

Summary:
775990bdac SWORD25: Fix heap overflow on savegameame load
c3c5e974c4 SWORD25: Improved debug output
2b6ced5646 SWORD25: Avoid double free on macOS and maybe other platforms on exit
5dfc17cc8f SWORD25: Properly implement background sound looping. Fixes bug #15424


Commit: 775990bdac49833b64655163a718e17b0d0c22a5
    https://github.com/scummvm/scummvm/commit/775990bdac49833b64655163a718e17b0d0c22a5
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-11-24T22:42:45+01:00

Commit Message:
SWORD25: Fix heap overflow on savegameame load

Changed paths:
    engines/sword25/gfx/image/imgloader.cpp


diff --git a/engines/sword25/gfx/image/imgloader.cpp b/engines/sword25/gfx/image/imgloader.cpp
index 3c8083e3435..76d3eeca918 100644
--- a/engines/sword25/gfx/image/imgloader.cpp
+++ b/engines/sword25/gfx/image/imgloader.cpp
@@ -46,7 +46,7 @@ bool ImgLoader::decodePNGImage(const byte *fileDataPtr, uint fileSize, Graphics:
 		error("Error while reading PNG image");
 
 	const Graphics::Surface *sourceSurface = png.getSurface();
-	Graphics::Surface *pngSurface = sourceSurface->convertTo(Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0), png.getPalette());
+	Graphics::Surface *pngSurface = sourceSurface->convertTo(Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0), png.getPalette(), png.getPaletteColorCount());
 
 	dest->copyFrom(*pngSurface);
 


Commit: c3c5e974c40ed7a4c411b60af5f8ba88f05cab37
    https://github.com/scummvm/scummvm/commit/c3c5e974c40ed7a4c411b60af5f8ba88f05cab37
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-11-24T23:08:31+01:00

Commit Message:
SWORD25: Improved debug output

Changed paths:
    engines/sword25/sfx/soundengine.cpp


diff --git a/engines/sword25/sfx/soundengine.cpp b/engines/sword25/sfx/soundengine.cpp
index 8ff8d646e03..a1b73ca7266 100644
--- a/engines/sword25/sfx/soundengine.cpp
+++ b/engines/sword25/sfx/soundengine.cpp
@@ -206,7 +206,7 @@ Audio::Mixer::SoundType getType(SoundEngine::SOUND_TYPES type) {
 }
 
 bool SoundEngine::playSound(const Common::String &fileName, SOUND_TYPES type, float volume, float pan, bool loop, int loopStart, int loopEnd, uint layer) {
-	debugC(1, kDebugSound, "SoundEngine::playSound(%s, %d, %f, %f, %d, %d, %d, %d)", fileName.c_str(), type, volume, pan, loop, loopStart, loopEnd, layer);
+	debugC(1, kDebugSound, "SoundEngine::playSound(filename='%s', type=%d, volume=%f, pan=%f, loop=%d, loopStart=%d, loopEnd=%d, layer=%d)", fileName.c_str(), type, volume, pan, loop, loopStart, loopEnd, layer);
 
 	playSoundEx(fileName, type, volume, pan, loop, loopStart, loopEnd, layer);
 
@@ -238,7 +238,7 @@ uint SoundEngine::playSoundEx(const Common::String &fileName, SOUND_TYPES type,
 	handle->loopEnd = loopEnd;
 	handle->layer = layer;
 
-	debugC(1, kDebugSound, "SoundEngine::playSoundEx(%s, %d, %f, %f, %d, %d, %d, %d)", fileName.c_str(), type, volume, pan, loop, loopStart, loopEnd, layer);
+	debugC(1, kDebugSound, "SoundEngine::playSoundEx(fileName='%s', type=%d, volume=%f, pan=%f, loop=%d, loopStart=%d, loopEnd=%d, layer=%d)", fileName.c_str(), type, volume, pan, loop, loopStart, loopEnd, layer);
 
 #ifdef USE_VORBIS
 	_mixer->playStream(getType(type), &(handle->handle), stream, -1, (byte)(volume * 255), (int8)(pan * 127));


Commit: 2b6ced5646439645a0bdd8c34f6c0e7f85cad5cb
    https://github.com/scummvm/scummvm/commit/2b6ced5646439645a0bdd8c34f6c0e7f85cad5cb
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-11-24T23:08:40+01:00

Commit Message:
SWORD25: Avoid double free on macOS and maybe other platforms on exit

Changed paths:
    engines/sword25/kernel/persistenceservice.cpp


diff --git a/engines/sword25/kernel/persistenceservice.cpp b/engines/sword25/kernel/persistenceservice.cpp
index 4f843c53ff8..8dd1dfa2a90 100644
--- a/engines/sword25/kernel/persistenceservice.cpp
+++ b/engines/sword25/kernel/persistenceservice.cpp
@@ -180,9 +180,13 @@ struct PersistenceService::Impl {
 	}
 };
 
+PersistenceService *persInstance = nullptr;
+
 PersistenceService &PersistenceService::getInstance() {
-	static PersistenceService instance;
-	return instance;
+	if (!persInstance)
+		persInstance = new PersistenceService;
+
+	return *persInstance;
 }
 
 PersistenceService::PersistenceService() : _impl(new Impl) {
@@ -190,6 +194,9 @@ PersistenceService::PersistenceService() : _impl(new Impl) {
 
 PersistenceService::~PersistenceService() {
 	delete _impl;
+
+	delete persInstance;
+	persInstance = nullptr;
 }
 
 void PersistenceService::reloadSlots() {


Commit: 5dfc17cc8fdcb72c96d96a6985963a638f8b0851
    https://github.com/scummvm/scummvm/commit/5dfc17cc8fdcb72c96d96a6985963a638f8b0851
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-11-24T23:08:48+01:00

Commit Message:
SWORD25: Properly implement background sound looping. Fixes bug #15424

Changed paths:
    engines/sword25/sfx/soundengine.cpp


diff --git a/engines/sword25/sfx/soundengine.cpp b/engines/sword25/sfx/soundengine.cpp
index a1b73ca7266..42eb3c850d4 100644
--- a/engines/sword25/sfx/soundengine.cpp
+++ b/engines/sword25/sfx/soundengine.cpp
@@ -217,10 +217,6 @@ uint SoundEngine::playSoundEx(const Common::String &fileName, SOUND_TYPES type,
 	if (type == MUSIC && _noMusic)
 		return 0;
 
-#ifdef USE_VORBIS
-	Common::SeekableReadStream *in = Kernel::getInstance()->getPackage()->getStream(fileName);
-	Audio::SeekableAudioStream *stream = Audio::makeVorbisStream(in, DisposeAfterUse::YES);
-#endif
 	uint id = handleId;
 	SndHandle *handle;
 
@@ -241,7 +237,17 @@ uint SoundEngine::playSoundEx(const Common::String &fileName, SOUND_TYPES type,
 	debugC(1, kDebugSound, "SoundEngine::playSoundEx(fileName='%s', type=%d, volume=%f, pan=%f, loop=%d, loopStart=%d, loopEnd=%d, layer=%d)", fileName.c_str(), type, volume, pan, loop, loopStart, loopEnd, layer);
 
 #ifdef USE_VORBIS
-	_mixer->playStream(getType(type), &(handle->handle), stream, -1, (byte)(volume * 255), (int8)(pan * 127));
+	Common::SeekableReadStream *in = Kernel::getInstance()->getPackage()->getStream(fileName);
+
+	Audio::SeekableAudioStream *stream = Audio::makeVorbisStream(in, DisposeAfterUse::YES);
+
+	if (loop) {
+		Audio::AudioStream *audio = new Audio::LoopingAudioStream(stream, 0, DisposeAfterUse::YES);
+
+		_mixer->playStream(getType(type), &(handle->handle), audio, -1, (byte)(volume * 255), (int8)(pan * 127));
+	} else {
+		_mixer->playStream(getType(type), &(handle->handle), stream, -1, (byte)(volume * 255), (int8)(pan * 127));
+	}
 #endif
 
 	return id;




More information about the Scummvm-git-logs mailing list