From: Elizabeth Figura zfigura@codeweavers.com
Based on a patch by Andrew D'Addesio. --- dlls/ddraw/ddraw.c | 37 +++++++++++++------------------------ dlls/ddraw/tests/ddraw1.c | 4 ++-- dlls/ddraw/tests/ddraw2.c | 4 ++-- 3 files changed, 17 insertions(+), 28 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 5d0a582c8e3..3e66b134a75 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -3847,28 +3847,9 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA return D3D_OK; }
-/***************************************************************************** - * IDirect3D3::EnumDevices - * - * Enumerates all supported Direct3DDevice interfaces. This is the - * implementation for Direct3D 1 to Direc3D 3, Version 7 has its own. - * - * Versions 1, 2 and 3 - * - * Params: - * callback: Application-provided routine to call for each enumerated device - * Context: Pointer to pass to the callback - * - * Returns: - * D3D_OK on success, - * The result of IDirect3DImpl_GetCaps if it failed - * - *****************************************************************************/ -static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBACK callback, void *context) +static HRESULT enum_devices_d3d3(struct ddraw *ddraw, LPD3DENUMDEVICESCALLBACK callback, void *context, DWORD desc_size) { static CHAR wined3d_description[] = "Wine D3DDevice using WineD3D and OpenGL"; - - struct ddraw *ddraw = impl_from_IDirect3D3(iface); D3DDEVICEDESC device_desc1, hal_desc, hel_desc; D3DDEVICEDESC7 device_desc7; HRESULT hr; @@ -3884,8 +3865,6 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA char device_name[50]; strcpy(device_name, "RGB Emulation");
- TRACE("iface %p, callback %p, context %p.\n", iface, callback, context); - if (!callback) return DDERR_INVALIDPARAMS;
@@ -3897,6 +3876,7 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA return hr; } ddraw_d3dcaps1_from_7(&device_desc1, &device_desc7); + device_desc1.dwSize = desc_size;
/* There's a registry key HKLM\Software\Microsoft\Direct3D\Drivers, * EnumReference which enables / disables enumerating the reference @@ -3967,13 +3947,22 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA return D3D_OK; }
+static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBACK callback, void *context) +{ + struct ddraw *ddraw = impl_from_IDirect3D3(iface); + + TRACE("iface %p, callback %p, context %p.\n", iface, callback, context); + + return enum_devices_d3d3(ddraw, callback, context, sizeof(D3DDEVICEDESC)); +} + static HRESULT WINAPI d3d2_EnumDevices(IDirect3D2 *iface, LPD3DENUMDEVICESCALLBACK callback, void *context) { struct ddraw *ddraw = impl_from_IDirect3D2(iface);
TRACE("iface %p, callback %p, context %p.\n", iface, callback, context);
- return d3d3_EnumDevices(&ddraw->IDirect3D3_iface, callback, context); + return enum_devices_d3d3(ddraw, callback, context, offsetof(D3DDEVICEDESC, dwMaxTextureRepeat)); }
static HRESULT WINAPI d3d1_EnumDevices(IDirect3D *iface, LPD3DENUMDEVICESCALLBACK callback, void *context) @@ -3982,7 +3971,7 @@ static HRESULT WINAPI d3d1_EnumDevices(IDirect3D *iface, LPD3DENUMDEVICESCALLBAC
TRACE("iface %p, callback %p, context %p.\n", iface, callback, context);
- return d3d3_EnumDevices(&ddraw->IDirect3D3_iface, callback, context); + return enum_devices_d3d3(ddraw, callback, context, offsetof(D3DDEVICEDESC, dwMinTextureWidth)); }
/***************************************************************************** diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index a4a7ad2c423..ce83144a0d5 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -15471,8 +15471,8 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d static const D3DPRIMCAPS empty_primitive_caps = {.dwSize = sizeof(D3DPRIMCAPS)}; IDirectDraw *ddraw = ctx;
- todo_wine ok(hal->dwSize == offsetof(D3DDEVICEDESC, dwMinTextureWidth), "Got size %lu.\n", hal->dwSize); - todo_wine ok(hel->dwSize == offsetof(D3DDEVICEDESC, dwMinTextureWidth), "Got size %lu.\n", hel->dwSize); + ok(hal->dwSize == offsetof(D3DDEVICEDESC, dwMinTextureWidth), "Got size %lu.\n", hal->dwSize); + ok(hel->dwSize == offsetof(D3DDEVICEDESC, dwMinTextureWidth), "Got size %lu.\n", hel->dwSize); ok(hal->dtcTransformCaps.dwSize == sizeof(D3DTRANSFORMCAPS) || (ddraw_is_warp(ddraw) && !hal->dtcTransformCaps.dwSize), "Got transform caps size %lu.\n", hal->dtcTransformCaps.dwSize); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 045314b78ac..40dcbd2bd0b 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -16466,8 +16466,8 @@ static HRESULT WINAPI test_enum_devices_caps_callback(GUID *guid, char *device_d static const D3DPRIMCAPS empty_primitive_caps = {.dwSize = sizeof(D3DPRIMCAPS)}; IDirectDraw2 *ddraw = ctx;
- todo_wine ok(hal->dwSize == offsetof(D3DDEVICEDESC, dwMaxTextureRepeat), "Got size %lu.\n", hal->dwSize); - todo_wine ok(hel->dwSize == offsetof(D3DDEVICEDESC, dwMaxTextureRepeat), "Got size %lu.\n", hel->dwSize); + ok(hal->dwSize == offsetof(D3DDEVICEDESC, dwMaxTextureRepeat), "Got size %lu.\n", hal->dwSize); + ok(hel->dwSize == offsetof(D3DDEVICEDESC, dwMaxTextureRepeat), "Got size %lu.\n", hel->dwSize); ok(hal->dtcTransformCaps.dwSize == sizeof(D3DTRANSFORMCAPS) || (ddraw_is_warp(ddraw) && !hal->dtcTransformCaps.dwSize), "Got transform caps size %lu.\n", hal->dtcTransformCaps.dwSize);