Skip to content

Commit f1ad050

Browse files
authored
Patch for a compatibility problem (#365)
flathub/org.zdoom.GZDoom#78
1 parent bfd248a commit f1ad050

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
From f6facdaa683e7159b7569d5287a088da352a7c92 Mon Sep 17 00:00:00 2001
2+
From: Andrew Rabert <[email protected]>
3+
Date: Sat, 11 Jan 2025 00:26:08 -0500
4+
Subject: [PATCH] Fix libxmp playback Fixes crashing when the int16_buffer is
5+
smaller than the desired len. Particularly, I was seeing the int16_buffer
6+
with a size of 0.
7+
8+
---
9+
source/streamsources/music_libxmp.cpp | 2 +-
10+
1 file changed, 1 insertion(+), 1 deletion(-)
11+
12+
diff --git a/source/streamsources/music_libxmp.cpp b/source/streamsources/music_libxmp.cpp
13+
index e235b06..999e046 100644
14+
--- a/source/streamsources/music_libxmp.cpp
15+
+++ b/source/streamsources/music_libxmp.cpp
16+
@@ -126,7 +126,7 @@ bool XMPSong::SetSubsong(int subsong)
17+
18+
bool XMPSong::GetData(void *buffer, size_t len)
19+
{
20+
- if ((len / 4) < int16_buffer.size())
21+
+ if ((len / 4) > int16_buffer.size())
22+
int16_buffer.resize(len / 4);
23+
24+
int ret = xmp_play_buffer(context, (void*)int16_buffer.data(), len / 2, m_Looping? INT_MAX : 0);
25+
--
26+
2.47.1
27+

gzdoom/zmusic.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
"stable-only": true,
1616
"url-template": "https://github.com/zdoom/ZMusic/archive/$version.tar.gz"
1717
}
18+
},
19+
{
20+
"type": "patch",
21+
"path": "0001-Fix-libxmp-playback.patch"
1822
}
1923
]
2024
}

0 commit comments

Comments
 (0)