| Index: ddraw/glDirect3D.cpp |
| — | — | @@ -24,6 +24,7 @@ |
| 25 | 25 | #include "glDirect3DVertexBuffer.h"
|
| 26 | 26 | #include "glDirect3DViewport.h"
|
| 27 | 27 | #include "glDirect3DMaterial.h"
|
| | 28 | +#include "glDirect3DLight.h"
|
| 28 | 29 |
|
| 29 | 30 | D3DDEVICEDESC7 d3ddesc =
|
| 30 | 31 | {
|
| — | — | @@ -172,10 +173,12 @@ |
| 173 | 174 | refcount=1;
|
| 174 | 175 | this->glDD7 = glDD7;
|
| 175 | 176 | glDD7->AddRef();
|
| | 177 | + glD3D3 = NULL;
|
| 176 | 178 | }
|
| 177 | 179 |
|
| 178 | 180 | glDirect3D7::~glDirect3D7()
|
| 179 | 181 | {
|
| | 182 | + if(glD3D3) glD3D3->Release();
|
| 180 | 183 | glDD7->Release();
|
| 181 | 184 | }
|
| 182 | 185 |
|
| — | — | @@ -197,7 +200,7 @@ |
| 198 | 201 |
|
| 199 | 202 | HRESULT WINAPI glDirect3D7::QueryInterface(REFIID riid, void** ppvObj)
|
| 200 | 203 | {
|
| 201 | | - if(!this) return DDERR_INVALIDPARAMS;
|
| | 204 | + if(!this) return DDERR_INVALIDOBJECT;
|
| 202 | 205 | if(!ppvObj) return DDERR_INVALIDPARAMS;
|
| 203 | 206 | if(riid == IID_IUnknown)
|
| 204 | 207 | {
|
| — | — | @@ -207,9 +210,19 @@ |
| 208 | 211 | }
|
| 209 | 212 | if(riid == IID_IDirect3D3)
|
| 210 | 213 | {
|
| 211 | | - this->AddRef();
|
| 212 | | - *ppvObj = new glDirect3D3(this);
|
| 213 | | - return D3D_OK;
|
| | 214 | + if(glD3D3)
|
| | 215 | + {
|
| | 216 | + *ppvObj = glD3D3;
|
| | 217 | + glD3D3->AddRef();
|
| | 218 | + return D3D_OK;
|
| | 219 | + }
|
| | 220 | + else
|
| | 221 | + {
|
| | 222 | + this->AddRef();
|
| | 223 | + *ppvObj = new glDirect3D3(this);
|
| | 224 | + glD3D3 = (glDirect3D3*)*ppvObj;
|
| | 225 | + return D3D_OK;
|
| | 226 | + }
|
| 214 | 227 | }
|
| 215 | 228 | return E_NOINTERFACE;
|
| 216 | 229 | }
|
| — | — | @@ -225,9 +238,10 @@ |
| 226 | 239 | HRESULT WINAPI glDirect3D7::CreateLight(LPDIRECT3DLIGHT* lplpDirect3DLight, IUnknown* pUnkOuter)
|
| 227 | 240 | {
|
| 228 | 241 | if(!this) return DDERR_INVALIDPARAMS;
|
| | 242 | + if(!lplpDirect3DLight) return DDERR_INVALIDPARAMS;
|
| 229 | 243 | if(pUnkOuter) return DDERR_INVALIDPARAMS;
|
| 230 | | - FIXME("glDirect3D7::CreateLight: stub");
|
| 231 | | - return DDERR_GENERIC;
|
| | 244 | + *lplpDirect3DLight = new glDirect3DLight();
|
| | 245 | + return D3D_OK;
|
| 232 | 246 | }
|
| 233 | 247 | HRESULT WINAPI glDirect3D7::CreateMaterial(LPDIRECT3DMATERIAL3* lplpDirect3DMaterial, IUnknown* pUnkOuter)
|
| 234 | 248 | {
|
| Index: ddraw/glDirect3D.h |
| — | — | @@ -23,6 +23,7 @@ |
| 24 | 24 | extern D3DDEVICEDESC d3ddesc3;
|
| 25 | 25 | class glDirectDraw7;
|
| 26 | 26 |
|
| | 27 | +class glDirect3D3;
|
| 27 | 28 | class glDirect3D7 : public IDirect3D7
|
| 28 | 29 | {
|
| 29 | 30 | public:
|
| — | — | @@ -44,6 +45,7 @@ |
| 45 | 46 | glDirectDraw7 *glDD7;
|
| 46 | 47 | private:
|
| 47 | 48 | ULONG refcount;
|
| | 49 | + glDirect3D3 *glD3D3;
|
| 48 | 50 | };
|
| 49 | 51 |
|
| 50 | 52 | class glDirect3D3 : public IDirect3D3
|
| Index: ddraw/glDirect3DDevice.cpp |
| — | — | @@ -672,6 +672,7 @@ |
| 673 | 673 | {
|
| 674 | 674 | if(!this) return DDERR_INVALIDOBJECT;
|
| 675 | 675 | *lplpD3D = glD3D7;
|
| | 676 | + glD3D7->AddRef();
|
| 676 | 677 | return D3D_OK;
|
| 677 | 678 | }
|
| 678 | 679 | HRESULT WINAPI glDirect3DDevice7::GetInfo(DWORD dwDevInfoID, LPVOID pDevInfoStruct, DWORD dwSize)
|
| — | — | @@ -1801,7 +1802,10 @@ |
| 1802 | 1803 | HRESULT WINAPI glDirect3DDevice3::SetTexture(DWORD dwStage, LPDIRECT3DTEXTURE2 lpTexture)
|
| 1803 | 1804 | {
|
| 1804 | 1805 | if(!this) return DDERR_INVALIDOBJECT;
|
| 1805 | | - return glD3DDev7->SetTexture(dwStage,((glDirect3DTexture2*)lpTexture)->GetDDS7());
|
| | 1806 | + glDirectDrawSurface7 *dds7;
|
| | 1807 | + if(lpTexture) dds7 = ((glDirect3DTexture2*)lpTexture)->GetDDS7();
|
| | 1808 | + else dds7 = NULL;
|
| | 1809 | + return glD3DDev7->SetTexture(dwStage,dds7);
|
| 1806 | 1810 | }
|
| 1807 | 1811 |
|
| 1808 | 1812 | HRESULT WINAPI glDirect3DDevice3::SetTextureStageState(DWORD dwStage, D3DTEXTURESTAGESTATETYPE dwState, DWORD dwValue)
|
| Index: ddraw/glDirectDrawSurface.cpp |
| — | — | @@ -522,9 +522,19 @@ |
| 523 | 523 | }
|
| 524 | 524 | if(riid == IID_IDirect3DTexture2)
|
| 525 | 525 | {
|
| 526 | | - this->AddRef();
|
| 527 | | - *ppvObj = new glDirect3DTexture2(this);
|
| 528 | | - return DD_OK;
|
| | 526 | + if(d3dt2)
|
| | 527 | + {
|
| | 528 | + *ppvObj = d3dt2;
|
| | 529 | + d3dt2->AddRef();
|
| | 530 | + return DD_OK;
|
| | 531 | + }
|
| | 532 | + else
|
| | 533 | + {
|
| | 534 | + this->AddRef();
|
| | 535 | + *ppvObj = new glDirect3DTexture2(this);
|
| | 536 | + d3dt2 = (glDirect3DTexture2*)*ppvObj;
|
| | 537 | + return DD_OK;
|
| | 538 | + }
|
| 529 | 539 | }
|
| 530 | 540 | ERR(E_NOINTERFACE);
|
| 531 | 541 | }
|
| Index: ddraw/glDirectDrawSurface.h |
| — | — | @@ -32,6 +32,7 @@ |
| 33 | 33 | class glDirectDrawSurface2;
|
| 34 | 34 | class glDirectDrawSurface3;
|
| 35 | 35 | class glDirectDrawSurface4;
|
| | 36 | +class glDirect3DTexture2;
|
| 36 | 37 | class glDirectDrawSurface7 : public IDirectDrawSurface7
|
| 37 | 38 | {
|
| 38 | 39 | public:
|
| — | — | @@ -108,6 +109,7 @@ |
| 109 | 110 | glDirectDrawSurface2 *dds2;
|
| 110 | 111 | glDirectDrawSurface3 *dds3;
|
| 111 | 112 | glDirectDrawSurface4 *dds4;
|
| | 113 | + glDirect3DTexture2 *d3dt2;
|
| 112 | 114 | DWORD flipcount;
|
| 113 | 115 | GLenum texformat;
|
| 114 | 116 | GLenum texformat2;
|