Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/ddraw/tests/ddraw1.c | 9 +++++++-- dlls/ddraw/tests/ddraw2.c | 9 +++++++-- dlls/ddraw/tests/ddraw4.c | 9 +++++++-- dlls/ddraw/tests/ddraw7.c | 25 +++++++++++++++++++------ 4 files changed, 40 insertions(+), 12 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 5bfca43008..3495939d07 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -513,7 +513,7 @@ static IDirectDraw *create_ddraw(void) return ddraw; }
-static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coop_level) +static IDirect3DDevice *create_device_riid(IDirectDraw *ddraw, HWND window, DWORD coop_level, REFCLSID riid) { /* Prefer 16 bit depth buffers because Nvidia gives us an unpadded D24 buffer if we ask * for 24 bit and handles such buffers incorrectly in DDBLT_DEPTHFILL. AMD only supports @@ -573,7 +573,7 @@ static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coo if (FAILED(hr)) continue;
- if (SUCCEEDED(IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device))) + if (SUCCEEDED(IDirectDrawSurface_QueryInterface(surface, riid, (void **)&device))) break;
IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds); @@ -583,6 +583,11 @@ static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coo return device; }
+static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coop_level) +{ + return create_device_riid(ddraw, window, coop_level, &IID_IDirect3DHALDevice); +} + static IDirect3DViewport *create_viewport(IDirect3DDevice *device, UINT x, UINT y, UINT w, UINT h) { IDirect3DViewport *viewport; diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index b472b3d588..d18bf7da01 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -342,7 +342,7 @@ static IDirectDraw2 *create_ddraw(void) return ddraw2; }
-static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD coop_level) +static IDirect3DDevice2 *create_device_riid(IDirectDraw2 *ddraw, HWND window, DWORD coop_level, REFCLSID riid) { /* Prefer 16 bit depth buffers because Nvidia gives us an unpadded D24 buffer if we ask * for 24 bit and handles such buffers incorrectly in DDBLT_DEPTHFILL. AMD only supports @@ -410,7 +410,7 @@ static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD c if (FAILED(hr)) continue;
- if (SUCCEEDED(IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device))) + if (SUCCEEDED(IDirect3D2_CreateDevice(d3d, riid, surface, &device))) break;
IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds); @@ -421,6 +421,11 @@ static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD c return device; }
+static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD coop_level) +{ + return create_device_riid(ddraw, window, coop_level, &IID_IDirect3DHALDevice); +} + static IDirect3DViewport2 *create_viewport(IDirect3DDevice2 *device, UINT x, UINT y, UINT w, UINT h) { IDirect3DViewport2 *viewport; diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 1e6cf4c446..825fc6ef3c 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -330,7 +330,7 @@ static IDirectDraw4 *create_ddraw(void) return ddraw4; }
-static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level) +static IDirect3DDevice3 *create_device_riid(HWND window, DWORD coop_level, REFCLSID riid) { IDirectDrawSurface4 *surface, *ds; IDirect3DDevice3 *device = NULL; @@ -412,7 +412,7 @@ static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level) return NULL; }
- hr = IDirect3D3_CreateDevice(d3d3, &IID_IDirect3DHALDevice, surface, &device, NULL); + hr = IDirect3D3_CreateDevice(d3d3, riid, surface, &device, NULL); IDirect3D3_Release(d3d3); IDirectDrawSurface4_Release(surface); if (FAILED(hr)) @@ -421,6 +421,11 @@ static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level) return device; }
+static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level) +{ + return create_device_riid(window, coop_level, &IID_IDirect3DHALDevice); +} + static IDirect3DViewport3 *create_viewport(IDirect3DDevice3 *device, UINT x, UINT y, UINT w, UINT h) { IDirect3DViewport3 *viewport; diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 9d3734579e..1bfe6d2e08 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -353,7 +353,7 @@ static HRESULT WINAPI enum_devtype_cb(char *desc_str, char *name, D3DDEVICEDESC7 return DDENUMRET_OK; }
-static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level) +static IDirect3DDevice7 *create_device_riid(HWND window, DWORD coop_level, REFCLSID riid) { IDirectDrawSurface7 *surface, *ds; IDirect3DDevice7 *device = NULL; @@ -362,8 +362,7 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level) IDirectDraw7 *ddraw; IDirect3D7 *d3d7; HRESULT hr; - struct { REFCLSID riid; BOOL present; } device_data = { &IID_IDirect3DTnLHalDevice }; - const GUID *devtype = &IID_IDirect3DHALDevice; + struct { REFCLSID riid; BOOL present; } device_data = { riid };
if (!(ddraw = create_ddraw())) return NULL; @@ -404,10 +403,15 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level)
hr = IDirect3D7_EnumDevices(d3d7, enum_devtype_cb, &device_data); ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr); - if (device_data.present) devtype = device_data.riid; + if (!device_data.present) + { + IDirect3D7_Release(d3d7); + IDirectDrawSurface7_Release(surface); + return NULL; + }
memset(&z_fmt, 0, sizeof(z_fmt)); - hr = IDirect3D7_EnumZBufferFormats(d3d7, devtype, enum_z_fmt, &z_fmt); + hr = IDirect3D7_EnumZBufferFormats(d3d7, riid, enum_z_fmt, &z_fmt); if (FAILED(hr) || !z_fmt.dwSize) { IDirect3D7_Release(d3d7); @@ -441,7 +445,7 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level) return NULL; }
- hr = IDirect3D7_CreateDevice(d3d7, devtype, surface, &device); + hr = IDirect3D7_CreateDevice(d3d7, riid, surface, &device); IDirect3D7_Release(d3d7); IDirectDrawSurface7_Release(surface); if (FAILED(hr)) @@ -450,6 +454,15 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level) return device; }
+static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level) +{ + IDirect3DDevice7 *device; + device = create_device_riid(window, coop_level, &IID_IDirect3DTnLHalDevice); + if (!device) + device = create_device_riid(window, coop_level, &IID_IDirect3DHALDevice); + return device; +} + struct message { UINT message;