Module: wine Branch: master Commit: 6c391ac139f90549f068ea21390b1e028549574c URL: https://gitlab.winehq.org/wine/wine/-/commit/6c391ac139f90549f068ea21390b1e0...
Author: Zhiyi Zhang zzhang@codeweavers.com Date: Fri Aug 19 17:09:46 2022 +0800
ddraw: Don't report unsupported device capabilities in d3d7_EnumDevices().
Fix Battle Realms: Zen Edition failing to start. The game expects to find a device without D3DDEVCAPS_HWTRANSFORMANDLIGHT.
---
dlls/ddraw/ddraw.c | 7 +++++++ dlls/ddraw/tests/ddraw7.c | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index bb244222018..64eb7235ebf 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -49,6 +49,7 @@ static struct enum_device_entry char interface_name[100]; char device_name[100]; const GUID *device_guid; + DWORD unsupported_caps; } device_list7[] = { /* T&L HAL device */ @@ -56,6 +57,7 @@ static struct enum_device_entry "WINE Direct3D7 Hardware Transform and Lighting acceleration using WineD3D", "Wine D3D7 T&L HAL", &IID_IDirect3DTnLHalDevice, + 0, },
/* HAL device */ @@ -63,6 +65,7 @@ static struct enum_device_entry "WINE Direct3D7 Hardware acceleration using WineD3D", "Direct3D HAL", &IID_IDirect3DHALDevice, + D3DDEVCAPS_HWTRANSFORMANDLIGHT, },
/* RGB device */ @@ -70,6 +73,7 @@ static struct enum_device_entry "WINE Direct3D7 RGB Software Emulation using WineD3D", "Wine D3D7 RGB", &IID_IDirect3DRGBDevice, + D3DDEVCAPS_HWTRANSFORMANDLIGHT | D3DDEVCAPS_DRAWPRIMITIVES2EX, }, };
@@ -3757,6 +3761,7 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA { struct ddraw *ddraw = impl_from_IDirect3D7(iface); D3DDEVICEDESC7 device_desc7; + DWORD dev_caps; HRESULT hr; size_t i;
@@ -3772,12 +3777,14 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA wined3d_mutex_unlock(); return hr; } + dev_caps = device_desc7.dwDevCaps;
for (i = 0; i < ARRAY_SIZE(device_list7); i++) { HRESULT ret;
device_desc7.deviceGUID = *device_list7[i].device_guid; + device_desc7.dwDevCaps = dev_caps & ~device_list7[i].unsupported_caps; ret = callback(device_list7[i].interface_name, device_list7[i].device_name, &device_desc7, context); if (ret != DDENUMRET_OK) { diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 99c9c7df2bc..15ab548ebc6 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -19402,7 +19402,6 @@ static HRESULT WINAPI test_enum_devices_caps_callback(char *device_desc, char *d } else if (IsEqualGUID(&device_desc7->deviceGUID, &IID_IDirect3DHALDevice)) { - todo_wine ok((device_desc7->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "HAL Device device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); ok(device_desc7->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX, @@ -19410,10 +19409,8 @@ static HRESULT WINAPI test_enum_devices_caps_callback(char *device_desc, char *d } else if (IsEqualGUID(&device_desc7->deviceGUID, &IID_IDirect3DRGBDevice)) { - todo_wine ok((device_desc7->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) == 0, "RGB Device device caps has D3DDEVCAPS_HWTRANSFORMANDLIGHT set\n"); - todo_wine ok((device_desc7->dwDevCaps & D3DDEVCAPS_DRAWPRIMITIVES2EX) == 0, "RGB Device device caps has D3DDEVCAPS_DRAWPRIMITIVES2EX set\n"); }