diff --git a/patches/dmime-PChannel-range/0001-dmime-Ensure-Channels-are-in-range-before-assignment.patch b/patches/dmime-PChannel-range/0001-dmime-Ensure-Channels-are-in-range-before-assignment.patch new file mode 100644 index 00000000..284ddb4d --- /dev/null +++ b/patches/dmime-PChannel-range/0001-dmime-Ensure-Channels-are-in-range-before-assignment.patch @@ -0,0 +1,45 @@ +From 6a4d40b86f94703f8c37264739fffc4885507ebf Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Tue, 17 Sep 2019 16:21:22 +1000 +Subject: [PATCH] dmime: Ensure Channels are in range before assignment. + +Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=17766 +Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=24740 +--- + dlls/dmime/performance.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c +index 6e4dae6be7..3bbbb3b853 100644 +--- a/dlls/dmime/performance.c ++++ b/dlls/dmime/performance.c +@@ -34,7 +34,7 @@ typedef struct IDirectMusicPerformance8Impl { + float fMasterTempo; + long lMasterVolume; + /* performance channels */ +- DMUSIC_PRIVATE_PCHANNEL PChannel[32]; ++ DMUSIC_PRIVATE_PCHANNEL PChannel[256]; + /* IDirectMusicPerformance8Impl fields */ + IDirectMusicAudioPath *pDefaultPath; + HANDLE hNotification; +@@ -624,6 +624,9 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_AssignPChannelBlock(IDirectMu + FIXME("(%p, %d, %p, %d): semi-stub\n", This, dwBlockNum, pPort, dwGroup-1); + if (NULL == pPort) return E_POINTER; + ++ if (dwBlockNum > ARRAY_SIZE(This->PChannel)) ++ return S_FALSE; ++ + range = 16 * dwBlockNum; + j = 0; + for (i = range; i < range+16; i++) { +@@ -633,7 +636,6 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_AssignPChannelBlock(IDirectMu + This->PChannel[i].channel = j; /* FIXME: should this be assigned? */ + j++; + } +- /*if (dwGroup > 2) return S_FALSE;*/ + + return S_OK; + } +-- +2.17.1 + diff --git a/patches/dmime-PChannel-range/definition b/patches/dmime-PChannel-range/definition new file mode 100644 index 00000000..a9fcc6a3 --- /dev/null +++ b/patches/dmime-PChannel-range/definition @@ -0,0 +1,2 @@ +Fixes: [17766] Empire Earth crashes on start without native directmusic +Fixes: [24740] Trinklet Supreme crashes on startup diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 42935a65..b7af45b9 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -135,6 +135,7 @@ patch_enable_all () enable_dinput_reconnect_joystick="$1" enable_dinput_remap_joystick="$1" enable_directmanipulation_new_dll="$1" + enable_dmime_PChannel_range="$1" enable_dsound_EAX="$1" enable_dsound_Fast_Mixer="$1" enable_dwmapi_DwmGetTransportAttributes="$1" @@ -532,6 +533,9 @@ patch_enable () directmanipulation-new-dll) enable_directmanipulation_new_dll="$2" ;; + dmime-PChannel-range) + enable_dmime_PChannel_range="$2" + ;; dsound-EAX) enable_dsound_EAX="$2" ;; @@ -3191,6 +3195,22 @@ if test "$enable_directmanipulation_new_dll" -eq 1; then ) >> "$patchlist" fi +# Patchset dmime-PChannel-range +# | +# | This patchset fixes the following Wine bugs: +# | * [#17766] Empire Earth crashes on start without native directmusic +# | * [#24740] Trinklet Supreme crashes on startup +# | +# | Modified files: +# | * dlls/dmime/performance.c +# | +if test "$enable_dmime_PChannel_range" -eq 1; then + patch_apply dmime-PChannel-range/0001-dmime-Ensure-Channels-are-in-range-before-assignment.patch + ( + printf '%s\n' '+ { "Alistair Leslie-Hughes", "dmime: Ensure Channels are in range before assignment.", 1 },'; + ) >> "$patchlist" +fi + # Patchset dsound-Fast_Mixer # | # | This patchset fixes the following Wine bugs: