diff --git a/gzdoom/0001-Fix-libxmp-playback.patch b/gzdoom/0001-Fix-libxmp-playback.patch new file mode 100644 index 00000000..cf778797 --- /dev/null +++ b/gzdoom/0001-Fix-libxmp-playback.patch @@ -0,0 +1,27 @@ +From f6facdaa683e7159b7569d5287a088da352a7c92 Mon Sep 17 00:00:00 2001 +From: Andrew Rabert +Date: Sat, 11 Jan 2025 00:26:08 -0500 +Subject: [PATCH] Fix libxmp playback Fixes crashing when the int16_buffer is + smaller than the desired len. Particularly, I was seeing the int16_buffer + with a size of 0. + +--- + source/streamsources/music_libxmp.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/source/streamsources/music_libxmp.cpp b/source/streamsources/music_libxmp.cpp +index e235b06..999e046 100644 +--- a/source/streamsources/music_libxmp.cpp ++++ b/source/streamsources/music_libxmp.cpp +@@ -126,7 +126,7 @@ bool XMPSong::SetSubsong(int subsong) + + bool XMPSong::GetData(void *buffer, size_t len) + { +- if ((len / 4) < int16_buffer.size()) ++ if ((len / 4) > int16_buffer.size()) + int16_buffer.resize(len / 4); + + int ret = xmp_play_buffer(context, (void*)int16_buffer.data(), len / 2, m_Looping? INT_MAX : 0); +-- +2.47.1 + diff --git a/gzdoom/zmusic.json b/gzdoom/zmusic.json index 00c281cb..8ab443b9 100644 --- a/gzdoom/zmusic.json +++ b/gzdoom/zmusic.json @@ -15,6 +15,10 @@ "stable-only": true, "url-template": "https://github.com/zdoom/ZMusic/archive/$version.tar.gz" } + }, + { + "type": "patch", + "path": "0001-Fix-libxmp-playback.patch" } ] }