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.
This commit is contained in:
Zhiyi Zhang 2022-08-19 17:09:46 +08:00 committed by Alexandre Julliard
parent 0868bed180
commit 6c391ac139
2 changed files with 7 additions and 3 deletions

View file

@ -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)
{

View file

@ -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");
}