winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
September 2023
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
920 discussions
Start a n
N
ew thread
Rémi Bernon : dmusic: Implement IDirectMusicPortDownload_AllocateBuffer.
by Alexandre Julliard
05 Sep '23
05 Sep '23
Module: wine Branch: master Commit: 30df87af090801ae3d7d619325f15ddab462d266 URL:
https://gitlab.winehq.org/wine/wine/-/commit/30df87af090801ae3d7d619325f15d…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Sep 4 15:55:47 2023 +0200 dmusic: Implement IDirectMusicPortDownload_AllocateBuffer. --- dlls/dmusic/dmusic_private.h | 2 +- dlls/dmusic/download.c | 17 ++++++++++++++--- dlls/dmusic/port.c | 11 +++++++---- dlls/dmusic/tests/dmusic.c | 16 +++++++--------- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/dlls/dmusic/dmusic_private.h b/dlls/dmusic/dmusic_private.h index d2157288a02..03c1e6970ee 100644 --- a/dlls/dmusic/dmusic_private.h +++ b/dlls/dmusic/dmusic_private.h @@ -99,7 +99,7 @@ extern HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID extern HRESULT DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter); extern HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter); -extern HRESULT download_create(IDirectMusicDownload **ret_iface); +extern HRESULT download_create(DWORD size, IDirectMusicDownload **ret_iface); /***************************************************************************** * IDirectMusic8Impl implementation structure diff --git a/dlls/dmusic/download.c b/dlls/dmusic/download.c index 9c3f0d6b0cd..6dac3e1b725 100644 --- a/dlls/dmusic/download.c +++ b/dlls/dmusic/download.c @@ -27,8 +27,13 @@ struct download { IDirectMusicDownload IDirectMusicDownload_iface; LONG ref; + + DWORD size; + BYTE data[]; }; +C_ASSERT(sizeof(struct download) == offsetof(struct download, data[0])); + static inline struct download *impl_from_IDirectMusicDownload(IDirectMusicDownload *iface) { return CONTAINING_RECORD(iface, struct download, IDirectMusicDownload_iface); @@ -77,7 +82,12 @@ static ULONG WINAPI download_Release(IDirectMusicDownload *iface) static HRESULT WINAPI download_GetBuffer(IDirectMusicDownload *iface, void **buffer, DWORD *size) { - FIXME("(%p, %p, %p): stub\n", iface, buffer, size); + struct download *This = impl_from_IDirectMusicDownload(iface); + + TRACE("(%p, %p, %p)\n", iface, buffer, size); + + *buffer = This->data; + *size = This->size; return S_OK; } @@ -90,14 +100,15 @@ static const IDirectMusicDownloadVtbl download_vtbl = download_GetBuffer, }; -HRESULT download_create(IDirectMusicDownload **ret_iface) +HRESULT download_create(DWORD size, IDirectMusicDownload **ret_iface) { struct download *download; *ret_iface = NULL; - if (!(download = calloc(1, sizeof(*download)))) return E_OUTOFMEMORY; + if (!(download = malloc(offsetof(struct download, data[size])))) return E_OUTOFMEMORY; download->IDirectMusicDownload_iface.lpVtbl = &download_vtbl; download->ref = 1; + download->size = size; TRACE("Created DirectMusicDownload %p\n", download); *ret_iface = &download->IDirectMusicDownload_iface; diff --git a/dlls/dmusic/port.c b/dlls/dmusic/port.c index 7cc30b525c1..95144a6d905 100644 --- a/dlls/dmusic/port.c +++ b/dlls/dmusic/port.c @@ -584,17 +584,20 @@ static HRESULT WINAPI synth_port_download_GetBuffer(IDirectMusicPortDownload *if if (!IDMDownload) return E_POINTER; - return download_create(IDMDownload); + return download_create(0, IDMDownload); } static HRESULT WINAPI synth_port_download_AllocateBuffer(IDirectMusicPortDownload *iface, DWORD size, - IDirectMusicDownload **IDMDownload) + IDirectMusicDownload **download) { struct synth_port *This = synth_from_IDirectMusicPortDownload(iface); - FIXME("(%p/%p, %lu, %p): stub\n", iface, This, size, IDMDownload); + TRACE("(%p/%p, %lu, %p)\n", iface, This, size, download); - return S_OK; + if (!download) return E_POINTER; + if (!size) return E_INVALIDARG; + + return download_create(size, download); } static HRESULT WINAPI synth_port_download_GetDLId(IDirectMusicPortDownload *iface, DWORD *first, DWORD count) diff --git a/dlls/dmusic/tests/dmusic.c b/dlls/dmusic/tests/dmusic.c index 05568208fee..8cfcc11ffd8 100644 --- a/dlls/dmusic/tests/dmusic.c +++ b/dlls/dmusic/tests/dmusic.c @@ -1065,9 +1065,9 @@ static void test_port_download(void) /* AllocateBuffer use the exact requested size */ hr = IDirectMusicPortDownload_AllocateBuffer(port, 0, NULL); - todo_wine ok(hr == E_POINTER, "got %#lx\n", hr); + ok(hr == E_POINTER, "got %#lx\n", hr); hr = IDirectMusicPortDownload_AllocateBuffer(port, 0, &download); - todo_wine ok(hr == E_INVALIDARG, "got %#lx\n", hr); + ok(hr == E_INVALIDARG, "got %#lx\n", hr); hr = IDirectMusicPortDownload_AllocateBuffer(port, 1, &download); ok(hr == S_OK, "got %#lx\n", hr); @@ -1075,8 +1075,8 @@ static void test_port_download(void) buffer = invalid_ptr; hr = IDirectMusicDownload_GetBuffer(download, (void **)&buffer, &size); ok(hr == S_OK, "got %#lx\n", hr); - todo_wine ok(size == 1, "got %#lx\n", size); - todo_wine ok(buffer != invalid_ptr, "got %p\n", buffer); + ok(size == 1, "got %#lx\n", size); + ok(buffer != invalid_ptr, "got %p\n", buffer); IDirectMusicDownload_Release(download); /* GetDLId allocates the given number of slots and returns only the first */ @@ -1107,14 +1107,13 @@ static void test_port_download(void) download = invalid_ptr; hr = IDirectMusicPortDownload_AllocateBuffer(port, sizeof(struct wave_download), &download); ok(hr == S_OK, "got %#lx\n", hr); - todo_wine ok(download != invalid_ptr, "got %p\n", download); - if (download == invalid_ptr) goto skip_tests; + ok(download != invalid_ptr, "got %p\n", download); size = 0xdeadbeef; wave_download = invalid_ptr; hr = IDirectMusicDownload_GetBuffer(download, (void **)&wave_download, &size); ok(hr == S_OK, "got %#lx\n", hr); - todo_wine ok(size == sizeof(struct wave_download), "got %#lx\n", size); - todo_wine ok(wave_download != invalid_ptr, "got %p\n", wave_download); + ok(size == sizeof(struct wave_download), "got %#lx\n", size); + ok(wave_download != invalid_ptr, "got %p\n", wave_download); wave_download->info.cbSize = sizeof(struct wave_download); wave_download->info.dwDLId = 2; wave_download->info.dwDLType = 0; @@ -1172,7 +1171,6 @@ static void test_port_download(void) IDirectMusicDownload_Release(download); -skip_tests: IDirectMusicPortDownload_Release(port); }
1
0
0
0
Rémi Bernon : dmusic: Implement synth port IDirectMusicPortDownload_GetDLId.
by Alexandre Julliard
05 Sep '23
05 Sep '23
Module: wine Branch: master Commit: 45f61965dc386f76c139adb358edc780d144a0f1 URL:
https://gitlab.winehq.org/wine/wine/-/commit/45f61965dc386f76c139adb358edc7…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Aug 31 17:21:09 2023 +0200 dmusic: Implement synth port IDirectMusicPortDownload_GetDLId. --- dlls/dmusic/port.c | 12 ++++++++++-- dlls/dmusic/tests/dmusic.c | 8 ++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/dlls/dmusic/port.c b/dlls/dmusic/port.c index 7f61e2d1ef7..7cc30b525c1 100644 --- a/dlls/dmusic/port.c +++ b/dlls/dmusic/port.c @@ -40,6 +40,8 @@ struct synth_port { DMUS_PORTPARAMS params; int nrofgroups; DMUSIC_PRIVATE_CHANNEL_GROUP group[1]; + + DWORD next_dlid; }; static inline IDirectMusicDownloadedInstrumentImpl* impl_from_IDirectMusicDownloadedInstrument(IDirectMusicDownloadedInstrument *iface) @@ -595,11 +597,17 @@ static HRESULT WINAPI synth_port_download_AllocateBuffer(IDirectMusicPortDownloa return S_OK; } -static HRESULT WINAPI synth_port_download_GetDLId(IDirectMusicPortDownload *iface, DWORD *start_DLId, DWORD count) +static HRESULT WINAPI synth_port_download_GetDLId(IDirectMusicPortDownload *iface, DWORD *first, DWORD count) { struct synth_port *This = synth_from_IDirectMusicPortDownload(iface); - FIXME("(%p/%p, %p, %lu): stub\n", iface, This, start_DLId, count); + TRACE("(%p/%p, %p, %lu)\n", iface, This, first, count); + + if (!first) return E_POINTER; + if (!count) return E_INVALIDARG; + + *first = This->next_dlid; + This->next_dlid += count; return S_OK; } diff --git a/dlls/dmusic/tests/dmusic.c b/dlls/dmusic/tests/dmusic.c index 6df37e3d63d..05568208fee 100644 --- a/dlls/dmusic/tests/dmusic.c +++ b/dlls/dmusic/tests/dmusic.c @@ -1081,14 +1081,14 @@ static void test_port_download(void) /* GetDLId allocates the given number of slots and returns only the first */ hr = IDirectMusicPortDownload_GetDLId(port, NULL, 0); - todo_wine ok(hr == E_POINTER, "got %#lx\n", hr); + ok(hr == E_POINTER, "got %#lx\n", hr); hr = IDirectMusicPortDownload_GetDLId(port, ids, 0); - todo_wine ok(hr == E_INVALIDARG, "got %#lx\n", hr); + ok(hr == E_INVALIDARG, "got %#lx\n", hr); memset(ids, 0xcc, sizeof(ids)); hr = IDirectMusicPortDownload_GetDLId(port, ids, 4); ok(hr == S_OK, "got %#lx\n", hr); - todo_wine ok(ids[0] == 0, "got %#lx\n", ids[0]); + ok(ids[0] == 0, "got %#lx\n", ids[0]); ok(ids[1] == 0xcccccccc, "got %#lx\n", ids[1]); /* GetBuffer looks up allocated ids to find downloaded buffers */ @@ -1168,7 +1168,7 @@ static void test_port_download(void) /* DLIds are never released */ hr = IDirectMusicPortDownload_GetDLId(port, ids, 1); ok(hr == S_OK, "got %#lx\n", hr); - todo_wine ok(ids[0] == 4, "got %#lx\n", ids[0]); + ok(ids[0] == 4, "got %#lx\n", ids[0]); IDirectMusicDownload_Release(download);
1
0
0
0
Rémi Bernon : dmusic: Rename IDirectMusicDownloadImpl method prefix to download.
by Alexandre Julliard
05 Sep '23
05 Sep '23
Module: wine Branch: master Commit: 770749491d786da425c0fb6e80460b7f29d5ff66 URL:
https://gitlab.winehq.org/wine/wine/-/commit/770749491d786da425c0fb6e80460b…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Aug 24 10:59:27 2023 +0200 dmusic: Rename IDirectMusicDownloadImpl method prefix to download. --- dlls/dmusic/download.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/dlls/dmusic/download.c b/dlls/dmusic/download.c index fc94cac6a68..9c3f0d6b0cd 100644 --- a/dlls/dmusic/download.c +++ b/dlls/dmusic/download.c @@ -23,21 +23,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmusic); -struct IDirectMusicDownloadImpl +struct download { IDirectMusicDownload IDirectMusicDownload_iface; LONG ref; }; -typedef struct IDirectMusicDownloadImpl IDirectMusicDownloadImpl; - -static inline IDirectMusicDownloadImpl* impl_from_IDirectMusicDownload(IDirectMusicDownload *iface) +static inline struct download *impl_from_IDirectMusicDownload(IDirectMusicDownload *iface) { - return CONTAINING_RECORD(iface, IDirectMusicDownloadImpl, IDirectMusicDownload_iface); + return CONTAINING_RECORD(iface, struct download, IDirectMusicDownload_iface); } -/* IDirectMusicDownloadImpl IUnknown part: */ -static HRESULT WINAPI IDirectMusicDownloadImpl_QueryInterface(IDirectMusicDownload *iface, REFIID riid, void **ret_iface) +static HRESULT WINAPI download_QueryInterface(IDirectMusicDownload *iface, REFIID riid, void **ret_iface) { TRACE("(%p, %s, %p)\n", iface, debugstr_dmguid(riid), ret_iface); @@ -54,9 +51,9 @@ static HRESULT WINAPI IDirectMusicDownloadImpl_QueryInterface(IDirectMusicDownlo return E_NOINTERFACE; } -static ULONG WINAPI IDirectMusicDownloadImpl_AddRef(IDirectMusicDownload *iface) +static ULONG WINAPI download_AddRef(IDirectMusicDownload *iface) { - IDirectMusicDownloadImpl *This = impl_from_IDirectMusicDownload(iface); + struct download *This = impl_from_IDirectMusicDownload(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("(%p): new ref = %lu\n", iface, ref); @@ -64,9 +61,9 @@ static ULONG WINAPI IDirectMusicDownloadImpl_AddRef(IDirectMusicDownload *iface) return ref; } -static ULONG WINAPI IDirectMusicDownloadImpl_Release(IDirectMusicDownload *iface) +static ULONG WINAPI download_Release(IDirectMusicDownload *iface) { - IDirectMusicDownloadImpl *This = impl_from_IDirectMusicDownload(iface); + struct download *This = impl_from_IDirectMusicDownload(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("(%p): new ref = %lu\n", iface, ref); @@ -78,28 +75,28 @@ static ULONG WINAPI IDirectMusicDownloadImpl_Release(IDirectMusicDownload *iface return ref; } -/* IDirectMusicDownloadImpl IDirectMusicDownload part: */ -static HRESULT WINAPI IDirectMusicDownloadImpl_GetBuffer(IDirectMusicDownload *iface, void **buffer, DWORD *size) +static HRESULT WINAPI download_GetBuffer(IDirectMusicDownload *iface, void **buffer, DWORD *size) { FIXME("(%p, %p, %p): stub\n", iface, buffer, size); return S_OK; } -static const IDirectMusicDownloadVtbl DirectMusicDownload_Vtbl = { - IDirectMusicDownloadImpl_QueryInterface, - IDirectMusicDownloadImpl_AddRef, - IDirectMusicDownloadImpl_Release, - IDirectMusicDownloadImpl_GetBuffer +static const IDirectMusicDownloadVtbl download_vtbl = +{ + download_QueryInterface, + download_AddRef, + download_Release, + download_GetBuffer, }; HRESULT download_create(IDirectMusicDownload **ret_iface) { - IDirectMusicDownloadImpl *download; + struct download *download; *ret_iface = NULL; if (!(download = calloc(1, sizeof(*download)))) return E_OUTOFMEMORY; - download->IDirectMusicDownload_iface.lpVtbl = &DirectMusicDownload_Vtbl; + download->IDirectMusicDownload_iface.lpVtbl = &download_vtbl; download->ref = 1; TRACE("Created DirectMusicDownload %p\n", download);
1
0
0
0
Rémi Bernon : dmusic: Move IDirectMusicDownloadImpl struct to where it is used.
by Alexandre Julliard
05 Sep '23
05 Sep '23
Module: wine Branch: master Commit: f96f53ea85818775d2fcafe63412cb76c71ecb22 URL:
https://gitlab.winehq.org/wine/wine/-/commit/f96f53ea85818775d2fcafe63412cb…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Aug 24 11:03:57 2023 +0200 dmusic: Move IDirectMusicDownloadImpl struct to where it is used. --- dlls/dmusic/dmusic_private.h | 12 ------------ dlls/dmusic/download.c | 8 ++++++++ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/dlls/dmusic/dmusic_private.h b/dlls/dmusic/dmusic_private.h index 40cb0970173..d2157288a02 100644 --- a/dlls/dmusic/dmusic_private.h +++ b/dlls/dmusic/dmusic_private.h @@ -47,7 +47,6 @@ typedef struct IDirectMusic8Impl IDirectMusic8Impl; typedef struct IDirectMusicBufferImpl IDirectMusicBufferImpl; typedef struct IDirectMusicDownloadedInstrumentImpl IDirectMusicDownloadedInstrumentImpl; -typedef struct IDirectMusicDownloadImpl IDirectMusicDownloadImpl; typedef struct IReferenceClockImpl IReferenceClockImpl; typedef struct IDirectMusicInstrumentImpl IDirectMusicInstrumentImpl; @@ -145,17 +144,6 @@ struct IDirectMusicDownloadedInstrumentImpl { void *data; }; -/***************************************************************************** - * IDirectMusicDownloadImpl implementation structure - */ -struct IDirectMusicDownloadImpl { - /* IUnknown fields */ - IDirectMusicDownload IDirectMusicDownload_iface; - LONG ref; - - /* IDirectMusicDownloadImpl fields */ -}; - /** Internal factory */ extern HRESULT synth_port_create(IDirectMusic8Impl *parent, DMUS_PORTPARAMS *port_params, DMUS_PORTCAPS *port_caps, IDirectMusicPort **port); diff --git a/dlls/dmusic/download.c b/dlls/dmusic/download.c index f7ac8d92ee6..fc94cac6a68 100644 --- a/dlls/dmusic/download.c +++ b/dlls/dmusic/download.c @@ -23,6 +23,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +struct IDirectMusicDownloadImpl +{ + IDirectMusicDownload IDirectMusicDownload_iface; + LONG ref; +}; + +typedef struct IDirectMusicDownloadImpl IDirectMusicDownloadImpl; + static inline IDirectMusicDownloadImpl* impl_from_IDirectMusicDownload(IDirectMusicDownload *iface) { return CONTAINING_RECORD(iface, IDirectMusicDownloadImpl, IDirectMusicDownload_iface);
1
0
0
0
Rémi Bernon : dmusic: Simplify and cleanup IDirectMusicDownload constructor.
by Alexandre Julliard
05 Sep '23
05 Sep '23
Module: wine Branch: master Commit: ac25d09955a711aac61bbe30656eef2089e73bc3 URL:
https://gitlab.winehq.org/wine/wine/-/commit/ac25d09955a711aac61bbe30656eef…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Mon Sep 4 11:16:59 2023 +0200 dmusic: Simplify and cleanup IDirectMusicDownload constructor. --- dlls/dmusic/dmusic_private.h | 3 ++- dlls/dmusic/download.c | 15 +++++---------- dlls/dmusic/port.c | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/dlls/dmusic/dmusic_private.h b/dlls/dmusic/dmusic_private.h index b13780e1886..40cb0970173 100644 --- a/dlls/dmusic/dmusic_private.h +++ b/dlls/dmusic/dmusic_private.h @@ -97,10 +97,11 @@ extern HRESULT DMUSIC_CreateDirectMusicCollectionImpl(REFIID riid, void **ppobj, /* Internal */ extern HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID* ret_iface); -extern HRESULT DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter); extern HRESULT DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter); extern HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter); +extern HRESULT download_create(IDirectMusicDownload **ret_iface); + /***************************************************************************** * IDirectMusic8Impl implementation structure */ diff --git a/dlls/dmusic/download.c b/dlls/dmusic/download.c index 095ea23235b..f7ac8d92ee6 100644 --- a/dlls/dmusic/download.c +++ b/dlls/dmusic/download.c @@ -85,21 +85,16 @@ static const IDirectMusicDownloadVtbl DirectMusicDownload_Vtbl = { IDirectMusicDownloadImpl_GetBuffer }; -/* for ClassFactory */ -HRESULT DMUSIC_CreateDirectMusicDownloadImpl(const GUID *guid, void **ret_iface, IUnknown *unk_outer) +HRESULT download_create(IDirectMusicDownload **ret_iface) { IDirectMusicDownloadImpl *download; - download = malloc(sizeof(*download)); - if (!download) - { - *ret_iface = NULL; - return E_OUTOFMEMORY; - } - + *ret_iface = NULL; + if (!(download = calloc(1, sizeof(*download)))) return E_OUTOFMEMORY; download->IDirectMusicDownload_iface.lpVtbl = &DirectMusicDownload_Vtbl; download->ref = 1; - *ret_iface = download; + TRACE("Created DirectMusicDownload %p\n", download); + *ret_iface = &download->IDirectMusicDownload_iface; return S_OK; } diff --git a/dlls/dmusic/port.c b/dlls/dmusic/port.c index 47137c7878c..7f61e2d1ef7 100644 --- a/dlls/dmusic/port.c +++ b/dlls/dmusic/port.c @@ -582,7 +582,7 @@ static HRESULT WINAPI synth_port_download_GetBuffer(IDirectMusicPortDownload *if if (!IDMDownload) return E_POINTER; - return DMUSIC_CreateDirectMusicDownloadImpl(&IID_IDirectMusicDownload, (LPVOID*)IDMDownload, NULL); + return download_create(IDMDownload); } static HRESULT WINAPI synth_port_download_AllocateBuffer(IDirectMusicPortDownload *iface, DWORD size,
1
0
0
0
Rémi Bernon : dmusic: Always return S_FALSE from DllCanUnloadNow.
by Alexandre Julliard
05 Sep '23
05 Sep '23
Module: wine Branch: master Commit: abc6ecc89dda625a93266851cc8aff4d6626f87b URL:
https://gitlab.winehq.org/wine/wine/-/commit/abc6ecc89dda625a93266851cc8aff…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue Aug 22 17:45:36 2023 +0200 dmusic: Always return S_FALSE from DllCanUnloadNow. --- dlls/dmusic/buffer.c | 2 -- dlls/dmusic/clock.c | 2 -- dlls/dmusic/collection.c | 2 -- dlls/dmusic/dmusic.c | 2 -- dlls/dmusic/dmusic_main.c | 21 --------------------- dlls/dmusic/dmusic_private.h | 8 -------- dlls/dmusic/download.c | 2 -- dlls/dmusic/instrument.c | 2 -- dlls/dmusic/port.c | 6 ------ 9 files changed, 47 deletions(-) diff --git a/dlls/dmusic/buffer.c b/dlls/dmusic/buffer.c index 9aaa1a074b4..a2ad137fe4b 100644 --- a/dlls/dmusic/buffer.c +++ b/dlls/dmusic/buffer.c @@ -71,7 +71,6 @@ static ULONG WINAPI IDirectMusicBufferImpl_Release(LPDIRECTMUSICBUFFER iface) if (!ref) { free(This->data); free(This); - DMUSIC_UnlockModule(); } return ref; @@ -319,7 +318,6 @@ HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID* ret_i return E_OUTOFMEMORY; } - DMUSIC_LockModule(); *ret_iface = &dmbuffer->IDirectMusicBuffer_iface; return S_OK; diff --git a/dlls/dmusic/clock.c b/dlls/dmusic/clock.c index 15a04c844e5..19441d3d56f 100644 --- a/dlls/dmusic/clock.c +++ b/dlls/dmusic/clock.c @@ -63,7 +63,6 @@ static ULONG WINAPI IReferenceClockImpl_Release(IReferenceClock *iface) if (!ref) { free(This); - DMUSIC_UnlockModule(); } return ref; @@ -137,7 +136,6 @@ HRESULT DMUSIC_CreateReferenceClockImpl(LPCGUID riid, LPVOID* ret_iface, LPUNKNO clock->rtTime = 0; clock->pClockInfo.dwSize = sizeof (DMUS_CLOCKINFO); - DMUSIC_LockModule(); hr = IReferenceClockImpl_QueryInterface(&clock->IReferenceClock_iface, riid, ret_iface); IReferenceClock_Release(&clock->IReferenceClock_iface); diff --git a/dlls/dmusic/collection.c b/dlls/dmusic/collection.c index 0febf9dfd08..3f1c70b01e3 100644 --- a/dlls/dmusic/collection.c +++ b/dlls/dmusic/collection.c @@ -99,7 +99,6 @@ static ULONG WINAPI IDirectMusicCollectionImpl_Release(IDirectMusicCollection *i if (!ref) { free(This); - DMUSIC_UnlockModule(); } return ref; @@ -544,7 +543,6 @@ HRESULT DMUSIC_CreateDirectMusicCollectionImpl(REFIID lpcGUID, void **ppobj, IUn list_init (&obj->Instruments); - DMUSIC_LockModule(); hr = IDirectMusicCollection_QueryInterface(&obj->IDirectMusicCollection_iface, lpcGUID, ppobj); IDirectMusicCollection_Release(&obj->IDirectMusicCollection_iface); diff --git a/dlls/dmusic/dmusic.c b/dlls/dmusic/dmusic.c index 8fb35e65809..d284b32fdd7 100644 --- a/dlls/dmusic/dmusic.c +++ b/dlls/dmusic/dmusic.c @@ -201,7 +201,6 @@ static ULONG WINAPI IDirectMusic8Impl_Release(LPDIRECTMUSIC8 iface) free(This->system_ports); free(This->ports); free(This); - DMUSIC_UnlockModule(); } return ref; @@ -606,7 +605,6 @@ HRESULT DMUSIC_CreateDirectMusicImpl(REFIID riid, void **ret_iface, IUnknown *un create_system_ports_list(dmusic); - DMUSIC_LockModule(); ret = IDirectMusic8Impl_QueryInterface(&dmusic->IDirectMusic8_iface, riid, ret_iface); IDirectMusic8_Release(&dmusic->IDirectMusic8_iface); diff --git a/dlls/dmusic/dmusic_main.c b/dlls/dmusic/dmusic_main.c index 5d4939937a9..509e80f872b 100644 --- a/dlls/dmusic/dmusic_main.c +++ b/dlls/dmusic/dmusic_main.c @@ -39,8 +39,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmusic); -LONG DMUSIC_refCount = 0; - typedef struct { IClassFactory IClassFactory_iface; HRESULT (*fnCreateInstance)(REFIID riid, void **ppv, IUnknown *pUnkOuter); @@ -76,15 +74,11 @@ static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID r static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface) { - DMUSIC_LockModule(); - return 2; /* non-heap based object */ } static ULONG WINAPI ClassFactory_Release(IClassFactory *iface) { - DMUSIC_UnlockModule(); - return 1; /* non-heap based object */ } @@ -101,12 +95,6 @@ static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock) { TRACE("(%d)\n", dolock); - - if (dolock) - DMUSIC_LockModule(); - else - DMUSIC_UnlockModule(); - return S_OK; } @@ -122,15 +110,6 @@ static IClassFactoryImpl DirectMusic_CF = {{&classfactory_vtbl}, DMUSIC_CreateDi static IClassFactoryImpl Collection_CF = {{&classfactory_vtbl}, DMUSIC_CreateDirectMusicCollectionImpl}; -/****************************************************************** - * DllCanUnloadNow (DMUSIC.@) - * - * - */ -HRESULT WINAPI DllCanUnloadNow(void) -{ - return DMUSIC_refCount != 0 ? S_FALSE : S_OK; -} /****************************************************************** diff --git a/dlls/dmusic/dmusic_private.h b/dlls/dmusic/dmusic_private.h index d6abf1d1f81..b13780e1886 100644 --- a/dlls/dmusic/dmusic_private.h +++ b/dlls/dmusic/dmusic_private.h @@ -214,14 +214,6 @@ static inline IDirectMusicInstrumentImpl *impl_from_IDirectMusicInstrument(IDire /* custom :) */ extern HRESULT IDirectMusicInstrumentImpl_CustomLoad(IDirectMusicInstrument *iface, IStream *stream); -/********************************************************************** - * Dll lifetime tracking declaration for dmusic.dll - */ -extern LONG DMUSIC_refCount; -static inline void DMUSIC_LockModule(void) { InterlockedIncrement( &DMUSIC_refCount ); } -static inline void DMUSIC_UnlockModule(void) { InterlockedDecrement( &DMUSIC_refCount ); } - - /***************************************************************************** * Misc. */ diff --git a/dlls/dmusic/download.c b/dlls/dmusic/download.c index 48f0efd5f69..095ea23235b 100644 --- a/dlls/dmusic/download.c +++ b/dlls/dmusic/download.c @@ -65,7 +65,6 @@ static ULONG WINAPI IDirectMusicDownloadImpl_Release(IDirectMusicDownload *iface if (!ref) { free(This); - DMUSIC_UnlockModule(); } return ref; @@ -102,6 +101,5 @@ HRESULT DMUSIC_CreateDirectMusicDownloadImpl(const GUID *guid, void **ret_iface, download->ref = 1; *ret_iface = download; - DMUSIC_LockModule(); return S_OK; } diff --git a/dlls/dmusic/instrument.c b/dlls/dmusic/instrument.c index 7b7ee3def64..767c4419225 100644 --- a/dlls/dmusic/instrument.c +++ b/dlls/dmusic/instrument.c @@ -82,7 +82,6 @@ static ULONG WINAPI IDirectMusicInstrumentImpl_Release(LPDIRECTMUSICINSTRUMENT i free(This->articulations->connections); free(This->articulations); free(This); - DMUSIC_UnlockModule(); } return ref; @@ -133,7 +132,6 @@ HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, dminst->IDirectMusicInstrument_iface.lpVtbl = &DirectMusicInstrument_Vtbl; dminst->ref = 1; - DMUSIC_LockModule(); hr = IDirectMusicInstrument_QueryInterface(&dminst->IDirectMusicInstrument_iface, lpcGUID, ppobj); IDirectMusicInstrument_Release(&dminst->IDirectMusicInstrument_iface); diff --git a/dlls/dmusic/port.c b/dlls/dmusic/port.c index 752e3e7bc4b..47137c7878c 100644 --- a/dlls/dmusic/port.c +++ b/dlls/dmusic/port.c @@ -105,7 +105,6 @@ static ULONG WINAPI IDirectMusicDownloadedInstrumentImpl_Release(LPDIRECTMUSICDO { free(This->data); free(This); - DMUSIC_UnlockModule(); } return ref; @@ -141,7 +140,6 @@ static HRESULT DMUSIC_CreateDirectMusicDownloadedInstrumentImpl(IDirectMusicDown object->ref = 1; *instrument = &object->IDirectMusicDownloadedInstrument_iface; - DMUSIC_LockModule(); return S_OK; } @@ -178,8 +176,6 @@ static ULONG WINAPI synth_port_AddRef(IDirectMusicPort *iface) TRACE("(%p): new ref = %lu\n", This, ref); - DMUSIC_LockModule(); - return ref; } @@ -204,8 +200,6 @@ static ULONG WINAPI synth_port_Release(IDirectMusicPort *iface) free(This); } - DMUSIC_UnlockModule(); - return ref; }
1
0
0
0
Rémi Bernon : dmusic/tests: Test IDirectMusicPort_(Download|Unload)Instrument.
by Alexandre Julliard
05 Sep '23
05 Sep '23
Module: wine Branch: master Commit: 041b468b23f680f1dd867b9a7c8f38c8b2d628de URL:
https://gitlab.winehq.org/wine/wine/-/commit/041b468b23f680f1dd867b9a7c8f38…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed Aug 30 18:48:11 2023 +0200 dmusic/tests: Test IDirectMusicPort_(Download|Unload)Instrument. --- dlls/dmusic/tests/dmusic.c | 240 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 234 insertions(+), 6 deletions(-) diff --git a/dlls/dmusic/tests/dmusic.c b/dlls/dmusic/tests/dmusic.c index fd012111df0..6df37e3d63d 100644 --- a/dlls/dmusic/tests/dmusic.c +++ b/dlls/dmusic/tests/dmusic.c @@ -30,6 +30,95 @@ #include "dmusicf.h" #include "dmksctrl.h" +static ULONG get_refcount(void *iface) +{ + IUnknown *unknown = iface; + IUnknown_AddRef(unknown); + return IUnknown_Release(unknown); +} + +#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) +static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) +{ + ULONG expect_ref = get_refcount(iface_ptr); + IUnknown *iface = iface_ptr; + HRESULT hr, expected; + IUnknown *unk; + + expected = supported ? S_OK : E_NOINTERFACE; + hr = IUnknown_QueryInterface(iface, iid, (void **)&unk); + ok_(__FILE__, line)(hr == expected, "got hr %#lx, expected %#lx.\n", hr, expected); + if (SUCCEEDED(hr)) + { + LONG ref = get_refcount(unk); + ok_(__FILE__, line)(ref == expect_ref + 1, "got %ld\n", ref); + IUnknown_Release(unk); + ref = get_refcount(iface_ptr); + ok_(__FILE__, line)(ref == expect_ref, "got %ld\n", ref); + } +} + +static void stream_begin_chunk(IStream *stream, const char type[5], ULARGE_INTEGER *offset) +{ + static const LARGE_INTEGER zero = {0}; + HRESULT hr; + hr = IStream_Write(stream, type, 4, NULL); + ok(hr == S_OK, "got %#lx\n", hr); + hr = IStream_Seek(stream, zero, STREAM_SEEK_CUR, offset); + ok(hr == S_OK, "got %#lx\n", hr); + hr = IStream_Write(stream, "\0\0\0\0", 4, NULL); + ok(hr == S_OK, "got %#lx\n", hr); +} + +static void stream_end_chunk(IStream *stream, ULARGE_INTEGER *offset) +{ + static const LARGE_INTEGER zero = {0}; + ULARGE_INTEGER position; + HRESULT hr; + UINT size; + hr = IStream_Seek(stream, zero, STREAM_SEEK_CUR, &position); + ok(hr == S_OK, "got %#lx\n", hr); + hr = IStream_Seek(stream, *(LARGE_INTEGER *)offset, STREAM_SEEK_SET, NULL); + ok(hr == S_OK, "got %#lx\n", hr); + size = position.QuadPart - offset->QuadPart - 4; + hr = IStream_Write(stream, &size, 4, NULL); + ok(hr == S_OK, "got %#lx\n", hr); + hr = IStream_Seek(stream, *(LARGE_INTEGER *)&position, STREAM_SEEK_SET, NULL); + ok(hr == S_OK, "got %#lx\n", hr); +} + +#define CHUNK_BEGIN(stream, type) \ + do { \ + ULARGE_INTEGER __off; \ + stream_begin_chunk(stream, type, &__off); \ + do + +#define CHUNK_RIFF(stream, form) \ + do { \ + ULARGE_INTEGER __off; \ + stream_begin_chunk(stream, "RIFF", &__off); \ + IStream_Write(stream, form, 4, NULL); \ + do + +#define CHUNK_LIST(stream, form) \ + do { \ + ULARGE_INTEGER __off; \ + stream_begin_chunk(stream, "LIST", &__off); \ + IStream_Write(stream, form, 4, NULL); \ + do + +#define CHUNK_END \ + while (0); \ + stream_end_chunk(stream, &__off); \ + } while (0) + +#define CHUNK_DATA(stream, type, data) \ + CHUNK_BEGIN(stream, type) \ + { \ + IStream_Write((stream), &(data), sizeof(data), NULL); \ + } \ + CHUNK_END + static BOOL compare_time(REFERENCE_TIME x, REFERENCE_TIME y, unsigned int max_diff) { REFERENCE_TIME diff = x > y ? x - y : y - x; @@ -97,12 +186,6 @@ static void test_dmusic(void) IDirectMusic_Release(dmusic); } -static ULONG get_refcount(IDirectSound *iface) -{ - IDirectSound_AddRef(iface); - return IDirectSound_Release(iface); -} - static void test_setdsound(void) { IDirectMusic *dmusic; @@ -1091,6 +1174,150 @@ static void test_port_download(void) skip_tests: IDirectMusicPortDownload_Release(port); +} + +static void test_download_instrument(void) +{ + static const LARGE_INTEGER zero = {0}; + IDirectMusicDownloadedInstrument *downloaded; + IDirectMusicCollection *collection; + IDirectMusicInstrument *instrument; + IPersistStream *persist; + IDirectMusicPort *port; + IDirectMusic *dmusic; + WCHAR name[MAX_PATH]; + IStream *stream; + DWORD patch; + HRESULT hr; + + port = create_synth_port(&dmusic); + + hr = CoCreateInstance(&CLSID_DirectMusicCollection, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectMusicCollection, (void **)&collection); + ok(hr == S_OK, "got %#lx\n", hr); + + hr = IDirectMusicCollection_QueryInterface(collection, &IID_IPersistStream, (void **)&persist); + ok(hr == S_OK, "got %#lx\n", hr); + hr = CreateStreamOnHGlobal(0, TRUE, &stream); + ok(hr == S_OK, "got %#lx\n", hr); + + CHUNK_RIFF(stream, "DLS ") + { + DLSHEADER colh = {.cInstruments = 1}; + struct + { + POOLTABLE head; + POOLCUE cues[1]; + } ptbl = + { + .head = {.cbSize = sizeof(POOLTABLE), .cCues = ARRAY_SIZE(ptbl.cues)}, + .cues = {{.ulOffset = 0}}, /* offsets in wvpl */ + }; + + CHUNK_DATA(stream, "colh", colh); + CHUNK_LIST(stream, "lins") + { + CHUNK_LIST(stream, "ins ") + { + INSTHEADER insh = {.cRegions = 1, .Locale = {.ulBank = 0x12, .ulInstrument = 0x34}}; + + CHUNK_DATA(stream, "insh", insh); + CHUNK_LIST(stream, "lrgn") + { + CHUNK_LIST(stream, "rgn ") + { + RGNHEADER rgnh = + { + .RangeKey = {.usLow = 0, .usHigh = 127}, + .RangeVelocity = {.usLow = 1, .usHigh = 127}, + }; + WAVELINK wlnk = {.ulChannel = 1, .ulTableIndex = 0}; + WSMPL wsmp = {.cbSize = sizeof(WSMPL)}; + + CHUNK_DATA(stream, "rgnh", rgnh); + CHUNK_DATA(stream, "wsmp", wsmp); + CHUNK_DATA(stream, "wlnk", wlnk); + } + CHUNK_END; + } + CHUNK_END; + + CHUNK_LIST(stream, "lart") + { + CONNECTIONLIST connections = {.cbSize = sizeof(connections)}; + CHUNK_DATA(stream, "art1", connections); + } + CHUNK_END; + } + CHUNK_END; + } + CHUNK_END; + CHUNK_DATA(stream, "ptbl", ptbl); + CHUNK_LIST(stream, "wvpl") + { + CHUNK_LIST(stream, "wave") + { + WAVEFORMATEX fmt = + { + .wFormatTag = WAVE_FORMAT_PCM, + .nChannels = 1, + .wBitsPerSample = 8, + .nSamplesPerSec = 22050, + .nAvgBytesPerSec = 22050, + .nBlockAlign = 1, + }; + BYTE data[16] = {0}; + + /* native returns DMUS_E_INVALIDOFFSET from DownloadInstrument if data is last */ + CHUNK_DATA(stream, "data", data); + CHUNK_DATA(stream, "fmt ", fmt); + } + CHUNK_END; + } + CHUNK_END; + } + CHUNK_END; + + hr = IStream_Seek(stream, zero, 0, NULL); + ok(hr == S_OK, "got %#lx\n", hr); + hr = IPersistStream_Load(persist, stream); + ok(hr == S_OK, "got %#lx\n", hr); + IPersistStream_Release(persist); + IStream_Release(stream); + + patch = 0xdeadbeef; + wcscpy(name, L"DeadBeef"); + hr = IDirectMusicCollection_EnumInstrument(collection, 0, &patch, name, ARRAY_SIZE(name)); + ok(hr == S_OK, "got %#lx\n", hr); + ok(patch == 0x1234, "got %#lx\n", patch); + ok(*name == 0, "got %s\n", debugstr_w(name)); + hr = IDirectMusicCollection_EnumInstrument(collection, 1, &patch, name, ARRAY_SIZE(name)); + ok(hr == S_FALSE, "got %#lx\n", hr); + + hr = IDirectMusicCollection_GetInstrument(collection, 0x1234, &instrument); + ok(hr == S_OK, "got %#lx\n", hr); + + check_interface(instrument, &IID_IDirectMusicObject, FALSE); + check_interface(instrument, &IID_IDirectMusicDownload, FALSE); + check_interface(instrument, &IID_IDirectMusicDownloadedInstrument, FALSE); + + hr = IDirectMusicPort_DownloadInstrument(port, instrument, &downloaded, NULL, 0); + todo_wine ok(hr == S_OK, "got %#lx\n", hr); + if (hr != S_OK) goto skip_tests; + + check_interface(downloaded, &IID_IDirectMusicObject, FALSE); + check_interface(downloaded, &IID_IDirectMusicDownload, FALSE); + check_interface(downloaded, &IID_IDirectMusicInstrument, FALSE); + + hr = IDirectMusicPort_UnloadInstrument(port, downloaded); + ok(hr == S_OK, "got %#lx\n", hr); + IDirectMusicDownloadedInstrument_Release(downloaded); + + IDirectMusicInstrument_Release(instrument); + +skip_tests: + IDirectMusicCollection_Release(collection); + IDirectMusicPort_Release(port); IDirectMusic_Release(dmusic); } @@ -1115,6 +1342,7 @@ START_TEST(dmusic) test_master_clock(); test_synthport(); test_port_download(); + test_download_instrument(); CoUninitialize(); }
1
0
0
0
Rémi Bernon : dmusic/tests: Test IDirectMusic(Port)Download interfaces.
by Alexandre Julliard
05 Sep '23
05 Sep '23
Module: wine Branch: master Commit: d6e1e0efa2802c6c33cdf2cf2f02d8dd05281a28 URL:
https://gitlab.winehq.org/wine/wine/-/commit/d6e1e0efa2802c6c33cdf2cf2f02d8…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Aug 31 17:58:05 2023 +0200 dmusic/tests: Test IDirectMusic(Port)Download interfaces. --- dlls/dmusic/tests/dmusic.c | 148 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) diff --git a/dlls/dmusic/tests/dmusic.c b/dlls/dmusic/tests/dmusic.c index 37b517fe0ca..fd012111df0 100644 --- a/dlls/dmusic/tests/dmusic.c +++ b/dlls/dmusic/tests/dmusic.c @@ -947,6 +947,153 @@ static void test_synthport(void) IDirectMusic_Release(dmusic); } +static void test_port_download(void) +{ + struct wave_download + { + DMUS_DOWNLOADINFO info; + ULONG offsets[2]; + DMUS_WAVE wave; + DMUS_WAVEDATA wave_data; + }; + + static void *invalid_ptr = (void *)0xdeadbeef; + IDirectMusicDownload *download, *tmp_download; + struct wave_download *wave_download; + IDirectMusicPortDownload *port; + IDirectMusicPort *tmp_port; + DWORD ids[4], append, size; + IDirectMusic *dmusic; + void *buffer; + HRESULT hr; + + tmp_port = create_synth_port(&dmusic); + hr = IDirectMusicPort_QueryInterface(tmp_port, &IID_IDirectMusicPortDownload, (void **)&port); + ok(hr == S_OK, "got %#lx\n", hr); + IDirectMusicPort_Release(tmp_port); + + /* GetBuffer only works with pre-allocated DLId */ + hr = IDirectMusicPortDownload_GetBuffer(port, 0, NULL); + ok(hr == E_POINTER, "got %#lx\n", hr); + hr = IDirectMusicPortDownload_GetBuffer(port, 0, &download); + todo_wine ok(hr == DMUS_E_INVALID_DOWNLOADID, "got %#lx\n", hr); + hr = IDirectMusicPortDownload_GetBuffer(port, 0xdeadbeef, &download); + todo_wine ok(hr == DMUS_E_INVALID_DOWNLOADID, "got %#lx\n", hr); + + /* AllocateBuffer use the exact requested size */ + hr = IDirectMusicPortDownload_AllocateBuffer(port, 0, NULL); + todo_wine ok(hr == E_POINTER, "got %#lx\n", hr); + hr = IDirectMusicPortDownload_AllocateBuffer(port, 0, &download); + todo_wine ok(hr == E_INVALIDARG, "got %#lx\n", hr); + + hr = IDirectMusicPortDownload_AllocateBuffer(port, 1, &download); + ok(hr == S_OK, "got %#lx\n", hr); + size = 0xdeadbeef; + buffer = invalid_ptr; + hr = IDirectMusicDownload_GetBuffer(download, (void **)&buffer, &size); + ok(hr == S_OK, "got %#lx\n", hr); + todo_wine ok(size == 1, "got %#lx\n", size); + todo_wine ok(buffer != invalid_ptr, "got %p\n", buffer); + IDirectMusicDownload_Release(download); + + /* GetDLId allocates the given number of slots and returns only the first */ + hr = IDirectMusicPortDownload_GetDLId(port, NULL, 0); + todo_wine ok(hr == E_POINTER, "got %#lx\n", hr); + hr = IDirectMusicPortDownload_GetDLId(port, ids, 0); + todo_wine ok(hr == E_INVALIDARG, "got %#lx\n", hr); + + memset(ids, 0xcc, sizeof(ids)); + hr = IDirectMusicPortDownload_GetDLId(port, ids, 4); + ok(hr == S_OK, "got %#lx\n", hr); + todo_wine ok(ids[0] == 0, "got %#lx\n", ids[0]); + ok(ids[1] == 0xcccccccc, "got %#lx\n", ids[1]); + + /* GetBuffer looks up allocated ids to find downloaded buffers */ + hr = IDirectMusicPortDownload_GetBuffer(port, 2, &download); + todo_wine ok(hr == DMUS_E_NOT_DOWNLOADED_TO_PORT, "got %#lx\n", hr); + + hr = IDirectMusicPortDownload_GetAppend(port, NULL); + todo_wine ok(hr == E_POINTER, "got %#lx\n", hr); + append = 0xdeadbeef; + hr = IDirectMusicPortDownload_GetAppend(port, &append); + ok(hr == S_OK, "got %#lx\n", hr); + todo_wine ok(append == 2, "got %#lx\n", append); + + /* test Download / Unload on invalid and valid buffers */ + + download = invalid_ptr; + hr = IDirectMusicPortDownload_AllocateBuffer(port, sizeof(struct wave_download), &download); + ok(hr == S_OK, "got %#lx\n", hr); + todo_wine ok(download != invalid_ptr, "got %p\n", download); + if (download == invalid_ptr) goto skip_tests; + size = 0xdeadbeef; + wave_download = invalid_ptr; + hr = IDirectMusicDownload_GetBuffer(download, (void **)&wave_download, &size); + ok(hr == S_OK, "got %#lx\n", hr); + todo_wine ok(size == sizeof(struct wave_download), "got %#lx\n", size); + todo_wine ok(wave_download != invalid_ptr, "got %p\n", wave_download); + wave_download->info.cbSize = sizeof(struct wave_download); + wave_download->info.dwDLId = 2; + wave_download->info.dwDLType = 0; + wave_download->info.dwNumOffsetTableEntries = 0; + hr = IDirectMusicPortDownload_GetBuffer(port, 2, &tmp_download); + todo_wine ok(hr == DMUS_E_NOT_DOWNLOADED_TO_PORT, "got %#lx\n", hr); + + hr = IDirectMusicPortDownload_Download(port, NULL); + todo_wine ok(hr == E_POINTER, "got %#lx\n", hr); + hr = IDirectMusicPortDownload_Download(port, download); + todo_wine ok(hr == DMUS_E_UNKNOWNDOWNLOAD, "got %#lx\n", hr); + + wave_download->info.dwDLType = DMUS_DOWNLOADINFO_WAVE; + wave_download->info.dwNumOffsetTableEntries = 2; + wave_download->offsets[0] = offsetof(struct wave_download, wave); + wave_download->offsets[1] = offsetof(struct wave_download, wave_data); + wave_download->wave.WaveformatEx.wFormatTag = WAVE_FORMAT_PCM; + wave_download->wave.WaveformatEx.nChannels = 1; + wave_download->wave.WaveformatEx.nSamplesPerSec = 44100; + wave_download->wave.WaveformatEx.nAvgBytesPerSec = 44100; + wave_download->wave.WaveformatEx.nBlockAlign = 1; + wave_download->wave.WaveformatEx.wBitsPerSample = 8; + wave_download->wave.WaveformatEx.cbSize = 0; + wave_download->wave.ulWaveDataIdx = 1; + wave_download->wave.ulCopyrightIdx = 0; + wave_download->wave.ulFirstExtCkIdx = 0; + wave_download->wave_data.cbSize = 1; + + hr = IDirectMusicPortDownload_Download(port, download); + ok(hr == S_OK, "got %#lx\n", hr); + hr = IDirectMusicPortDownload_Download(port, download); + todo_wine ok(hr == DMUS_E_ALREADY_DOWNLOADED, "got %#lx\n", hr); + + tmp_download = invalid_ptr; + hr = IDirectMusicPortDownload_GetBuffer(port, 2, &tmp_download); + ok(hr == S_OK, "got %#lx\n", hr); + todo_wine ok(tmp_download == download, "got %p\n", tmp_download); + if (tmp_download != invalid_ptr) IDirectMusicDownload_Release(tmp_download); + + hr = IDirectMusicPortDownload_Unload(port, NULL); + todo_wine ok(hr == E_POINTER, "got %#lx\n", hr); + hr = IDirectMusicPortDownload_Unload(port, download); + ok(hr == S_OK, "got %#lx\n", hr); + + hr = IDirectMusicPortDownload_GetBuffer(port, 2, &tmp_download); + todo_wine ok(hr == DMUS_E_NOT_DOWNLOADED_TO_PORT, "got %#lx\n", hr); + + hr = IDirectMusicPortDownload_Unload(port, download); + ok(hr == S_OK, "got %#lx\n", hr); + + /* DLIds are never released */ + hr = IDirectMusicPortDownload_GetDLId(port, ids, 1); + ok(hr == S_OK, "got %#lx\n", hr); + todo_wine ok(ids[0] == 4, "got %#lx\n", ids[0]); + + IDirectMusicDownload_Release(download); + +skip_tests: + IDirectMusicPortDownload_Release(port); + IDirectMusic_Release(dmusic); +} + START_TEST(dmusic) { CoInitializeEx(NULL, COINIT_MULTITHREADED); @@ -967,6 +1114,7 @@ START_TEST(dmusic) test_parsedescriptor(); test_master_clock(); test_synthport(); + test_port_download(); CoUninitialize(); }
1
0
0
0
Rémi Bernon : include: Fix incorrect IDirectMusicPortDownload_Unload macro.
by Alexandre Julliard
05 Sep '23
05 Sep '23
Module: wine Branch: master Commit: bb9e54808c2a0458d8d76b7c29c257954a3de0e4 URL:
https://gitlab.winehq.org/wine/wine/-/commit/bb9e54808c2a0458d8d76b7c29c257…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu Aug 31 17:58:05 2023 +0200 include: Fix incorrect IDirectMusicPortDownload_Unload macro. --- include/dmusicc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/dmusicc.h b/include/dmusicc.h index cdae16c75bd..94ff184dc9f 100644 --- a/include/dmusicc.h +++ b/include/dmusicc.h @@ -635,7 +635,7 @@ DECLARE_INTERFACE_(IDirectMusicPortDownload,IUnknown) #define IDirectMusicPortDownload_GetDLId(p,a,b) (p)->lpVtbl->GetDLId(p,a,b) #define IDirectMusicPortDownload_GetAppend(p,a) (p)->lpVtbl->GetAppend(p,a) #define IDirectMusicPortDownload_Download(p,a) (p)->lpVtbl->Download(p,a) -#define IDirectMusicPortDownload_Unload(p,a) (p)->lpVtbl->GetBuffer(p,a) +#define IDirectMusicPortDownload_Unload(p,a) (p)->lpVtbl->Unload(p,a) #endif
1
0
0
0
Evan Tang : wined3d: Restart vk render pass on RT clear.
by Alexandre Julliard
05 Sep '23
05 Sep '23
Module: wine Branch: master Commit: ab9e4dd3faba77b6952a76c30e94e7905fb44b28 URL:
https://gitlab.winehq.org/wine/wine/-/commit/ab9e4dd3faba77b6952a76c30e94e7…
Author: Evan Tang <etang(a)codeweavers.com> Date: Thu Jul 27 20:08:25 2023 -0500 wined3d: Restart vk render pass on RT clear. --- dlls/d3d11/tests/d3d11.c | 5 ----- dlls/wined3d/context_vk.c | 28 ++++++++++++++++------------ 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 452045852c4..cd36780ddcd 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -35361,7 +35361,6 @@ static void test_clear_during_render(void) ID3D11DeviceContext_Draw(context, 4, 0); get_texture_readback(tex, 0, &rb); color = get_readback_color(&rb, 0, 0, 0); - todo_wine_if(damavand) ok(color == 0xff0000ff, "Got unexpected color 0x%08lx instead of 0xff0000ff.\n", color); color = get_readback_color(&rb, 1, 0, 0); ok(color == 0xff000000, "Got unexpected color 0x%08lx instead of 0xff000000.\n", color); @@ -35384,7 +35383,6 @@ static void test_clear_during_render(void) ID3D11DeviceContext_Draw(context, 4, 0); get_texture_readback(tex, 0, &rb); color = get_readback_color(&rb, 0, 0, 0); - todo_wine_if(damavand) ok(color == 0xff000000, "Got unexpected color 0x%08lx instead of 0xff000000.\n", color); color = get_readback_color(&rb, 1, 0, 0); ok(color == 0xff000000, "Got unexpected color 0x%08lx instead of 0xff000000.\n", color); @@ -35414,10 +35412,8 @@ static void test_clear_during_render(void) release_resource_readback(&rb); get_texture_readback(dstex, 0, &rb); depth = get_readback_float(&rb, 0, 0); - todo_wine_if(damavand) ok(depth == 0.25f, "Got unexpected depth %.8e instead of 0.25.\n", depth); depth = get_readback_float(&rb, 1, 0); - todo_wine_if(damavand) ok(depth == 0.0f, "Got unexpected depth %.8e instead of 0.0.\n", depth); release_resource_readback(&rb); @@ -35433,7 +35429,6 @@ static void test_clear_during_render(void) color = get_readback_color(&rb, 0, 0, 0); ok(color == 0xff0000ff, "Got unexpected color 0x%08lx instead of 0xff0000ff.\n", color); color = get_readback_color(&rb, 1, 0, 0); - todo_wine_if(damavand) ok(color == 0xff00ff00, "Got unexpected color 0x%08lx instead of 0xff00ff00.\n", color); release_resource_readback(&rb); diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c index 859e8fb5949..f9ac0a59707 100644 --- a/dlls/wined3d/context_vk.c +++ b/dlls/wined3d/context_vk.c @@ -3565,6 +3565,20 @@ static void wined3d_context_vk_load_shader_resources(struct wined3d_context_vk * } } +static void wined3d_context_vk_prepare_used_rtv(struct wined3d_context_vk *context_vk, struct wined3d_rendertarget_view *rtv) +{ + if (wined3d_rendertarget_view_get_locations(rtv) & WINED3D_LOCATION_CLEARED) + { + /* Need to restart render pass or the clear won't happen. */ + wined3d_context_vk_end_current_render_pass(context_vk); + wined3d_rendertarget_view_prepare_location(rtv, &context_vk->c, rtv->resource->draw_binding); + } + else + { + wined3d_rendertarget_view_load_location(rtv, &context_vk->c, rtv->resource->draw_binding); + } +} + VkCommandBuffer wined3d_context_vk_apply_draw_state(struct wined3d_context_vk *context_vk, const struct wined3d_state *state, struct wined3d_buffer_vk *indirect_vk, bool indexed) { @@ -3607,10 +3621,7 @@ VkCommandBuffer wined3d_context_vk_apply_draw_state(struct wined3d_context_vk *c { /* We handle clears at the beginning of the render pass, no need for an explicit clear * first. */ - if (wined3d_rendertarget_view_get_locations(rtv) & WINED3D_LOCATION_CLEARED) - wined3d_rendertarget_view_prepare_location(rtv, &context_vk->c, rtv->resource->draw_binding); - else - wined3d_rendertarget_view_load_location(rtv, &context_vk->c, rtv->resource->draw_binding); + wined3d_context_vk_prepare_used_rtv(context_vk, rtv); invalidate_rt |= (1 << i); } else @@ -3628,16 +3639,9 @@ VkCommandBuffer wined3d_context_vk_apply_draw_state(struct wined3d_context_vk *c if ((dsv = state->fb.depth_stencil)) { if (wined3d_state_uses_depth_buffer(state)) - { - if (wined3d_rendertarget_view_get_locations(dsv) & WINED3D_LOCATION_CLEARED) - wined3d_rendertarget_view_prepare_location(dsv, &context_vk->c, dsv->resource->draw_binding); - else - wined3d_rendertarget_view_load_location(dsv, &context_vk->c, dsv->resource->draw_binding); - } + wined3d_context_vk_prepare_used_rtv(context_vk, dsv); else - { wined3d_rendertarget_view_prepare_location(dsv, &context_vk->c, dsv->resource->draw_binding); - } if (!state->depth_stencil_state || state->depth_stencil_state->writes_ds) invalidate_ds = true;
1
0
0
0
← Newer
1
...
79
80
81
82
83
84
85
...
92
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Results per page:
10
25
50
100
200