Added xactengine3_7-PrepareWave patchset

This commit is contained in:
Alistair Leslie-Hughes 2020-08-26 17:56:15 +10:00
parent 8321c62f24
commit 416f7f3bb5
5 changed files with 228 additions and 0 deletions

View File

@ -331,6 +331,7 @@ patch_enable_all ()
enable_ws2_32_getaddrinfo="$1"
enable_ws2_32_getsockopt="$1"
enable_wtsapi32_EnumerateProcesses="$1"
enable_xactengine3_7_PrepareWave="$1"
}
# Enable or disable a specific patchset
@ -1081,6 +1082,9 @@ patch_enable ()
wtsapi32-EnumerateProcesses)
enable_wtsapi32_EnumerateProcesses="$2"
;;
xactengine3_7-PrepareWave)
enable_xactengine3_7_PrepareWave="$2"
;;
*)
return 1
;;
@ -6242,6 +6246,25 @@ if test "$enable_wtsapi32_EnumerateProcesses" -eq 1; then
) >> "$patchlist"
fi
# Patchset xactengine3_7-PrepareWave
# |
# | This patchset fixes the following Wine bugs:
# | * [#49689] xactengine3_7: Implement IXACT3Engine PrepareWave
# |
# | Modified files:
# | * dlls/xactengine3_7/xact_dll.c
# |
if test "$enable_xactengine3_7_PrepareWave" -eq 1; then
patch_apply xactengine3_7-PrepareWave/0001-xactengine3_7-Implement-IXACT3Engine-PrepareWave.patch
patch_apply xactengine3_7-PrepareWave/0002-xactengine3_7-Implement-IXACT3Engine-PrepareStreamin.patch
patch_apply xactengine3_7-PrepareWave/0003-xactengine3_7-Implement-IXACT3Engine-PrepareInMemory.patch
(
printf '%s\n' '+ { "Alistair Leslie-Hughes", "xactengine3_7: Implement IXACT3Engine PrepareWave.", 1 },';
printf '%s\n' '+ { "Alistair Leslie-Hughes", "xactengine3_7: Implement IXACT3Engine PrepareStreamingWave.", 1 },';
printf '%s\n' '+ { "Alistair Leslie-Hughes", "xactengine3_7: Implement IXACT3Engine PrepareInMemoryWave.", 1 },';
) >> "$patchlist"
fi
if test "$enable_patchlist" -eq 1; then

View File

@ -0,0 +1,60 @@
From 34fad63be385d80ebee850eb4ae613ea23f758b3 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Fri, 14 Aug 2020 17:16:07 +1000
Subject: [PATCH 1/3] xactengine3_7: Implement IXACT3Engine PrepareWave
v2: Deal with FACTAudioEngine_PrepareWave isn't implemented.
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=49689
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
---
dlls/xactengine3_7/xact_dll.c | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
diff --git a/dlls/xactengine3_7/xact_dll.c b/dlls/xactengine3_7/xact_dll.c
index c5f96decb72..5bcd8a6202c 100644
--- a/dlls/xactengine3_7/xact_dll.c
+++ b/dlls/xactengine3_7/xact_dll.c
@@ -986,8 +986,36 @@ static HRESULT WINAPI IXACT3EngineImpl_PrepareWave(IXACT3Engine *iface,
IXACT3Wave **ppWave)
{
XACT3EngineImpl *This = impl_from_IXACT3Engine(iface);
- FIXME("(%p): stub!\n", This);
- return E_NOTIMPL;
+ XACT3WaveImpl *wave;
+ FACTWave *fwave = NULL;
+ UINT ret;
+
+ TRACE("(%p)->(0x%08x, %s, %d, %d, %d, %d, %p)\n", This, dwFlags, debugstr_a(szWavePath),
+ wStreamingPacketSize, dwAlignment, dwPlayOffset, nLoopCount, ppWave);
+
+ ret = FACTAudioEngine_PrepareWave(This->fact_engine, dwFlags, szWavePath, wStreamingPacketSize,
+ dwAlignment, dwPlayOffset, nLoopCount, &fwave);
+ if(ret != 0 || !fwave)
+ {
+ ERR("Failed to CreateWave: %d (%p)\n", ret, fwave);
+ return E_FAIL;
+ }
+
+ wave = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*wave));
+ if (!wave)
+ {
+ FACTWave_Destroy(fwave);
+ ERR("Failed to allocate XACT3WaveImpl!");
+ return E_OUTOFMEMORY;
+ }
+
+ wave->IXACT3Wave_iface.lpVtbl = &XACT3Wave_Vtbl;
+ wave->fact_wave = fwave;
+ *ppWave = &wave->IXACT3Wave_iface;
+
+ TRACE("Created Wave: %p\n", wave);
+
+ return S_OK;
}
enum {
--
2.28.0

View File

@ -0,0 +1,79 @@
From ff3d57ac0bc2f08ab955c3ae734cb488566246c8 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Sat, 15 Aug 2020 17:36:23 +1000
Subject: [PATCH 2/3] xactengine3_7: Implement IXACT3Engine
PrepareStreamingWave
---
dlls/xactengine3_7/xact_dll.c | 55 +++++++++++++++++++++++++++++++++--
1 file changed, 53 insertions(+), 2 deletions(-)
diff --git a/dlls/xactengine3_7/xact_dll.c b/dlls/xactengine3_7/xact_dll.c
index 5bcd8a6202c..99e4bd19049 100644
--- a/dlls/xactengine3_7/xact_dll.c
+++ b/dlls/xactengine3_7/xact_dll.c
@@ -976,8 +976,59 @@ static HRESULT WINAPI IXACT3EngineImpl_PrepareStreamingWave(IXACT3Engine *iface,
IXACT3Wave **ppWave)
{
XACT3EngineImpl *This = impl_from_IXACT3Engine(iface);
- FIXME("(%p): stub!\n", This);
- return E_NOTIMPL;
+ XACT3WaveImpl *wave;
+ FACTWave *fwave = NULL;
+ FACTStreamingParameters fakeParms;
+ wrap_readfile_struct *fake;
+ FACTWaveBankEntry fact_wavebank;
+ UINT ret;
+
+ TRACE("(%p)->(0x%08x, %p, %p, %d, %p, %d, %d, %p)\n", This, dwFlags, &entry, &streamingParams,
+ dwAlignment, pdwSeekTable, dwPlayOffset, nLoopCount, ppWave);
+
+ fake = (wrap_readfile_struct*) CoTaskMemAlloc(
+ sizeof(wrap_readfile_struct));
+ fake->engine = This;
+ fake->file = streamingParams.file;
+ fakeParms.file = fake;
+ fakeParms.flags = streamingParams.flags;
+ fakeParms.offset = streamingParams.offset;
+ fakeParms.packetSize = streamingParams.packetSize;
+
+ fact_wavebank.dwFlagsAndDuration = entry.u.dwFlagsAndDuration;
+ fact_wavebank.Format.dwValue = entry.Format.dwValue;
+ fact_wavebank.PlayRegion.dwOffset = entry.PlayRegion.dwOffset;
+ fact_wavebank.PlayRegion.dwLength = entry.PlayRegion.dwLength;
+ fact_wavebank.LoopRegion.dwStartSample = entry.LoopRegion.dwStartSample;
+ fact_wavebank.LoopRegion.dwTotalSamples = entry.LoopRegion.dwTotalSamples;
+
+ /* FAudio Prototype is incorrect and shouldn't take a buffer as an parameter,
+ * passing through NULL to ensure it's not used.
+ */
+ ret = FACTAudioEngine_PrepareStreamingWave(This->fact_engine, dwFlags, fact_wavebank, fakeParms,
+ dwAlignment, pdwSeekTable, NULL, dwPlayOffset, nLoopCount, &fwave);
+
+ if(ret != 0 || !fwave)
+ {
+ ERR("Failed to CreateWave: %d (%p)\n", ret, fwave);
+ return E_FAIL;
+ }
+
+ wave = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*wave));
+ if (!wave)
+ {
+ FACTWave_Destroy(fwave);
+ ERR("Failed to allocate XACT3WaveImpl!");
+ return E_OUTOFMEMORY;
+ }
+
+ wave->IXACT3Wave_iface.lpVtbl = &XACT3Wave_Vtbl;
+ wave->fact_wave = fwave;
+ *ppWave = &wave->IXACT3Wave_iface;
+
+ TRACE("Created Wave: %p\n", wave);
+
+ return S_OK;
}
static HRESULT WINAPI IXACT3EngineImpl_PrepareWave(IXACT3Engine *iface,
--
2.28.0

View File

@ -0,0 +1,63 @@
From 8387b1a1a4a07b66246015e3791518cbe1a69244 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Mon, 15 Aug 2020 17:49:23 +1000
Subject: [PATCH 3/3] xactengine3_7: Implement IXACT3Engine PrepareInMemoryWave
---
dlls/xactengine3_7/xact_dll.c | 40 +++++++++++++++++++++++++++++++++--
1 file changed, 38 insertions(+), 2 deletions(-)
diff --git a/dlls/xactengine3_7/xact_dll.c b/dlls/xactengine3_7/xact_dll.c
index 99e4bd19049..e6c3863b9ee 100644
--- a/dlls/xactengine3_7/xact_dll.c
+++ b/dlls/xactengine3_7/xact_dll.c
@@ -965,8 +965,44 @@ static HRESULT WINAPI IXACT3EngineImpl_PrepareInMemoryWave(IXACT3Engine *iface,
IXACT3Wave **ppWave)
{
XACT3EngineImpl *This = impl_from_IXACT3Engine(iface);
- FIXME("(%p): stub!\n", This);
- return E_NOTIMPL;
+ XACT3WaveImpl *wave;
+ FACTWave *fwave = NULL;
+ FACTWaveBankEntry fact_wavebank;
+ UINT ret;
+
+ TRACE("(%p)->(0x%08x, %p, %p, %p, %d, %d, %p)\n", This, dwFlags, &entry, pdwSeekTable,
+ pbWaveData, dwPlayOffset, nLoopCount, ppWave);
+
+ fact_wavebank.dwFlagsAndDuration = entry.u.dwFlagsAndDuration;
+ fact_wavebank.Format.dwValue = entry.Format.dwValue;
+ fact_wavebank.PlayRegion.dwOffset = entry.PlayRegion.dwOffset;
+ fact_wavebank.PlayRegion.dwLength = entry.PlayRegion.dwLength;
+ fact_wavebank.LoopRegion.dwStartSample = entry.LoopRegion.dwStartSample;
+ fact_wavebank.LoopRegion.dwTotalSamples = entry.LoopRegion.dwTotalSamples;
+
+ ret = FACTAudioEngine_PrepareInMemoryWave(This->fact_engine, dwFlags, fact_wavebank,
+ pdwSeekTable, pbWaveData, dwPlayOffset, nLoopCount, &fwave);
+ if(ret != 0 || !fwave)
+ {
+ ERR("Failed to CreateWave: %d (%p)\n", ret, fwave);
+ return E_FAIL;
+ }
+
+ wave = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*wave));
+ if (!wave)
+ {
+ FACTWave_Destroy(fwave);
+ ERR("Failed to allocate XACT3WaveImpl!");
+ return E_OUTOFMEMORY;
+ }
+
+ wave->IXACT3Wave_iface.lpVtbl = &XACT3Wave_Vtbl;
+ wave->fact_wave = fwave;
+ *ppWave = &wave->IXACT3Wave_iface;
+
+ TRACE("Created Wave: %p\n", wave);
+
+ return S_OK;
}
static HRESULT WINAPI IXACT3EngineImpl_PrepareStreamingWave(IXACT3Engine *iface,
--
2.28.0

View File

@ -0,0 +1,3 @@
# This only implements the wine side and now comes an FAudio issue.
# reference https://github.com/FNA-XNA/FAudio/issues/206
Fixes: [49689] xactengine3_7: Implement IXACT3Engine PrepareWave