Stefan Dösinger : ddraw: Enumerate the reference d3ddevice.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jun 26 07:12:05 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 546a60ff2f26899d4bfcfead49afdb21987b4528
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=546a60ff2f26899d4bfcfead49afdb21987b4528
Author: Stefan Dösinger <stefandoesinger at gmx.at>
Date: Sat Jun 24 16:17:10 2006 +0200
ddraw: Enumerate the reference d3ddevice.
---
dlls/ddraw/ddraw.c | 4 ++++
dlls/ddraw/ddraw_private.h | 3 ++-
dlls/ddraw/direct3d.c | 26 +++++++++++++++++++++++---
3 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 5fad1cd..ca0258e 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -159,21 +159,25 @@ IDirectDrawImpl_QueryInterface(IDirectDr
if ( IsEqualGUID( &IID_IDirect3D , refiid ) )
{
+ This->d3dversion = 1;
*obj = ICOM_INTERFACE(This, IDirect3D);
TRACE(" returning Direct3D interface at %p.\n", *obj);
}
else if ( IsEqualGUID( &IID_IDirect3D2 , refiid ) )
{
+ This->d3dversion = 2;
*obj = ICOM_INTERFACE(This, IDirect3D2);
TRACE(" returning Direct3D2 interface at %p.\n", *obj);
}
else if ( IsEqualGUID( &IID_IDirect3D3 , refiid ) )
{
+ This->d3dversion = 3;
*obj = ICOM_INTERFACE(This, IDirect3D3);
TRACE(" returning Direct3D3 interface at %p.\n", *obj);
}
else if(IsEqualGUID( &IID_IDirect3D7 , refiid ))
{
+ This->d3dversion = 7;
*obj = ICOM_INTERFACE(This, IDirect3D7);
TRACE(" returning Direct3D7 interface at %p.\n", *obj);
}
diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h
index 905e42f..8994c29 100644
--- a/dlls/ddraw/ddraw_private.h
+++ b/dlls/ddraw/ddraw_private.h
@@ -119,13 +119,14 @@ struct IDirectDrawImpl
IDirectDrawSurfaceImpl *d3d_target;
HWND d3d_window;
IDirect3DDeviceImpl *d3ddevice;
+ int d3dversion;
/* Varios HWNDs */
HWND focuswindow;
HWND devicewindow;
/* The surface type to request */
- WINED3DSURFTYPE ImplType;
+ WINED3DSURFTYPE ImplType;
/* The surface list - can't relay this to WineD3D
* because of IParent
diff --git a/dlls/ddraw/direct3d.c b/dlls/ddraw/direct3d.c
index 23efef9..e0b6dcb 100644
--- a/dlls/ddraw/direct3d.c
+++ b/dlls/ddraw/direct3d.c
@@ -276,7 +276,7 @@ IDirect3DImpl_3_EnumDevices(IDirect3D3 *
hr = IDirect3DImpl_GetCaps(This->wineD3D, &dref, &newDesc);
if(hr != D3D_OK) return hr;
- /* Do I have to enumerate the reference id? I try without. Note from old d3d7:
+ /* Do I have to enumerate the reference id? Note from old d3d7:
* "It seems that enumerating the reference IID on Direct3D 1 games
* (AvP / Motoracer2) breaks them". So do not enumerate this iid in V1
*
@@ -284,14 +284,34 @@ IDirect3DImpl_3_EnumDevices(IDirect3D3 *
* which enables / disables enumerating the reference rasterizer. It's a DWORD,
* 0 means disabled, 2 means enabled. The enablerefrast.reg and disablerefrast.reg
* files in the DirectX 7.0 sdk demo directory suggest this.
+ *
+ * Some games(GTA 2) seem to use the secound enumerated device, so I have to enumerate
+ * at least 2 devices. So enumerate the reference device to have 2 devices.
*/
+ if(This->d3dversion != 1)
+ {
+ TRACE("(%p) Enumerating WineD3D D3DDevice interface\n", This);
+ d1 = dref;
+ d2 = dref;
+ hr = Callback( (LPIID) &IID_IDirect3DRefDevice, "Reference Direct3D ID", device_name, &d1, &d2, Context);
+ if(hr != D3DENUMRET_OK)
+ {
+ TRACE("Application cancelled the enumeration\n");
+ return D3D_OK;
+ }
+ }
+
TRACE("(%p) Enumerating WineD3D D3DDevice interface\n", This);
d1 = dref;
d2 = dref;
- Callback( (LPIID) &IID_D3DDEVICE_WineD3D, "Wine D3DDevice using WineD3D and OpenGL", device_name, &d1, &d2, Context);
+ hr = Callback( (LPIID) &IID_D3DDEVICE_WineD3D, "Wine D3DDevice using WineD3D and OpenGL", device_name, &d1, &d2, Context);
+ if(hr != D3DENUMRET_OK)
+ {
+ TRACE("Application cancelled the enumeration\n");
+ return D3D_OK;
+ }
TRACE("(%p) End of enumeration\n", This);
- if(hr != D3DENUMRET_OK) return D3D_OK;
return D3D_OK;
}
More information about the wine-cvs
mailing list