| Index: ddraw/glDirect3DTexture.cpp |
| — | — | @@ -72,8 +72,6 @@ |
| 73 | 73 | HRESULT ret = glDDS7->GetHandle(glD3DDev7,lpHandle);
|
| 74 | 74 | glD3DDev7->Release();
|
| 75 | 75 | return ret;
|
| 76 | | - FIXME("glDirect3DTexture2::GetHandle: stub");
|
| 77 | | - return DDERR_GENERIC;
|
| 78 | 76 | }
|
| 79 | 77 | HRESULT WINAPI glDirect3DTexture2::Load(LPDIRECT3DTEXTURE2 lpD3DTexture2)
|
| 80 | 78 | {
|
| — | — | @@ -87,3 +85,72 @@ |
| 88 | 86 | FIXME("glDirect3DTexture2::PaletteChanged: stub");
|
| 89 | 87 | return DDERR_GENERIC;
|
| 90 | 88 | }
|
| | 89 | +
|
| | 90 | +glDirect3DTexture1::glDirect3DTexture1(glDirectDrawSurface7 *glDDS7)
|
| | 91 | +{
|
| | 92 | + glDDS7->Release();
|
| | 93 | +}
|
| | 94 | +glDirect3DTexture1::~glDirect3DTexture1()
|
| | 95 | +{
|
| | 96 | + glDDS7->Release();
|
| | 97 | +}
|
| | 98 | +HRESULT WINAPI glDirect3DTexture1::QueryInterface(REFIID riid, void** ppvObj)
|
| | 99 | +{
|
| | 100 | + if(!this) return DDERR_INVALIDPARAMS;
|
| | 101 | + if(riid == IID_IUnknown)
|
| | 102 | + {
|
| | 103 | + this->AddRef();
|
| | 104 | + *ppvObj = this;
|
| | 105 | + return DD_OK;
|
| | 106 | + }
|
| | 107 | + return glDDS7->QueryInterface(riid,ppvObj);
|
| | 108 | +}
|
| | 109 | +ULONG WINAPI glDirect3DTexture1::AddRef()
|
| | 110 | +{
|
| | 111 | + if(!this) return 0;
|
| | 112 | + refcount++;
|
| | 113 | + return refcount;
|
| | 114 | +}
|
| | 115 | +ULONG WINAPI glDirect3DTexture1::Release()
|
| | 116 | +{
|
| | 117 | + if(!this) return 0;
|
| | 118 | + ULONG ret;
|
| | 119 | + refcount--;
|
| | 120 | + ret = refcount;
|
| | 121 | + if(refcount == 0) delete this;
|
| | 122 | + return ret;
|
| | 123 | +}
|
| | 124 | +
|
| | 125 | +HRESULT WINAPI glDirect3DTexture1::GetHandle(LPDIRECT3DDEVICE lpDirect3DDevice, LPD3DTEXTUREHANDLE lpHandle)
|
| | 126 | +{
|
| | 127 | + if(!this) return DDERR_INVALIDOBJECT;
|
| | 128 | + if(!lpDirect3DDevice) return DDERR_INVALIDPARAMS;
|
| | 129 | + glDirect3DDevice7 *glD3DDev7;
|
| | 130 | + lpDirect3DDevice->QueryInterface(IID_IDirect3DDevice7,(void**)&glD3DDev7);
|
| | 131 | + HRESULT ret = glDDS7->GetHandle(glD3DDev7,lpHandle);
|
| | 132 | + glD3DDev7->Release();
|
| | 133 | + return ret;
|
| | 134 | +}
|
| | 135 | +HRESULT WINAPI glDirect3DTexture1::Initialize(LPDIRECT3DDEVICE lpD3DDevice, LPDIRECTDRAWSURFACE lpDDSurface)
|
| | 136 | +{
|
| | 137 | + if(!this) return DDERR_INVALIDOBJECT;
|
| | 138 | + return DDERR_ALREADYINITIALIZED;
|
| | 139 | +}
|
| | 140 | +HRESULT WINAPI glDirect3DTexture1::Load(LPDIRECT3DTEXTURE lpD3DTexture)
|
| | 141 | +{
|
| | 142 | + if(!this) return DDERR_INVALIDOBJECT;
|
| | 143 | + FIXME("glDirect3DTexture1::Load: stub");
|
| | 144 | + return DDERR_GENERIC;
|
| | 145 | +}
|
| | 146 | +HRESULT WINAPI glDirect3DTexture1::PaletteChanged(DWORD dwStart, DWORD dwCount)
|
| | 147 | +{
|
| | 148 | + if(!this) return DDERR_INVALIDOBJECT;
|
| | 149 | + FIXME("glDirect3DTexture1::PaletteChanged: stub");
|
| | 150 | + return DDERR_GENERIC;
|
| | 151 | +}
|
| | 152 | +HRESULT WINAPI glDirect3DTexture1::Unload()
|
| | 153 | +{
|
| | 154 | + if(!this) return DDERR_INVALIDOBJECT;
|
| | 155 | + FIXME("glDirect3DTexture1::Unload: stub");
|
| | 156 | + return DDERR_GENERIC;
|
| | 157 | +}
|
| Index: ddraw/glDirect3DTexture.h |
| — | — | @@ -36,4 +36,23 @@ |
| 37 | 37 | ULONG refcount;
|
| 38 | 38 | };
|
| 39 | 39 |
|
| | 40 | +class glDirect3DTexture1 : public IDirect3DTexture
|
| | 41 | +{
|
| | 42 | +public:
|
| | 43 | + glDirect3DTexture1(glDirectDrawSurface7 *glDDS7);
|
| | 44 | + virtual ~glDirect3DTexture1();
|
| | 45 | + HRESULT WINAPI QueryInterface(REFIID riid, void** ppvObj);
|
| | 46 | + ULONG WINAPI AddRef();
|
| | 47 | + ULONG WINAPI Release();
|
| | 48 | + HRESULT WINAPI GetHandle(LPDIRECT3DDEVICE lpDirect3DDevice, LPD3DTEXTUREHANDLE lpHandle);
|
| | 49 | + HRESULT WINAPI Initialize(LPDIRECT3DDEVICE lpD3DDevice, LPDIRECTDRAWSURFACE lpDDSurface);
|
| | 50 | + HRESULT WINAPI Load(LPDIRECT3DTEXTURE lpD3DTexture);
|
| | 51 | + HRESULT WINAPI PaletteChanged(DWORD dwStart, DWORD dwCount);
|
| | 52 | + HRESULT WINAPI Unload();
|
| | 53 | + glDirectDrawSurface7 *GetDDS7(){return glDDS7;}
|
| | 54 | +private:
|
| | 55 | + glDirectDrawSurface7 *glDDS7;
|
| | 56 | + ULONG refcount;
|
| | 57 | +};
|
| | 58 | +
|
| 40 | 59 | #endif //__GLDIRECT3DTEXTURE_H |
| \ No newline at end of file |
| Index: ddraw/glDirectDrawSurface.cpp |
| — | — | @@ -429,7 +429,23 @@ |
| 430 | 430 | return DD_OK;
|
| 431 | 431 | }
|
| 432 | 432 | }
|
| 433 | | - ERR(E_NOINTERFACE);
|
| | 433 | + if(riid == IID_IDirect3DTexture)
|
| | 434 | + {
|
| | 435 | + if(d3dt1)
|
| | 436 | + {
|
| | 437 | + *ppvObj = d3dt1;
|
| | 438 | + d3dt1->AddRef();
|
| | 439 | + return DD_OK;
|
| | 440 | + }
|
| | 441 | + else
|
| | 442 | + {
|
| | 443 | + this->AddRef();
|
| | 444 | + *ppvObj = new glDirect3DTexture1(this);
|
| | 445 | + d3dt1 = (glDirect3DTexture1*)*ppvObj;
|
| | 446 | + return DD_OK;
|
| | 447 | + }
|
| | 448 | + }
|
| | 449 | + return E_NOINTERFACE;
|
| 434 | 450 | }
|
| 435 | 451 | ULONG WINAPI glDirectDrawSurface7::AddRef()
|
| 436 | 452 | {
|
| Index: ddraw/glDirectDrawSurface.h |
| — | — | @@ -33,6 +33,7 @@ |
| 34 | 34 | class glDirectDrawSurface3;
|
| 35 | 35 | class glDirectDrawSurface4;
|
| 36 | 36 | class glDirect3DTexture2;
|
| | 37 | +class glDirect3DTexture1;
|
| 37 | 38 | class glDirect3DDevice7;
|
| 38 | 39 | class glDirectDrawSurface7 : public IDirectDrawSurface7
|
| 39 | 40 | {
|
| — | — | @@ -112,6 +113,7 @@ |
| 113 | 114 | glDirectDrawSurface3 *dds3;
|
| 114 | 115 | glDirectDrawSurface4 *dds4;
|
| 115 | 116 | glDirect3DTexture2 *d3dt2;
|
| | 117 | + glDirect3DTexture1 *d3dt1;
|
| 116 | 118 | DWORD flipcount;
|
| 117 | 119 | DWORD fakex,fakey;
|
| 118 | 120 | DWORD dirty;
|