From 292a0e67f49ebc0cf03c376fa5a8fe82eb88b4bf Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Wed, 11 Jul 2018 10:57:01 +1000 Subject: [PATCH] Added ddraw-Prevent_viewport_crash patchset --- ...nt-division-by-zero-in-viewport_acti.patch | 31 +++++++++++++++++++ .../ddraw-Prevent_viewport_crash/definition | 1 + patches/patchinstall.sh | 19 ++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 patches/ddraw-Prevent_viewport_crash/0001-ddraw-Prevent-division-by-zero-in-viewport_acti.patch create mode 100644 patches/ddraw-Prevent_viewport_crash/definition diff --git a/patches/ddraw-Prevent_viewport_crash/0001-ddraw-Prevent-division-by-zero-in-viewport_acti.patch b/patches/ddraw-Prevent_viewport_crash/0001-ddraw-Prevent-division-by-zero-in-viewport_acti.patch new file mode 100644 index 00000000..7b09deea --- /dev/null +++ b/patches/ddraw-Prevent_viewport_crash/0001-ddraw-Prevent-division-by-zero-in-viewport_acti.patch @@ -0,0 +1,31 @@ +From 1cee10b74621b8d70ff31b6e358ee52bd57e695e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B3zef=20Kucia?= +Date: Sat, 2 Jan 2016 11:48:45 +0100 +Subject: [PATCH] ddraw: Prevent division by zero in viewport_activate. +Reply-To: wine-devel + +This just stop the crash, without fixing the actual cause. + +Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=36763 +--- + dlls/ddraw/viewport.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/dlls/ddraw/viewport.c b/dlls/ddraw/viewport.c +index 5ebc41e..16cdad4 100644 +--- a/dlls/ddraw/viewport.c ++++ b/dlls/ddraw/viewport.c +@@ -71,6 +71,10 @@ void viewport_activate(struct d3d_viewport *This, BOOL ignore_lights) + /* And copy the values in the structure used by the device */ + if (This->use_vp2) + { ++ if (!This->viewports.vp2.dvMinZ && !This->viewports.vp2.dvMaxZ ++ && !This->viewports.vp2.dvClipWidth && !This->viewports.vp2.dvClipHeight) ++ return; ++ + vp.dwX = This->viewports.vp2.dwX; + vp.dwY = This->viewports.vp2.dwY; + vp.dwHeight = This->viewports.vp2.dwHeight; +-- +2.4.10 + diff --git a/patches/ddraw-Prevent_viewport_crash/definition b/patches/ddraw-Prevent_viewport_crash/definition new file mode 100644 index 00000000..add62358 --- /dev/null +++ b/patches/ddraw-Prevent_viewport_crash/definition @@ -0,0 +1 @@ +Fixes: [36763] Prevent division by zero in viewport_activate diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index e7b3a243..3e054fcd 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -135,6 +135,7 @@ patch_enable_all () enable_ddraw_Fix_Typos="$1" enable_ddraw_FlipToGDISurface="$1" enable_ddraw_IDirect3DTexture2_Load="$1" + enable_ddraw_Prevent_viewport_crash="$1" enable_ddraw_Rendering_Targets="$1" enable_ddraw_Silence_FIXMEs="$1" enable_ddraw_Write_Vtable="$1" @@ -580,6 +581,9 @@ patch_enable () ddraw-IDirect3DTexture2_Load) enable_ddraw_IDirect3DTexture2_Load="$2" ;; + ddraw-Prevent_viewport_crash) + enable_ddraw_Prevent_viewport_crash="$2" + ;; ddraw-Rendering_Targets) enable_ddraw_Rendering_Targets="$2" ;; @@ -3500,6 +3504,21 @@ if test "$enable_ddraw_IDirect3DTexture2_Load" -eq 1; then ) >> "$patchlist" fi +# Patchset ddraw-Prevent_viewport_crash +# | +# | This patchset fixes the following Wine bugs: +# | * [#36763] Prevent division by zero in viewport_activate +# | +# | Modified files: +# | * dlls/ddraw/viewport.c +# | +if test "$enable_ddraw_Prevent_viewport_crash" -eq 1; then + patch_apply ddraw-Prevent_viewport_crash/0001-ddraw-Prevent-division-by-zero-in-viewport_acti.patch + ( + printf '%s\n' '+ { "Józef Kucia", "ddraw: Prevent division by zero in viewport_activate.", 1 },'; + ) >> "$patchlist" +fi + # Patchset ddraw-Rendering_Targets # | # | This patchset fixes the following Wine bugs: