[Scummvm-git-logs] scummvm master -> a34c32fb4d36979e5a532820742afe764a42fe35
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:
6185d95f6d SWORD25: Fix heap overflow on savegameame load
9266715f46 SWORD25: Improved debug output
2704fcee98 SWORD25: Avoid double free on macOS and maybe other platforms on exit
a34c32fb4d SWORD25: Properly implement background sound looping. Fixes bug #15424
Commit: 6185d95f6dc45a72f94ca72a16c70f81356ed4c0
https://github.com/scummvm/scummvm/commit/6185d95f6dc45a72f94ca72a16c70f81356ed4c0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-11-24T23:09:01+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: 9266715f4642c6a7a831ec1320a5bcac40bc5d81
https://github.com/scummvm/scummvm/commit/9266715f4642c6a7a831ec1320a5bcac40bc5d81
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-11-24T23:09:01+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: 2704fcee987b167aac496ba13271382c638549cb
https://github.com/scummvm/scummvm/commit/2704fcee987b167aac496ba13271382c638549cb
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-11-24T23:09:01+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: a34c32fb4d36979e5a532820742afe764a42fe35
https://github.com/scummvm/scummvm/commit/a34c32fb4d36979e5a532820742afe764a42fe35
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-11-24T23:09:01+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