From 0e7472e7a34b76e6fb6cc0e9099b3212313c6ab8 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Thu, 7 Jan 2021 13:22:54 +1100 Subject: [PATCH] Added dsound-localder patchset --- ...undBuffer8-GetStatus-return-DSBSTATU.patch | 122 ++++++++++++++++++ patches/dsound-localder/definition | 1 + patches/patchinstall.sh | 16 +++ 3 files changed, 139 insertions(+) create mode 100644 patches/dsound-localder/0001-dsound-IDirectSoundBuffer8-GetStatus-return-DSBSTATU.patch create mode 100644 patches/dsound-localder/definition diff --git a/patches/dsound-localder/0001-dsound-IDirectSoundBuffer8-GetStatus-return-DSBSTATU.patch b/patches/dsound-localder/0001-dsound-IDirectSoundBuffer8-GetStatus-return-DSBSTATU.patch new file mode 100644 index 00000000..5bd0a223 --- /dev/null +++ b/patches/dsound-localder/0001-dsound-IDirectSoundBuffer8-GetStatus-return-DSBSTATU.patch @@ -0,0 +1,122 @@ +From 065142976ed5c7814830579e36612d3c515d90c3 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Tue, 5 Jan 2021 11:36:25 +1100 +Subject: [PATCH] dsound: IDirectSoundBuffer8 GetStatus return + DSBSTATUS_LOCSOFTWARE for deferred buffers + +Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=21014 + +Signed-off-by: Alistair Leslie-Hughes +--- + dlls/dsound/buffer.c | 2 + + dlls/dsound/tests/dsound8.c | 74 +++++++++++++++++++++++++++++++++++++ + 2 files changed, 76 insertions(+) + +diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c +index 96391ebba03..6393656c9fa 100644 +--- a/dlls/dsound/buffer.c ++++ b/dlls/dsound/buffer.c +@@ -421,6 +421,8 @@ static HRESULT WINAPI IDirectSoundBufferImpl_GetStatus(IDirectSoundBuffer8 *ifac + if (This->playflags & DSBPLAY_LOOPING) + *status |= DSBSTATUS_LOOPING; + } ++ if (This->dsbd.dwFlags & DSBCAPS_LOCDEFER) ++ *status |= DSBSTATUS_LOCSOFTWARE; + ReleaseSRWLockShared(&This->lock); + + TRACE("status=%x\n", *status); +diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c +index 81c5710dbaf..85272dd9b55 100644 +--- a/dlls/dsound/tests/dsound8.c ++++ b/dlls/dsound/tests/dsound8.c +@@ -1809,6 +1809,79 @@ static void test_effects(void) + ok(!ref, "Got outstanding refcount %u.\n", ref); + } + ++static void test_AcquireResources(void) ++{ ++ IDirectSound8 *dsound; ++ IDirectSoundBuffer *primary, *secondary; ++ DSBUFFERDESC bufdesc; ++ WAVEFORMATEX fmt; ++ HRESULT hr; ++ ++ hr = DirectSoundCreate8(NULL, &dsound, NULL); ++ ok(hr == DS_OK || hr == DSERR_NODRIVER, "Got hr %#x.\n", hr); ++ if (FAILED(hr)) ++ return; ++ ++ hr = IDirectSound8_SetCooperativeLevel(dsound, get_hwnd(), DSSCL_PRIORITY); ++ ok(hr == DS_OK, "Got hr %#x.\n", hr); ++ ++ bufdesc.dwSize = sizeof(bufdesc); ++ bufdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_PRIMARYBUFFER; ++ bufdesc.dwBufferBytes = 0; ++ bufdesc.dwReserved = 0; ++ bufdesc.lpwfxFormat = NULL; ++ bufdesc.guid3DAlgorithm = GUID_NULL; ++ ++ hr = IDirectSound8_CreateSoundBuffer(dsound, &bufdesc, &primary, NULL); ++ ok(hr == S_OK, "CreateSoundBuffer failed: %08x\n", hr); ++ if(hr != S_OK) { ++ IDirectSound_Release(dsound); ++ return; ++ } ++ ++ fmt.wFormatTag = WAVE_FORMAT_PCM; ++ fmt.nChannels = 2; ++ fmt.nSamplesPerSec = 48000; ++ fmt.wBitsPerSample = 16; ++ fmt.nBlockAlign = fmt.nChannels * fmt.wBitsPerSample / 8; ++ fmt.nAvgBytesPerSec = fmt.nBlockAlign * fmt.nSamplesPerSec; ++ fmt.cbSize = 0; ++ ++ bufdesc.lpwfxFormat = &fmt; ++ bufdesc.dwBufferBytes = fmt.nSamplesPerSec * fmt.nBlockAlign / 10; ++ bufdesc.dwFlags = DSBCAPS_LOCDEFER | DSBCAPS_CTRLVOLUME; ++ ++ /* see if we can create one more */ ++ hr = IDirectSound8_CreateSoundBuffer(dsound, &bufdesc, &secondary, NULL); ++ ok(hr == S_OK, "CreateSoundBuffer gave wrong error: %08x\n", hr); ++ if(hr == S_OK) { ++ DWORD status; ++ IDirectSoundBuffer8 *buffer8; ++ ++ hr = IDirectSoundBuffer_QueryInterface(secondary, &IID_IDirectSoundBuffer8, (void **)&buffer8); ++ ok(hr == S_OK, "got: %08x\n", hr); ++ ++ status = 0xFFFF; ++ hr = IDirectSoundBuffer8_GetStatus(buffer8, &status); ++ ok(hr == S_OK, "got: %08x\n", hr); ++ todo_wine ok(status == 0, "got: %08x\n", status); ++ ++ hr = IDirectSoundBuffer8_AcquireResources(buffer8, 0, 0, NULL); ++ ok(hr == S_OK, "got: %08x\n", hr); ++ ++ status = 0xFFFF; ++ hr = IDirectSoundBuffer8_GetStatus(buffer8, &status); ++ ok(hr == S_OK, "got: %08x\n", hr); ++ ok(status == DSBSTATUS_LOCSOFTWARE, "got: %08x\n", status); ++ ++ IDirectSoundBuffer8_Release(buffer8); ++ IDirectSoundBuffer_Release(secondary); ++ } ++ ++ IDirectSoundBuffer_Release(primary); ++ IDirectSound_Release(dsound); ++} ++ + START_TEST(dsound8) + { + DWORD cookie; +@@ -1822,6 +1895,7 @@ START_TEST(dsound8) + test_hw_buffers(); + test_first_device(); + test_primary_flags(); ++ test_AcquireResources(); + + hr = CoRegisterClassObject(&testdmo_clsid, (IUnknown *)&testdmo_cf, + CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &cookie); +-- +2.29.2 + diff --git a/patches/dsound-localder/definition b/patches/dsound-localder/definition new file mode 100644 index 00000000..44fcb121 --- /dev/null +++ b/patches/dsound-localder/definition @@ -0,0 +1 @@ +Fixes: [21014] dsound: IDirectSoundBuffer8 GetStatus return DSBSTATUS_LOCSOFTWARE for deferred buffers diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 1dc660b2..36c9bea5 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -122,6 +122,7 @@ patch_enable_all () enable_dinput_remap_joystick="$1" enable_dsound_EAX="$1" enable_dsound_Fast_Mixer="$1" + enable_dsound_localder="$1" enable_dwrite_FontFallback="$1" enable_dxdiag_new_dlls="$1" enable_eventfd_synchronization="$1" @@ -453,6 +454,9 @@ patch_enable () dsound-Fast_Mixer) enable_dsound_Fast_Mixer="$2" ;; + dsound-localder) + enable_dsound_localder="$2" + ;; dwrite-FontFallback) enable_dwrite_FontFallback="$2" ;; @@ -2371,6 +2375,18 @@ if test "$enable_dsound_EAX" -eq 1; then patch_apply dsound-EAX/0022-dsound-Enable-EAX-by-default.patch fi +# Patchset dsound-localder +# | +# | This patchset fixes the following Wine bugs: +# | * [#21014] dsound: IDirectSoundBuffer8 GetStatus return DSBSTATUS_LOCSOFTWARE for deferred buffers +# | +# | Modified files: +# | * dlls/dsound/buffer.c, dlls/dsound/tests/dsound8.c +# | +if test "$enable_dsound_localder" -eq 1; then + patch_apply dsound-localder/0001-dsound-IDirectSoundBuffer8-GetStatus-return-DSBSTATU.patch +fi + # Patchset dwrite-FontFallback # | # | This patchset fixes the following Wine bugs: