[D3D] Small devices enumeration fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Motoracer 2 modifies the device name string passed as argument to its callback.
Let's put the string into the stack to prevent the game from crashing.
Also disable reference device enumeration since some apps don't like it.


Bye.

Changelog :
Put the device name string in the stack during devices enumeration.
Disable reference enumeration.

Christian Costa titan.costa@wanadoo.fr

Index: mesa.c
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/d3ddevice/mesa.c,v
retrieving revision 1.93
diff -u -r1.93 mesa.c
--- mesa.c	8 May 2003 21:03:57 -0000	1.93
+++ mesa.c	9 May 2003 05:08:53 -0000
@@ -282,20 +282,27 @@
 {
     D3DDEVICEDESC dref, d1, d2;
     HRESULT ret_value;
-    
+
+    /* Some games (Motoracer 2 demo) have the bad idea to modify the device name string.
+       Let's put the string in a sufficiently sized array in writable memory. */
+    char device_name[50];
+    strcpy(device_name,"direct3d");
+
     fill_opengl_caps(&dref);
 
+#if 0 /* FIXME: Reference device enumeration should be enable/disable in the configuration file */
     TRACE(" enumerating OpenGL D3DDevice interface using reference IID (IID %s).\n", debugstr_guid(&IID_IDirect3DRefDevice));
     d1 = dref;
     d2 = dref;
-    ret_value = cb((LPIID) &IID_IDirect3DRefDevice, "WINE Reference Direct3DX using OpenGL", "direct3d", &d1, &d2, context);
+    ret_value = cb((LPIID) &IID_IDirect3DRefDevice, "WINE Reference Direct3DX using OpenGL", device_name, &d1, &d2, context);
     if (ret_value != D3DENUMRET_OK)
         return ret_value;
-
+#endif
+    
     TRACE(" enumerating OpenGL D3DDevice interface (IID %s).\n", debugstr_guid(&IID_D3DDEVICE_OpenGL));
     d1 = dref;
     d2 = dref;
-    ret_value = cb((LPIID) &IID_D3DDEVICE_OpenGL, "WINE Direct3DX using OpenGL", "direct3d", &d1, &d2, context);
+    ret_value = cb((LPIID) &IID_D3DDEVICE_OpenGL, "WINE Direct3DX using OpenGL", device_name, &d1, &d2, context);
     if (ret_value != D3DENUMRET_OK)
         return ret_value;
 

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux