From 4ea958998182c58fa6a0ae24ef48c92ce242dcba Mon Sep 17 00:00:00 2001 From: Christian Costa Date: Sun, 11 May 2003 03:28:33 +0000 Subject: [PATCH] Put the device name string on the stack during devices enumeration. Disable reference enumeration. --- dlls/ddraw/d3ddevice/mesa.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/dlls/ddraw/d3ddevice/mesa.c b/dlls/ddraw/d3ddevice/mesa.c index 743215c405..db6461749d 100644 --- a/dlls/ddraw/d3ddevice/mesa.c +++ b/dlls/ddraw/d3ddevice/mesa.c @@ -282,20 +282,27 @@ HRESULT d3ddevice_enumerate(LPD3DENUMDEVICESCALLBACK cb, LPVOID context) { 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;