diff --git a/patches/d3drm-IDirect3D3-support/0001-d3drm-Support-IDirect3D3-when-creating-device.patch b/patches/d3drm-IDirect3D3-support/0001-d3drm-Support-IDirect3D3-when-creating-device.patch new file mode 100644 index 00000000..8c5d457c --- /dev/null +++ b/patches/d3drm-IDirect3D3-support/0001-d3drm-Support-IDirect3D3-when-creating-device.patch @@ -0,0 +1,76 @@ +From 9ea60091ba885b5f63266374f49f0d63e2cf2767 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Wed, 16 Dec 2020 11:07:05 +1100 +Subject: [PATCH] d3drm: Support IDirect3D3 when creating device + +Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=39346 +--- + dlls/d3drm/device.c | 26 ++++++++++++++++++++++++-- + 1 file changed, 24 insertions(+), 2 deletions(-) + +diff --git a/dlls/d3drm/device.c b/dlls/d3drm/device.c +index 2e1b5f2d24f..fff272197bf 100644 +--- a/dlls/d3drm/device.c ++++ b/dlls/d3drm/device.c +@@ -124,7 +124,9 @@ HRESULT d3drm_device_init(struct d3drm_device *device, UINT version, IDirectDraw + IDirectDrawSurface *ds = NULL; + IDirect3DDevice *device1 = NULL; + IDirect3DDevice2 *device2 = NULL; ++ IDirect3DDevice3 *device3 = NULL; + IDirect3D2 *d3d2 = NULL; ++ IDirect3D3 *d3d3 = NULL; + DDSURFACEDESC desc, surface_desc; + HRESULT hr; + +@@ -171,19 +173,29 @@ HRESULT d3drm_device_init(struct d3drm_device *device, UINT version, IDirectDraw + + if (version == 1) + hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DRGBDevice, (void **)&device1); +- else ++ else if (version == 2) + { + IDirectDraw_QueryInterface(ddraw, &IID_IDirect3D2, (void**)&d3d2); + hr = IDirect3D2_CreateDevice(d3d2, &IID_IDirect3DRGBDevice, surface, &device2); + IDirect3D2_Release(d3d2); + } ++ else ++ { ++ IDirectDrawSurface4 *surface4 = NULL; ++ ++ IDirectDrawSurface_QueryInterface(surface, &IID_IDirectDrawSurface4, (void**)&surface4); ++ IDirectDraw_QueryInterface(ddraw, &IID_IDirect3D3, (void**)&d3d3); ++ hr = IDirect3D3_CreateDevice(d3d3, &IID_IDirect3DRGBDevice, surface4, &device3, NULL); ++ IDirectDrawSurface4_Release(surface4); ++ IDirect3D3_Release(d3d3); ++ } + if (FAILED(hr)) + { + IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds); + return hr; + } + +- if (version != 1) ++ if (version == 2) + { + hr = IDirect3DDevice2_QueryInterface(device2, &IID_IDirect3DDevice, (void**)&device1); + IDirect3DDevice2_Release(device2); +@@ -193,6 +205,16 @@ HRESULT d3drm_device_init(struct d3drm_device *device, UINT version, IDirectDraw + return hr; + } + } ++ else if (version == 3) ++ { ++ hr = IDirect3DDevice3_QueryInterface(device3, &IID_IDirect3DDevice, (void**)&device1); ++ IDirect3DDevice3_Release(device3); ++ if (FAILED(hr)) ++ { ++ IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds); ++ return hr; ++ } ++ } + device->device = device1; + device->width = desc.dwWidth; + device->height = desc.dwHeight; +-- +2.29.2 + diff --git a/patches/d3drm-IDirect3D3-support/definition b/patches/d3drm-IDirect3D3-support/definition new file mode 100644 index 00000000..0cb63bff --- /dev/null +++ b/patches/d3drm-IDirect3D3-support/definition @@ -0,0 +1 @@ +Fixes: [39346] Support IDirect3D3 when creating device. diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 61f586ab..adda19b0 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -97,6 +97,7 @@ patch_enable_all () enable_crypt32_CMS_Certificates="$1" enable_cryptext_CryptExtOpenCER="$1" enable_d3d11_Deferred_Context="$1" + enable_d3drm_IDirect3D3_support="$1" enable_d3dx9_32bpp_Alpha_Channel="$1" enable_d3dx9_36_BumpLuminance="$1" enable_d3dx9_36_CloneEffect="$1" @@ -374,6 +375,9 @@ patch_enable () d3d11-Deferred_Context) enable_d3d11_Deferred_Context="$2" ;; + d3drm-IDirect3D3-support) + enable_d3drm_IDirect3D3_support="$2" + ;; d3dx9-32bpp_Alpha_Channel) enable_d3dx9_32bpp_Alpha_Channel="$2" ;; @@ -1989,6 +1993,18 @@ if test "$enable_d3d11_Deferred_Context" -eq 1; then patch_apply d3d11-Deferred_Context/0045-d3d11-Implement-ID3D11Device2-GetImmediateContext1.patch fi +# Patchset d3drm-IDirect3D3-support +# | +# | This patchset fixes the following Wine bugs: +# | * [#39346] Support IDirect3D3 when creating device. +# | +# | Modified files: +# | * dlls/d3drm/device.c +# | +if test "$enable_d3drm_IDirect3D3_support" -eq 1; then + patch_apply d3drm-IDirect3D3-support/0001-d3drm-Support-IDirect3D3-when-creating-device.patch +fi + # Patchset d3dx9-32bpp_Alpha_Channel # | # | This patchset fixes the following Wine bugs: