Added patch to properly set ddsOldCaps field in ddraw7_GetCaps.

This commit is contained in:
Sebastian Lackner 2016-03-04 23:26:16 +01:00
parent 0dcb058c09
commit a13c29f479
3 changed files with 202 additions and 1 deletions

View File

@ -0,0 +1,197 @@
From 481804163415517f2dd6f8e7f8d739791b17aba5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Fri, 4 Mar 2016 22:22:42 +0100
Subject: ddraw: Set ddsOldCaps correctly in ddraw7_GetCaps.
---
dlls/ddraw/ddraw.c | 2 ++
dlls/ddraw/tests/ddraw1.c | 26 ++++++++++++++++++++++++++
dlls/ddraw/tests/ddraw2.c | 26 ++++++++++++++++++++++++++
dlls/ddraw/tests/ddraw4.c | 26 ++++++++++++++++++++++++++
dlls/ddraw/tests/ddraw7.c | 26 ++++++++++++++++++++++++++
5 files changed, 106 insertions(+)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index f9231d8..eeb941c 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -1532,6 +1532,8 @@ static HRESULT WINAPI ddraw7_GetCaps(IDirectDraw7 *iface, DDCAPS *DriverCaps, DD
caps.dwCaps |= DDCAPS_ALIGNSTRIDE;
caps.dwAlignStrideAlign = DDRAW_STRIDE_ALIGNMENT;
+ caps.ddsOldCaps.dwCaps = caps.ddsCaps.dwCaps;
+
IDirect3D7_EnumZBufferFormats(&ddraw->IDirect3D7_iface, &IID_IDirect3DHALDevice, enum_zbuffer, &caps);
if(DriverCaps)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index 1e1a2ff..c2f0b78 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -8497,6 +8497,31 @@ done:
DestroyWindow(window);
}
+static void test_caps(void)
+{
+ IDirectDraw *ddraw;
+ DDCAPS caps, caps2;
+ HRESULT hr;
+
+ ddraw = create_ddraw();
+ ok(!!ddraw, "Failed to create a ddraw object.\n");
+
+ caps.dwSize = sizeof(caps);
+ caps2.dwSize = sizeof(caps2);
+ hr = IDirectDraw_GetCaps(ddraw, &caps, &caps2);
+ ok(SUCCEEDED(hr), "Failed to query for caps, hr %#x.\n", hr);
+
+ ok(caps.ddsOldCaps.dwCaps == caps.ddsCaps.dwCaps,
+ "Expected hal ddsOldCaps and ddsCaps to be identical (%x vs %x).\n",
+ caps.ddsOldCaps.dwCaps, caps.ddsCaps.dwCaps);
+
+ ok(caps2.ddsOldCaps.dwCaps == caps2.ddsCaps.dwCaps,
+ "Expected hel ddsOldCaps and ddsCaps to be identical (%x vs %x).\n",
+ caps2.ddsOldCaps.dwCaps, caps2.ddsCaps.dwCaps);
+
+ IDirectDraw_Release(ddraw);
+}
+
START_TEST(ddraw1)
{
IDirectDraw *ddraw;
@@ -8573,4 +8598,5 @@ START_TEST(ddraw1)
test_yv12_overlay();
test_offscreen_overlay();
test_overlay_rect();
+ test_caps();
}
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index 75bdc84..03ca99c 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -9604,6 +9604,31 @@ done:
DestroyWindow(window);
}
+static void test_caps(void)
+{
+ IDirectDraw2 *ddraw;
+ DDCAPS caps, caps2;
+ HRESULT hr;
+
+ ddraw = create_ddraw();
+ ok(!!ddraw, "Failed to create a ddraw object.\n");
+
+ caps.dwSize = sizeof(caps);
+ caps2.dwSize = sizeof(caps2);
+ hr = IDirectDraw2_GetCaps(ddraw, &caps, &caps2);
+ ok(SUCCEEDED(hr), "Failed to query for caps, hr %#x.\n", hr);
+
+ ok(caps.ddsOldCaps.dwCaps == caps.ddsCaps.dwCaps,
+ "Expected hal ddsOldCaps and ddsCaps to be identical (%x vs %x).\n",
+ caps.ddsOldCaps.dwCaps, caps.ddsCaps.dwCaps);
+
+ ok(caps2.ddsOldCaps.dwCaps == caps2.ddsCaps.dwCaps,
+ "Expected hel ddsOldCaps and ddsCaps to be identical (%x vs %x).\n",
+ caps2.ddsOldCaps.dwCaps, caps2.ddsCaps.dwCaps);
+
+ IDirectDraw2_Release(ddraw);
+}
+
START_TEST(ddraw2)
{
IDirectDraw2 *ddraw;
@@ -9687,4 +9712,5 @@ START_TEST(ddraw2)
test_yv12_overlay();
test_offscreen_overlay();
test_overlay_rect();
+ test_caps();
}
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index a092787..2e6564a 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -10775,6 +10775,31 @@ done:
DestroyWindow(window);
}
+static void test_caps(void)
+{
+ IDirectDraw4 *ddraw;
+ DDCAPS caps, caps2;
+ HRESULT hr;
+
+ ddraw = create_ddraw();
+ ok(!!ddraw, "Failed to create a ddraw object.\n");
+
+ caps.dwSize = sizeof(caps);
+ caps2.dwSize = sizeof(caps2);
+ hr = IDirectDraw4_GetCaps(ddraw, &caps, &caps2);
+ ok(SUCCEEDED(hr), "Failed to query for caps, hr %#x.\n", hr);
+
+ ok(caps.ddsOldCaps.dwCaps == caps.ddsCaps.dwCaps,
+ "Expected hal ddsOldCaps and ddsCaps to be identical (%x vs %x).\n",
+ caps.ddsOldCaps.dwCaps, caps.ddsCaps.dwCaps);
+
+ ok(caps2.ddsOldCaps.dwCaps == caps2.ddsCaps.dwCaps,
+ "Expected hel ddsOldCaps and ddsCaps to be identical (%x vs %x).\n",
+ caps2.ddsOldCaps.dwCaps, caps2.ddsCaps.dwCaps);
+
+ IDirectDraw4_Release(ddraw);
+}
+
START_TEST(ddraw4)
{
IDirectDraw4 *ddraw;
@@ -10865,4 +10890,5 @@ START_TEST(ddraw4)
test_yv12_overlay();
test_offscreen_overlay();
test_overlay_rect();
+ test_caps();
}
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 1509be7..46330e5 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -11066,6 +11066,31 @@ done:
DestroyWindow(window);
}
+static void test_caps(void)
+{
+ IDirectDraw7 *ddraw;
+ DDCAPS caps, caps2;
+ HRESULT hr;
+
+ ddraw = create_ddraw();
+ ok(!!ddraw, "Failed to create a ddraw object.\n");
+
+ caps.dwSize = sizeof(caps);
+ caps2.dwSize = sizeof(caps2);
+ hr = IDirectDraw7_GetCaps(ddraw, &caps, &caps2);
+ ok(SUCCEEDED(hr), "Failed to query for caps, hr %#x.\n", hr);
+
+ ok(caps.ddsOldCaps.dwCaps == caps.ddsCaps.dwCaps,
+ "Expected hal ddsOldCaps and ddsCaps to be identical (%x vs %x).\n",
+ caps.ddsOldCaps.dwCaps, caps.ddsCaps.dwCaps);
+
+ ok(caps2.ddsOldCaps.dwCaps == caps2.ddsCaps.dwCaps,
+ "Expected hel ddsOldCaps and ddsCaps to be identical (%x vs %x).\n",
+ caps2.ddsOldCaps.dwCaps, caps2.ddsCaps.dwCaps);
+
+ IDirectDraw7_Release(ddraw);
+}
+
START_TEST(ddraw7)
{
HMODULE module = GetModuleHandleA("ddraw.dll");
@@ -11167,4 +11192,5 @@ START_TEST(ddraw7)
test_yv12_overlay();
test_offscreen_overlay();
test_overlay_rect();
+ test_caps();
}
--
2.7.1

View File

@ -1,2 +1,3 @@
Fixes: Don't set HWTRANSFORMANDLIGHT flag on d3d7 RGB device
Fixes: [27002] Properly initialize caps->dwZBufferBitDepths in ddraw7_GetCaps
Fixes: Properly set ddsOldCaps field in ddraw7_GetCaps

View File

@ -3264,14 +3264,17 @@ fi
# | * [#27002] Properly initialize caps->dwZBufferBitDepths in ddraw7_GetCaps
# |
# | Modified files:
# | * dlls/ddraw/ddraw.c, dlls/ddraw/tests/ddraw7.c
# | * dlls/ddraw/ddraw.c, dlls/ddraw/tests/ddraw1.c, dlls/ddraw/tests/ddraw2.c, dlls/ddraw/tests/ddraw4.c,
# | dlls/ddraw/tests/ddraw7.c
# |
if test "$enable_ddraw_Device_Caps" -eq 1; then
patch_apply ddraw-Device_Caps/0001-ddraw-Don-t-set-HWTRANSFORMANDLIGHT-flag-on-d3d7-RGB.patch
patch_apply ddraw-Device_Caps/0002-ddraw-Set-dwZBufferBitDepth-in-ddraw7_GetCaps.patch
patch_apply ddraw-Device_Caps/0003-ddraw-Set-ddsOldCaps-correctly-in-ddraw7_GetCaps.patch
(
echo '+ { "Michael Müller", "ddraw: Don'\''t set HWTRANSFORMANDLIGHT flag on d3d7 RGB device.", 1 },';
echo '+ { "Michael Müller", "ddraw: Set dwZBufferBitDepth in ddraw7_GetCaps.", 1 },';
echo '+ { "Michael Müller", "ddraw: Set ddsOldCaps correctly in ddraw7_GetCaps.", 1 },';
) >> "$patchlist"
fi