Skip to content

Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit

1.9 KB
Raw Blame
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index d843cf2d..7ce440e3 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -921,10 +921,37 @@ bool wined3d_driver_info_init(struct wined3d_driver_info *driver_info,
     if ((version_info = get_driver_version_info(driver, driver_model))
             || (version_info = get_driver_version_info(driver, DRIVER_MODEL_GENERIC)))
     {
+        char override[32];
+        unsigned int part[4] = {0}, count = 0;
+        DWORD len;
+
         driver_info->name = version_info->driver_name;
         driver_info->version_high = MAKEDWORD_VERSION(driver_os_version, driver_feature_level);
         driver_info->version_low = MAKEDWORD_VERSION(version_info->subversion, version_info->build);
 
+        /* NotProton: NOTPROTON_DRIVER_VERSION ("32.0.15.9541") replaces the version the table
+         * above gives, which for a current NVIDIA GPU is the GeForce 8 era 31.0.13.4052 (340.52).
+         * Games behind the NVIDIA identity D3DMetal is given read it through d3d9 (Source 2:
+         * Deadlock warns of an old driver and turns off asynchronous shader creation). */
+        len = GetEnvironmentVariableA("NOTPROTON_DRIVER_VERSION", override, sizeof(override));
+        if (len && len < sizeof(override))
+        {
+            const char *c = override;
+            while (count < 4)
+            {
+                if (*c < '0' || *c > '9') break;
+                while (*c >= '0' && *c <= '9') part[count] = part[count] * 10 + (*c++ - '0');
+                count++;
+                if (*c != '.') break;
+                c++;
+            }
+            if (count == 4 && !*c && part[0] < 0x10000 && part[1] < 0x10000 && part[2] < 0x10000 && part[3] < 0x10000)
+            {
+                driver_info->version_high = MAKEDWORD_VERSION(part[0], part[1]);
+                driver_info->version_low = MAKEDWORD_VERSION(part[2], part[3]);
+            }
+        }
+
         return true;
     }