Rebase against 174bb7776d3971e1ed91d57a47a7599b14c6eb45.

This commit is contained in:
Alistair Leslie-Hughes 2024-03-13 15:56:53 +11:00
parent 410820a918
commit 435e01412e
2 changed files with 30 additions and 25 deletions

View File

@ -1,15 +1,15 @@
From e4688a88901a1c13b2df67a0444c34e3ee02bbab Mon Sep 17 00:00:00 2001
From 9c7acdba85edafc52bc0cc2719ac556894a59351 Mon Sep 17 00:00:00 2001
From: Andrew D'Addesio <andrew@fatbag.net>
Date: Fri, 8 Feb 2019 18:48:33 -1000
Subject: [PATCH] ddraw: Return correct devices based off requested DirectX
version.
---
dlls/ddraw/ddraw.c | 232 +++++++++++++++++++++++++--------------------
1 file changed, 129 insertions(+), 103 deletions(-)
dlls/ddraw/ddraw.c | 240 +++++++++++++++++++++++++--------------------
1 file changed, 131 insertions(+), 109 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 5887854556b..5ac95dc3043 100644
index 8f2fd9f3b4b..0ef400b7a26 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -44,37 +44,80 @@ static const DDDEVICEIDENTIFIER2 deviceidentifier =
@ -122,7 +122,7 @@ index 5887854556b..5ac95dc3043 100644
/* Fill the missing members, and do some fixup */
caps->dpcLineCaps.dwSize = sizeof(caps->dpcLineCaps);
caps->dpcLineCaps.dwTextureBlendCaps = D3DPTBLENDCAPS_ADD
@@ -3746,8 +3780,7 @@ static HRESULT WINAPI ddraw1_DuplicateSurface(IDirectDraw *iface, IDirectDrawSur
@@ -3770,8 +3804,7 @@ static HRESULT WINAPI ddraw1_DuplicateSurface(IDirectDraw *iface, IDirectDrawSur
/*****************************************************************************
* IDirect3D7::EnumDevices
*
@ -132,7 +132,7 @@ index 5887854556b..5ac95dc3043 100644
*
* Params:
* callback: Function to call for each enumerated device
@@ -3779,13 +3812,16 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA
@@ -3803,13 +3836,16 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA
}
dev_caps = device_desc7.dwDevCaps;
@ -153,7 +153,7 @@ index 5887854556b..5ac95dc3043 100644
if (ret != DDENUMRET_OK)
{
TRACE("Application cancelled the enumeration.\n");
@@ -3801,11 +3837,21 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA
@@ -3825,11 +3861,21 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA
return D3D_OK;
}
@ -177,7 +177,7 @@ index 5887854556b..5ac95dc3043 100644
*
* Versions 1, 2 and 3
*
@@ -3820,18 +3866,18 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA
@@ -3844,18 +3890,18 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA
*****************************************************************************/
static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBACK callback, void *context)
{
@ -205,7 +205,7 @@ index 5887854556b..5ac95dc3043 100644
TRACE("iface %p, callback %p, context %p.\n", iface, callback, context);
@@ -3840,55 +3886,60 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA
@@ -3864,58 +3910,59 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA
wined3d_mutex_lock();
@ -221,7 +221,6 @@ index 5887854556b..5ac95dc3043 100644
wined3d_mutex_unlock();
return hr;
}
+
ddraw_d3dcaps1_from_7(&device_desc1, &device_desc7);
+ device_desc1.dwSize = desc_size;
@ -245,15 +244,12 @@ index 5887854556b..5ac95dc3043 100644
- * flag set. This way it refuses the emulation device, and HAL devices
- * never have POW2 unset in d3d7 on windows. */
- if (ddraw->d3dversion != 1)
+ clear_device_desc(&empty_desc1);
+ empty_desc1.dwSize = desc_size;
+
+ for (i = 0; i < ARRAY_SIZE(device_list); i++)
{
- static CHAR reference_description[] = "RGB Direct3D emulation";
+ if (!(device_list[i].version_mask & D3D_VERSION(ddraw->d3dversion)))
+ continue;
- {
- /* Tomb Raider 3 overwrites the reference device description buffer
- * with its own custom string. Reserve some extra space in the array
- * to avoid a buffer overrun. */
- static CHAR reference_description[64] = "RGB Direct3D emulation";
-
- TRACE("Enumerating WineD3D D3DDevice interface.\n");
- hal_desc = device_desc1;
- hel_desc = device_desc1;
@ -269,13 +265,22 @@ index 5887854556b..5ac95dc3043 100644
- /* RGB, REF, RAMP and MMX devices don't report hardware transform and lighting capability */
- hal_desc.dwDevCaps &= ~(D3DDEVCAPS_HWTRANSFORMANDLIGHT | D3DDEVCAPS_DRAWPRIMITIVES2EX | D3DDEVCAPS_HWRASTERIZATION);
- hel_desc.dwDevCaps &= ~(D3DDEVCAPS_HWTRANSFORMANDLIGHT | D3DDEVCAPS_DRAWPRIMITIVES2EX | D3DDEVCAPS_HWRASTERIZATION);
+ if (IsEqualGUID(&IID_IDirect3DHALDevice, device_list[i].device_guid))
+ {
+ hal_desc = device_desc1;
-
- hr = callback((GUID *)&IID_IDirect3DRGBDevice, reference_description,
- device_name, &hal_desc, &hel_desc, context);
- if (hr != D3DENUMRET_OK)
+ clear_device_desc(&empty_desc1);
+ empty_desc1.dwSize = desc_size;
+
+ for (i = 0; i < ARRAY_SIZE(device_list); i++)
+ {
+ if (!(device_list[i].version_mask & D3D_VERSION(ddraw->d3dversion)))
+ continue;
+
+ if (IsEqualGUID(&IID_IDirect3DHALDevice, device_list[i].device_guid))
+ {
+ hal_desc = device_desc1;
+
+ /* The HAL device's hel_desc is almost empty -- but not completely */
+ hel_desc = empty_desc1;
+ hel_desc.dwFlags = D3DDD_COLORMODEL | D3DDD_DEVCAPS | D3DDD_TRANSFORMCAPS
@ -305,7 +310,7 @@ index 5887854556b..5ac95dc3043 100644
{
TRACE("Application cancelled the enumeration.\n");
wined3d_mutex_unlock();
@@ -3896,31 +3947,6 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA
@@ -3923,31 +3970,6 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA
}
}

View File

@ -1 +1 @@
1719aef8cbc99994ec93848ae6e9e29e5c4beb78
174bb7776d3971e1ed91d57a47a7599b14c6eb45