DXGL r317 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r316‎ | r317 | r318 >
Date:23:33, 6 February 2013
Author:admin
Status:new
Tags:
Comment:
Add code to create IDirect3D and IDirect3DDevice objects.
Modified paths:
  • /ddraw/glDirect3D.cpp (modified) (history)
  • /ddraw/glDirect3DDevice.cpp (modified) (history)
  • /ddraw/glDirect3DDevice.h (modified) (history)
  • /ddraw/glDirectDraw.cpp (modified) (history)
  • /ddraw/glDirectDrawSurface.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirect3D.cpp
@@ -289,7 +289,7 @@
290290 {
291291 if(!this) return DDERR_INVALIDPARAMS;
292292 HRESULT ret;
293 - glDirect3DDevice7 *glD3DDev7 = new glDirect3DDevice7(this,(glDirectDrawSurface7*)lpDDS);
 293+ glDirect3DDevice7 *glD3DDev7 = new glDirect3DDevice7(rclsid,this,(glDirectDrawSurface7*)lpDDS);
294294 if(!glD3DDev7) return DDERR_OUTOFMEMORY;
295295 if(FAILED(glD3DDev7->err()))
296296 {
Index: ddraw/glDirect3DDevice.cpp
@@ -246,7 +246,7 @@
247247 }
248248
249249
250 -glDirect3DDevice7::glDirect3DDevice7(glDirect3D7 *glD3D7, glDirectDrawSurface7 *glDDS7)
 250+glDirect3DDevice7::glDirect3DDevice7(REFCLSID rclsid, glDirect3D7 *glD3D7, glDirectDrawSurface7 *glDDS7)
251251 {
252252 int zbuffer = 0;
253253 glD3DDev3 = NULL;
@@ -1918,6 +1918,7 @@
19191919 if(!lpDirect3DViewport) return DDERR_INVALIDPARAMS;
19201920 if(!lpRect) return DDERR_INVALIDPARAMS;
19211921 FIXME("glDirect3DDevice1::Pick: stub");
 1922+ ERR(DDERR_GENERIC);
19221923 }
19231924
19241925 // IDirect3DDevice3 wrapper
Index: ddraw/glDirect3DDevice.h
@@ -70,7 +70,7 @@
7171 class glDirect3DDevice7 : public IDirect3DDevice7
7272 {
7373 public:
74 - glDirect3DDevice7(glDirect3D7 *glD3D7, glDirectDrawSurface7 *glDDS7);
 74+ glDirect3DDevice7(REFCLSID rclsid, glDirect3D7 *glD3D7, glDirectDrawSurface7 *glDDS7);
7575 virtual ~glDirect3DDevice7();
7676 HRESULT WINAPI QueryInterface(REFIID riid, void** ppvObj);
7777 ULONG WINAPI AddRef();
Index: ddraw/glDirectDraw.cpp
@@ -673,8 +673,10 @@
674674 }
675675 if(riid == IID_IDirect3D)
676676 {
677 - FIXME("Add IDirect3D Interfaces\n");
678 - ERR(DDERR_GENERIC);
 677+ glDirect3D7 *tmp = new glDirect3D7(this);
 678+ tmp->QueryInterface(IID_IDirect3D,ppvObj);
 679+ tmp->Release();
 680+ return DD_OK;
679681 }
680682 if(riid == IID_IDirect3D2)
681683 {
Index: ddraw/glDirectDrawSurface.cpp
@@ -21,6 +21,7 @@
2222 #include "ddraw.h"
2323 #include "texture.h"
2424 #include "glRenderer.h"
 25+#include "glDirect3D.h"
2526 #include "glDirect3DDevice.h"
2627 #include "glDirectDraw.h"
2728 #include "glDirectDrawSurface.h"
@@ -446,6 +447,32 @@
447448 return DD_OK;
448449 }
449450 }
 451+ if((riid == IID_IDirect3DDevice) || (riid == IID_IDirect3DHALDevice) || (riid == IID_IDirect3DRGBDevice) ||
 452+ (riid == IID_IDirect3DRampDevice) || (riid == IID_IDirect3DRefDevice))
 453+ {
 454+
 455+ if(!device)
 456+ {
 457+ glDirect3D7 *tmpd3d;
 458+ glDirect3DDevice7 *tmpdev;
 459+ ddInterface->QueryInterface(IID_IDirect3D7,(void**)&tmpd3d);
 460+ if(!tmpd3d) return E_NOINTERFACE;
 461+ tmpd3d->CreateDevice(riid,this,(LPDIRECT3DDEVICE7*)&tmpdev);
 462+ if(!tmpdev)
 463+ {
 464+ tmpdev->Release();
 465+ return E_NOINTERFACE;
 466+ }
 467+ HRESULT ret = tmpdev->QueryInterface(IID_IDirect3DDevice,ppvObj);
 468+ tmpdev->Release();
 469+ tmpd3d->Release();
 470+ return ret;
 471+ }
 472+ else
 473+ {
 474+ return device->QueryInterface(IID_IDirect3DDevice,ppvObj);
 475+ }
 476+ }
450477 return E_NOINTERFACE;
451478 }
452479 ULONG WINAPI glDirectDrawSurface7::AddRef()