[PATCH] wined3d: Limit amount of video memory for older Windows versions.

Józef Kucia jkucia at codeweavers.com
Fri Mar 11 06:28:03 CST 2016


This should affect only 32-bit applications when the emulated
Windows version is set to "Windows 2003" or older.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
For bug 39878 https://bugs.winehq.org/show_bug.cgi?id=39878
---
 dlls/wined3d/directx.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 60fb5ac..1aea568 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -1510,6 +1510,18 @@ static void init_driver_info(struct wined3d_driver_info *driver_info,
         driver = DRIVER_UNKNOWN;
     }
 
+    /**
+     * Diablo 2 crashes when the amount of video memory is greater than 0x7fffffff.
+     * In order to avoid this application bug we limit the amount of video memory
+     * to LONG_MAX for older Windows versions.
+     */
+    if (os_version.dwMajorVersion <= 5 && os_version.dwMinorVersion <= 2
+            && driver_info->vram_bytes > LONG_MAX)
+    {
+        TRACE("Limiting amount of video memory to %#lx bytes for OS version older than Vista.\n", LONG_MAX);
+        driver_info->vram_bytes = LONG_MAX;
+    }
+
     if (wined3d_settings.emulated_textureram)
     {
         TRACE("Overriding amount of video memory with 0x%s bytes.\n",
-- 
2.4.10




More information about the wine-patches mailing list