Added patch to accept d3d1 and d3d2 versions of D3DFINDDEVICERESULT in IDirect3D_FindDevice.

This commit is contained in:
Sebastian Lackner 2016-02-28 05:10:17 +01:00
parent 090ba911dd
commit 8589621434
3 changed files with 176 additions and 0 deletions

View File

@ -0,0 +1,159 @@
From d7c4217174337d31778a5582b71b8c98e8a55852 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 28 Feb 2016 05:02:48 +0100
Subject: ddraw: Accept d3d1 and d3d2 versions of D3DFINDDEVICERESULT in
IDirect3D_FindDevice.
---
dlls/ddraw/ddraw.c | 24 +++++++++++++++++++----
dlls/ddraw/tests/d3d.c | 14 ++++++++++++++
include/d3dcaps.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 86 insertions(+), 4 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 782b6b5..0d2ec53 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -3992,8 +3992,8 @@ static HRESULT WINAPI d3d3_FindDevice(IDirect3D3 *iface, D3DFINDDEVICESEARCH *fd
if (!fds || !fdr) return DDERR_INVALIDPARAMS;
- if (fds->dwSize != sizeof(D3DFINDDEVICESEARCH)
- || fdr->dwSize != sizeof(D3DFINDDEVICERESULT))
+ if (fds->dwSize != sizeof(D3DFINDDEVICESEARCH) || (fdr->dwSize != sizeof(D3DFINDDEVICERESULT1) &&
+ fdr->dwSize != sizeof(D3DFINDDEVICERESULT2) && fdr->dwSize != sizeof(D3DFINDDEVICERESULT)))
return DDERR_INVALIDPARAMS;
if ((fds->dwFlags & D3DFDS_COLORMODEL)
@@ -4022,8 +4022,24 @@ static HRESULT WINAPI d3d3_FindDevice(IDirect3D3 *iface, D3DFINDDEVICESEARCH *fd
/* Now return our own GUID */
ddraw_d3dcaps1_from_7(&desc1, &desc7);
fdr->guid = IID_D3DDEVICE_WineD3D;
- fdr->ddHwDesc = desc1;
- fdr->ddSwDesc = desc1;
+
+ if (fdr->dwSize == sizeof(D3DFINDDEVICERESULT1))
+ {
+ D3DFINDDEVICERESULT1 *fdr1 = (D3DFINDDEVICERESULT1 *)fdr;
+ memcpy(&fdr1->ddHwDesc, &desc1, sizeof(fdr1->ddHwDesc));
+ memcpy(&fdr1->ddSwDesc, &desc1, sizeof(fdr1->ddSwDesc));
+ }
+ else if (fdr->dwSize == sizeof(D3DFINDDEVICERESULT2))
+ {
+ D3DFINDDEVICERESULT2 *fdr2 = (D3DFINDDEVICERESULT2 *)fdr;
+ memcpy(&fdr2->ddHwDesc, &desc1, sizeof(fdr2->ddHwDesc));
+ memcpy(&fdr2->ddSwDesc, &desc1, sizeof(fdr2->ddSwDesc));
+ }
+ else
+ {
+ fdr->ddHwDesc = desc1;
+ fdr->ddSwDesc = desc1;
+ }
TRACE("Returning Wine's wined3d device with (undumped) capabilities.\n");
diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c
index 06f16f3..12db306 100644
--- a/dlls/ddraw/tests/d3d.c
+++ b/dlls/ddraw/tests/d3d.c
@@ -3211,6 +3211,8 @@ static void FindDevice(void)
D3DFINDDEVICESEARCH search = {0};
D3DFINDDEVICERESULT result = {0};
+ D3DFINDDEVICERESULT1 result1 = {0};
+ D3DFINDDEVICERESULT2 result2 = {0};
IDirect3DDevice *d3dhal;
HRESULT hr;
int i;
@@ -3251,6 +3253,18 @@ static void FindDevice(void)
ok(hr == D3D_OK,
"Expected IDirect3D1::FindDevice to return D3D_OK, got 0x%08x\n", hr);
+ result1.dwSize = sizeof(result1);
+
+ hr = IDirect3D_FindDevice(Direct3D1, &search, (D3DFINDDEVICERESULT *)&result1);
+ ok(hr == D3D_OK,
+ "Expected IDirect3D1::FindDevice to return D3D_OK, got 0x%08x\n", hr);
+
+ result2.dwSize = sizeof(result2);
+
+ hr = IDirect3D_FindDevice(Direct3D1, &search, (D3DFINDDEVICERESULT *)&result2);
+ ok(hr == D3D_OK,
+ "Expected IDirect3D1::FindDevice to return D3D_OK, got 0x%08x\n", hr);
+
/* Try an arbitrary non-device GUID. */
search.dwSize = sizeof(search);
search.dwFlags = D3DFDS_GUID;
diff --git a/include/d3dcaps.h b/include/d3dcaps.h
index 4fc76ba..51e3efa 100644
--- a/include/d3dcaps.h
+++ b/include/d3dcaps.h
@@ -193,6 +193,44 @@ typedef struct _D3dPrimCaps {
#define D3DPTADDRESSCAPS_BORDER 0x00000008
#define D3DPTADDRESSCAPS_INDEPENDENTUV 0x00000010
+typedef struct _D3DDeviceDesc1 {
+ DWORD dwSize;
+ DWORD dwFlags;
+ D3DCOLORMODEL dcmColorModel;
+ DWORD dwDevCaps;
+ D3DTRANSFORMCAPS dtcTransformCaps;
+ BOOL bClipping;
+ D3DLIGHTINGCAPS dlcLightingCaps;
+ D3DPRIMCAPS dpcLineCaps;
+ D3DPRIMCAPS dpcTriCaps;
+ DWORD dwDeviceRenderBitDepth;
+ DWORD dwDeviceZBufferBitDepth;
+ DWORD dwMaxBufferSize;
+ DWORD dwMaxVertexCount;
+} D3DDEVICEDESC1,*LPD3DDEVICEDESC1;
+#define D3DDEVICEDESCSIZE1 (sizeof(D3DDEVICEDESC1))
+
+typedef struct _D3DDeviceDesc2 {
+ DWORD dwSize;
+ DWORD dwFlags;
+ D3DCOLORMODEL dcmColorModel;
+ DWORD dwDevCaps;
+ D3DTRANSFORMCAPS dtcTransformCaps;
+ BOOL bClipping;
+ D3DLIGHTINGCAPS dlcLightingCaps;
+ D3DPRIMCAPS dpcLineCaps;
+ D3DPRIMCAPS dpcTriCaps;
+ DWORD dwDeviceRenderBitDepth;
+ DWORD dwDeviceZBufferBitDepth;
+ DWORD dwMaxBufferSize;
+ DWORD dwMaxVertexCount;
+
+ DWORD dwMinTextureWidth,dwMinTextureHeight;
+ DWORD dwMaxTextureWidth,dwMaxTextureHeight;
+ DWORD dwMinStippleWidth,dwMaxStippleWidth;
+ DWORD dwMinStippleHeight,dwMaxStippleHeight;
+} D3DDEVICEDESC2,*LPD3DDEVICEDESC2;
+#define D3DDEVICEDESCSIZE2 (sizeof(D3DDEVICEDESC2))
typedef struct _D3DDeviceDesc {
DWORD dwSize;
@@ -382,6 +420,20 @@ typedef struct _D3DFINDDEVICESEARCH {
D3DPRIMCAPS dpcPrimCaps;
} D3DFINDDEVICESEARCH,*LPD3DFINDDEVICESEARCH;
+typedef struct _D3DFINDDEVICERESULT1 {
+ DWORD dwSize;
+ GUID guid;
+ D3DDEVICEDESC1 ddHwDesc;
+ D3DDEVICEDESC1 ddSwDesc;
+} D3DFINDDEVICERESULT1,*LPD3DFINDDEVICERESULT1;
+
+typedef struct _D3DFINDDEVICERESULT2 {
+ DWORD dwSize;
+ GUID guid;
+ D3DDEVICEDESC2 ddHwDesc;
+ D3DDEVICEDESC2 ddSwDesc;
+} D3DFINDDEVICERESULT2,*LPD3DFINDDEVICERESULT2;
+
typedef struct _D3DFINDDEVICERESULT {
DWORD dwSize;
GUID guid;
--
2.7.1

View File

@ -0,0 +1 @@
Fixes: Accept d3d1 and d3d2 versions of D3DFINDDEVICERESULT in IDirect3D_FindDevice

View File

@ -126,6 +126,7 @@ patch_enable_all ()
enable_d3dx9_36_Texture_Align="$1"
enable_d3dx9_36_UpdateSkinnedMesh="$1"
enable_dbghelp_Debug_Symbols="$1"
enable_ddraw_D3DFINDDEVICERESULT="$1"
enable_ddraw_Device_Caps="$1"
enable_ddraw_EnumSurfaces="$1"
enable_ddraw_IDirect3DTexture2_Load="$1"
@ -530,6 +531,9 @@ patch_enable ()
dbghelp-Debug_Symbols)
enable_dbghelp_Debug_Symbols="$2"
;;
ddraw-D3DFINDDEVICERESULT)
enable_ddraw_D3DFINDDEVICERESULT="$2"
;;
ddraw-Device_Caps)
enable_ddraw_Device_Caps="$2"
;;
@ -3277,6 +3281,18 @@ if test "$enable_dbghelp_Debug_Symbols" -eq 1; then
) >> "$patchlist"
fi
# Patchset ddraw-D3DFINDDEVICERESULT
# |
# | Modified files:
# | * dlls/ddraw/ddraw.c, dlls/ddraw/tests/d3d.c, include/d3dcaps.h
# |
if test "$enable_ddraw_D3DFINDDEVICERESULT" -eq 1; then
patch_apply ddraw-D3DFINDDEVICERESULT/0001-ddraw-Accept-d3d1-and-d3d2-versions-of-D3DFINDDEVICE.patch
(
echo '+ { "Michael Müller", "ddraw: Accept d3d1 and d3d2 versions of D3DFINDDEVICERESULT in IDirect3D_FindDevice.", 1 },';
) >> "$patchlist"
fi
# Patchset ddraw-Device_Caps
# |
# | Modified files: