Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libmupen64plus/D3D8Interceptor/d3d8Wrapper.h
2 views
1
#pragma once
2
3
#include <iostream>
4
#include <fstream>
5
#include "PointerSet.h"
6
7
#pragma comment(linker, "/EXPORT:Direct3DCreate8=_Direct3DCreate8@4")
8
9
//#define LOGGING 1
10
11
#ifdef LOGGING
12
#define LOG(x) { std::ofstream myfile; myfile.open ("d3d8_wrapper_log.txt", std::ios::app); myfile << x; myfile.close(); }
13
#else
14
#define LOG(x)
15
#endif
16
17
namespace D3D8Base
18
{
19
#include "d3d8base/d3d8.h"
20
}
21
extern "C"
22
{
23
namespace D3D8Wrapper
24
{
25
class IDirect3DUnknown
26
{
27
28
public:
29
IUnknown* m_pUnk;
30
ULONG m_ulRef;
31
32
public:
33
IDirect3DUnknown(IUnknown* pUnk)
34
{
35
m_pUnk = pUnk;
36
m_ulRef = 1;
37
}
38
39
/*** IUnknown methods ***/
40
STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj)
41
{
42
return E_FAIL;
43
}
44
45
STDMETHOD_(ULONG,AddRef)(THIS)
46
{
47
m_pUnk->AddRef();
48
return ++m_ulRef;
49
}
50
51
STDMETHOD_(ULONG,Release)(THIS)
52
{
53
m_pUnk->Release();
54
55
ULONG ulRef = --m_ulRef;
56
if( 0 == ulRef )
57
{
58
delete this;
59
return 0;
60
}
61
return ulRef;
62
}
63
};
64
65
class IDirect3D8;
66
class IDirect3DDevice8;
67
68
class IDirect3DResource8;
69
class IDirect3DBaseTexture8;
70
class IDirect3DTexture8;
71
class IDirect3DVolumeTexture8;
72
class IDirect3DCubeTexture8;
73
74
class IDirect3DVertexBuffer8;
75
class IDirect3DIndexBuffer8;
76
77
class IDirect3DSurface8;
78
class IDirect3DVolume8;
79
80
class IDirect3DSwapChain8;
81
82
class IDirect3D8 : public IDirect3DUnknown
83
{
84
protected:
85
D3D8Base::IDirect3D8* m_pD3D;
86
static ThreadSafePointerSet m_List;
87
public:
88
IDirect3D8(D3D8Base::IDirect3D8*);
89
90
inline D3D8Base::IDirect3D8* GetDirect3D8() { return m_pD3D; }
91
static IDirect3D8* GetDirect3D(D3D8Base::IDirect3D8* pD3D);
92
93
/*** IDirect3DUnknown methods ***/
94
STDMETHOD_(ULONG,Release)(THIS);
95
96
/*** IDirect3D8 methods ***/
97
STDMETHOD(RegisterSoftwareDevice)(THIS_ void* pInitializeFunction);
98
STDMETHOD_(UINT, GetAdapterCount)(THIS);
99
STDMETHOD(GetAdapterIdentifier)(THIS_ UINT Adapter,DWORD Flags,D3D8Base::D3DADAPTER_IDENTIFIER8* pIdentifier);
100
STDMETHOD_(UINT, GetAdapterModeCount)(THIS_ UINT Adapter);
101
STDMETHOD(EnumAdapterModes)(THIS_ UINT Adapter,UINT Mode,D3D8Base::D3DDISPLAYMODE* pMode);
102
STDMETHOD(GetAdapterDisplayMode)(THIS_ UINT Adapter,D3D8Base::D3DDISPLAYMODE* pMode);
103
STDMETHOD(CheckDeviceType)(THIS_ UINT Adapter,D3D8Base::D3DDEVTYPE CheckType,D3D8Base::D3DFORMAT DisplayFormat,D3D8Base::D3DFORMAT BackBufferFormat,BOOL Windowed);
104
STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter,D3D8Base::D3DDEVTYPE DeviceType,D3D8Base::D3DFORMAT AdapterFormat,DWORD Usage,D3D8Base::D3DRESOURCETYPE RType,D3D8Base::D3DFORMAT CheckFormat);
105
STDMETHOD(CheckDeviceMultiSampleType)(THIS_ UINT Adapter,D3D8Base::D3DDEVTYPE DeviceType,D3D8Base::D3DFORMAT SurfaceFormat,BOOL Windowed,D3D8Base::D3DMULTISAMPLE_TYPE MultiSampleType);
106
STDMETHOD(CheckDepthStencilMatch)(THIS_ UINT Adapter,D3D8Base::D3DDEVTYPE DeviceType,D3D8Base::D3DFORMAT AdapterFormat,D3D8Base::D3DFORMAT RenderTargetFormat,D3D8Base::D3DFORMAT DepthStencilFormat);
107
STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter,D3D8Base::D3DDEVTYPE DeviceType,D3D8Base::D3DCAPS8* pCaps);
108
STDMETHOD_(HMONITOR, GetAdapterMonitor)(THIS_ UINT Adapter);
109
STDMETHOD(CreateDevice)(THIS_ UINT Adapter,D3D8Base::D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3D8Base::D3DPRESENT_PARAMETERS* pPresentationParameters,D3D8Wrapper::IDirect3DDevice8** ppReturnedDeviceInterface);
110
};
111
112
class IDirect3DDevice8 : public IDirect3DUnknown
113
{
114
protected:
115
D3D8Base::IDirect3DDevice8* m_pDevice;
116
static ThreadSafePointerSet m_List;
117
public:
118
STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj)
119
{
120
121
return E_FAIL;
122
}
123
124
static IDirect3DDevice8* GetDirect3DDevice(D3D8Base::IDirect3DDevice8* pDevice);
125
__forceinline D3D8Base::IDirect3DDevice8* GetD3D8Device() { return m_pDevice; }
126
127
/*** IDirect3DUnknown methods ***/
128
STDMETHOD_(ULONG,Release)(THIS);
129
130
IDirect3DDevice8(D3D8Base::IDirect3DDevice8*);
131
132
/*** IDirect3DDevice8 methods ***/
133
STDMETHOD(TestCooperativeLevel)(THIS);
134
STDMETHOD_(UINT, GetAvailableTextureMem)(THIS);
135
STDMETHOD(ResourceManagerDiscardBytes)(THIS_ DWORD Bytes);
136
STDMETHOD(GetDirect3D)(THIS_ D3D8Wrapper::IDirect3D8** ppD3D8);
137
STDMETHOD(GetDeviceCaps)(THIS_ D3D8Base::D3DCAPS8* pCaps);
138
STDMETHOD(GetDisplayMode)(THIS_ D3D8Base::D3DDISPLAYMODE* pMode);
139
STDMETHOD(GetCreationParameters)(THIS_ D3D8Base::D3DDEVICE_CREATION_PARAMETERS *pParameters);
140
STDMETHOD(SetCursorProperties)(THIS_ UINT XHotSpot,UINT YHotSpot,D3D8Wrapper::IDirect3DSurface8* pCursorBitmap);
141
STDMETHOD_(void, SetCursorPosition)(THIS_ int X,int Y,DWORD Flags);
142
STDMETHOD_(BOOL, ShowCursor)(THIS_ BOOL bShow);
143
STDMETHOD(CreateAdditionalSwapChain)(THIS_ D3D8Base::D3DPRESENT_PARAMETERS* pPresentationParameters,D3D8Wrapper::IDirect3DSwapChain8** pSwapChain);
144
STDMETHOD(Reset)(THIS_ D3D8Base::D3DPRESENT_PARAMETERS* pPresentationParameters);
145
STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion);
146
STDMETHOD(GetBackBuffer)(THIS_ UINT BackBuffer,D3D8Base::D3DBACKBUFFER_TYPE Type,D3D8Wrapper::IDirect3DSurface8** ppBackBuffer);
147
STDMETHOD(GetRasterStatus)(THIS_ D3D8Base::D3DRASTER_STATUS* pRasterStatus);
148
STDMETHOD_(void, SetGammaRamp)(THIS_ DWORD Flags,CONST D3D8Base::D3DGAMMARAMP* pRamp);
149
STDMETHOD_(void, GetGammaRamp)(THIS_ D3D8Base::D3DGAMMARAMP* pRamp);
150
STDMETHOD(CreateTexture)(THIS_ UINT Width,UINT Height,UINT Levels,DWORD Usage,D3D8Base::D3DFORMAT Format,D3D8Base::D3DPOOL Pool,D3D8Wrapper::IDirect3DTexture8** ppTexture);
151
STDMETHOD(CreateVolumeTexture)(THIS_ UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3D8Base::D3DFORMAT Format,D3D8Base::D3DPOOL Pool,D3D8Wrapper::IDirect3DVolumeTexture8** ppVolumeTexture);
152
STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength,UINT Levels,DWORD Usage,D3D8Base::D3DFORMAT Format,D3D8Base::D3DPOOL Pool,D3D8Wrapper::IDirect3DCubeTexture8** ppCubeTexture);
153
STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3D8Base::D3DPOOL Pool,D3D8Wrapper::IDirect3DVertexBuffer8** ppVertexBuffer);
154
STDMETHOD(CreateIndexBuffer)(THIS_ UINT Length,DWORD Usage,D3D8Base::D3DFORMAT Format,D3D8Base::D3DPOOL Pool,D3D8Wrapper::IDirect3DIndexBuffer8** ppIndexBuffer);
155
STDMETHOD(CreateRenderTarget)(THIS_ UINT Width,UINT Height,D3D8Base::D3DFORMAT Format,D3D8Base::D3DMULTISAMPLE_TYPE MultiSample,BOOL Lockable,D3D8Wrapper::IDirect3DSurface8** ppSurface);
156
STDMETHOD(CreateDepthStencilSurface)(THIS_ UINT Width,UINT Height,D3D8Base::D3DFORMAT Format,D3D8Base::D3DMULTISAMPLE_TYPE MultiSample,D3D8Wrapper::IDirect3DSurface8** ppSurface);
157
STDMETHOD(CreateImageSurface)(THIS_ UINT Width,UINT Height,D3D8Base::D3DFORMAT Format,D3D8Wrapper::IDirect3DSurface8** ppSurface);
158
STDMETHOD(CopyRects)(THIS_ D3D8Wrapper::IDirect3DSurface8* pSourceSurface,CONST RECT* pSourceRectsArray,UINT cRects,D3D8Wrapper::IDirect3DSurface8* pDestinationSurface,CONST POINT* pDestPointsArray);
159
STDMETHOD(UpdateTexture)(THIS_ D3D8Wrapper::IDirect3DBaseTexture8* pSourceTexture,D3D8Wrapper::IDirect3DBaseTexture8* pDestinationTexture);
160
STDMETHOD(GetFrontBuffer)(THIS_ D3D8Wrapper::IDirect3DSurface8* pDestSurface);
161
STDMETHOD(SetRenderTarget)(THIS_ D3D8Wrapper::IDirect3DSurface8* pRenderTarget,D3D8Wrapper::IDirect3DSurface8* pNewZStencil);
162
STDMETHOD(GetRenderTarget)(THIS_ D3D8Wrapper::IDirect3DSurface8** ppRenderTarget);
163
STDMETHOD(GetDepthStencilSurface)(THIS_ D3D8Wrapper::IDirect3DSurface8** ppZStencilSurface);
164
STDMETHOD(BeginScene)(THIS);
165
STDMETHOD(EndScene)(THIS);
166
STDMETHOD(Clear)(THIS_ DWORD Count,CONST D3D8Base::D3DRECT* pRects,DWORD Flags,D3D8Base::D3DCOLOR Color,float Z,DWORD Stencil);
167
STDMETHOD(SetTransform)(THIS_ D3D8Base::D3DTRANSFORMSTATETYPE State,CONST D3D8Base::D3DMATRIX* pMatrix);
168
STDMETHOD(GetTransform)(THIS_ D3D8Base::D3DTRANSFORMSTATETYPE State,D3D8Base::D3DMATRIX* pMatrix);
169
STDMETHOD(MultiplyTransform)(THIS_ D3D8Base::D3DTRANSFORMSTATETYPE,CONST D3D8Base::D3DMATRIX*);
170
STDMETHOD(SetViewport)(THIS_ CONST D3D8Base::D3DVIEWPORT8* pViewport);
171
STDMETHOD(GetViewport)(THIS_ D3D8Base::D3DVIEWPORT8* pViewport);
172
STDMETHOD(SetMaterial)(THIS_ CONST D3D8Base::D3DMATERIAL8* pMaterial);
173
STDMETHOD(GetMaterial)(THIS_ D3D8Base::D3DMATERIAL8* pMaterial);
174
STDMETHOD(SetLight)(THIS_ DWORD Index,CONST D3D8Base::D3DLIGHT8*);
175
STDMETHOD(GetLight)(THIS_ DWORD Index,D3D8Base::D3DLIGHT8*);
176
STDMETHOD(LightEnable)(THIS_ DWORD Index,BOOL Enable);
177
STDMETHOD(GetLightEnable)(THIS_ DWORD Index,BOOL* pEnable);
178
STDMETHOD(SetClipPlane)(THIS_ DWORD Index,CONST float* pPlane);
179
STDMETHOD(GetClipPlane)(THIS_ DWORD Index,float* pPlane);
180
STDMETHOD(SetRenderState)(THIS_ D3D8Base::D3DRENDERSTATETYPE State,DWORD Value);
181
STDMETHOD(GetRenderState)(THIS_ D3D8Base::D3DRENDERSTATETYPE State,DWORD* pValue);
182
STDMETHOD(BeginStateBlock)(THIS);
183
STDMETHOD(EndStateBlock)(THIS_ DWORD* pToken);
184
STDMETHOD(ApplyStateBlock)(THIS_ DWORD Token);
185
STDMETHOD(CaptureStateBlock)(THIS_ DWORD Token);
186
STDMETHOD(DeleteStateBlock)(THIS_ DWORD Token);
187
STDMETHOD(CreateStateBlock)(THIS_ D3D8Base::D3DSTATEBLOCKTYPE Type,DWORD* pToken);
188
STDMETHOD(SetClipStatus)(THIS_ CONST D3D8Base::D3DCLIPSTATUS8* pClipStatus);
189
STDMETHOD(GetClipStatus)(THIS_ D3D8Base::D3DCLIPSTATUS8* pClipStatus);
190
STDMETHOD(GetTexture)(THIS_ DWORD Stage,D3D8Wrapper::IDirect3DBaseTexture8** ppTexture);
191
STDMETHOD(SetTexture)(THIS_ DWORD Stage,D3D8Wrapper::IDirect3DBaseTexture8* pTexture);
192
STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage,D3D8Base::D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue);
193
STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage,D3D8Base::D3DTEXTURESTAGESTATETYPE Type,DWORD Value);
194
STDMETHOD(ValidateDevice)(THIS_ DWORD* pNumPasses);
195
STDMETHOD(GetInfo)(THIS_ DWORD DevInfoID,void* pDevInfoStruct,DWORD DevInfoStructSize);
196
STDMETHOD(SetPaletteEntries)(THIS_ UINT PaletteNumber,CONST PALETTEENTRY* pEntries);
197
STDMETHOD(GetPaletteEntries)(THIS_ UINT PaletteNumber,PALETTEENTRY* pEntries);
198
STDMETHOD(SetCurrentTexturePalette)(THIS_ UINT PaletteNumber);
199
STDMETHOD(GetCurrentTexturePalette)(THIS_ UINT *PaletteNumber);
200
STDMETHOD(DrawPrimitive)(THIS_ D3D8Base::D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount);
201
STDMETHOD(DrawIndexedPrimitive)(THIS_ D3D8Base::D3DPRIMITIVETYPE,UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount);
202
STDMETHOD(DrawPrimitiveUP)(THIS_ D3D8Base::D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride);
203
STDMETHOD(DrawIndexedPrimitiveUP)(THIS_ D3D8Base::D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertexIndices,UINT PrimitiveCount,CONST void* pIndexData,D3D8Base::D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride);
204
STDMETHOD(ProcessVertices)(THIS_ UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,D3D8Wrapper::IDirect3DVertexBuffer8* pDestBuffer,DWORD Flags);
205
STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD* pDeclaration,CONST DWORD* pFunction,DWORD* pHandle,DWORD Usage);
206
STDMETHOD(SetVertexShader)(THIS_ DWORD Handle);
207
STDMETHOD(GetVertexShader)(THIS_ DWORD* pHandle);
208
STDMETHOD(DeleteVertexShader)(THIS_ DWORD Handle);
209
STDMETHOD(SetVertexShaderConstant)(THIS_ DWORD Register,CONST void* pConstantData,DWORD ConstantCount);
210
STDMETHOD(GetVertexShaderConstant)(THIS_ DWORD Register,void* pConstantData,DWORD ConstantCount);
211
STDMETHOD(GetVertexShaderDeclaration)(THIS_ DWORD Handle,void* pData,DWORD* pSizeOfData);
212
STDMETHOD(GetVertexShaderFunction)(THIS_ DWORD Handle,void* pData,DWORD* pSizeOfData);
213
STDMETHOD(SetStreamSource)(THIS_ UINT StreamNumber,D3D8Wrapper::IDirect3DVertexBuffer8* pStreamData,UINT Stride);
214
STDMETHOD(GetStreamSource)(THIS_ UINT StreamNumber,D3D8Wrapper::IDirect3DVertexBuffer8** ppStreamData,UINT* pStride);
215
STDMETHOD(SetIndices)(THIS_ D3D8Wrapper::IDirect3DIndexBuffer8* pIndexData,UINT BaseVertexIndex);
216
STDMETHOD(GetIndices)(THIS_ D3D8Wrapper::IDirect3DIndexBuffer8** ppIndexData,UINT* pBaseVertexIndex);
217
STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction,DWORD* pHandle);
218
STDMETHOD(SetPixelShader)(THIS_ DWORD Handle);
219
STDMETHOD(GetPixelShader)(THIS_ DWORD* pHandle);
220
STDMETHOD(DeletePixelShader)(THIS_ DWORD Handle);
221
STDMETHOD(SetPixelShaderConstant)(THIS_ DWORD Register,CONST void* pConstantData,DWORD ConstantCount);
222
STDMETHOD(GetPixelShaderConstant)(THIS_ DWORD Register,void* pConstantData,DWORD ConstantCount);
223
STDMETHOD(GetPixelShaderFunction)(THIS_ DWORD Handle,void* pData,DWORD* pSizeOfData);
224
STDMETHOD(DrawRectPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3D8Base::D3DRECTPATCH_INFO* pRectPatchInfo);
225
STDMETHOD(DrawTriPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3D8Base::D3DTRIPATCH_INFO* pTriPatchInfo);
226
STDMETHOD(DeletePatch)(THIS_ UINT Handle);
227
};
228
229
class IDirect3DSwapChain8 : public IDirect3DUnknown
230
{
231
protected:
232
D3D8Base::IDirect3DSwapChain8* m_pD3D;
233
static ThreadSafePointerSet m_List;
234
public:
235
/*** IUnknown methods ***/
236
STDMETHOD_(ULONG,Release)(THIS);
237
238
static IDirect3DSwapChain8* GetSwapChain(D3D8Base::IDirect3DSwapChain8* pSwapChain);
239
inline D3D8Base::IDirect3DSwapChain8* GetSwapChain8() { return m_pD3D; }
240
241
IDirect3DSwapChain8(D3D8Base::IDirect3DSwapChain8*);
242
243
STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion);
244
STDMETHOD(GetBackBuffer)(THIS_ UINT BackBuffer,D3D8Base::D3DBACKBUFFER_TYPE Type,D3D8Wrapper::IDirect3DSurface8** ppBackBuffer);
245
};
246
247
class IDirect3DResource8 : public IDirect3DUnknown
248
{
249
protected:
250
D3D8Base::IDirect3DResource8* m_pD3D;
251
static ThreadSafePointerSet m_List;
252
public:
253
/*** IUnknown methods ***/
254
STDMETHOD_(ULONG,Release)(THIS);
255
256
static IDirect3DResource8* GetResource(D3D8Base::IDirect3DResource8* pSwapChain);
257
inline D3D8Base::IDirect3DResource8* GetResource() { return m_pD3D; }
258
259
IDirect3DResource8(D3D8Base::IDirect3DResource8*);
260
261
STDMETHOD(GetDevice)(THIS_ D3D8Wrapper::IDirect3DDevice8** ppDevice);
262
STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags);
263
STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData);
264
STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid);
265
STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew);
266
STDMETHOD_(DWORD, GetPriority)(THIS);
267
STDMETHOD_(void, PreLoad)(THIS);
268
STDMETHOD_(D3D8Base::D3DRESOURCETYPE, GetType)(THIS);
269
};
270
271
272
273
class IDirect3DBaseTexture8 : public IDirect3DResource8
274
{
275
protected:
276
D3D8Base::IDirect3DBaseTexture8* m_pD3D;
277
static ThreadSafePointerSet m_List;
278
public:
279
280
IDirect3DBaseTexture8(D3D8Base::IDirect3DBaseTexture8*);
281
282
inline D3D8Base::IDirect3DBaseTexture8* GetBaseTexture() { return m_pD3D; }
283
284
STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew);
285
STDMETHOD_(DWORD, GetLOD)(THIS);
286
STDMETHOD_(DWORD, GetLevelCount)(THIS);
287
};
288
289
290
class IDirect3DTexture8 : public IDirect3DBaseTexture8
291
{
292
protected:
293
D3D8Base::IDirect3DTexture8* m_pD3D;
294
static ThreadSafePointerSet m_List;
295
public:
296
297
IDirect3DTexture8(D3D8Base::IDirect3DTexture8*);
298
299
static D3D8Wrapper::IDirect3DTexture8* GetTexture(D3D8Base::IDirect3DTexture8*);
300
301
STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3D8Base::D3DSURFACE_DESC *pDesc);
302
STDMETHOD(GetSurfaceLevel)(THIS_ UINT Level,D3D8Wrapper::IDirect3DSurface8** ppSurfaceLevel);
303
STDMETHOD(LockRect)(THIS_ UINT Level,D3D8Base::D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags);
304
STDMETHOD(UnlockRect)(THIS_ UINT Level);
305
STDMETHOD(AddDirtyRect)(THIS_ CONST RECT* pDirtyRect);
306
};
307
308
309
310
class IDirect3DVolumeTexture8 : public IDirect3DBaseTexture8
311
{
312
protected:
313
D3D8Base::IDirect3DVolumeTexture8* m_pD3D;
314
static ThreadSafePointerSet m_List;
315
public:
316
317
IDirect3DVolumeTexture8(D3D8Base::IDirect3DVolumeTexture8*);
318
319
STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3D8Base::D3DVOLUME_DESC *pDesc);
320
STDMETHOD(GetVolumeLevel)(THIS_ UINT Level,D3D8Wrapper::IDirect3DVolume8** ppVolumeLevel);
321
STDMETHOD(LockBox)(THIS_ UINT Level,D3D8Base::D3DLOCKED_BOX* pLockedVolume,CONST D3D8Base::D3DBOX* pBox,DWORD Flags);
322
STDMETHOD(UnlockBox)(THIS_ UINT Level);
323
STDMETHOD(AddDirtyBox)(THIS_ CONST D3D8Base::D3DBOX* pDirtyBox);
324
};
325
326
327
328
class IDirect3DCubeTexture8 : public IDirect3DBaseTexture8
329
{
330
protected:
331
D3D8Base::IDirect3DCubeTexture8* m_pD3D;
332
static ThreadSafePointerSet m_List;
333
public:
334
335
IDirect3DCubeTexture8(D3D8Base::IDirect3DCubeTexture8*);
336
337
STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3D8Base::D3DSURFACE_DESC *pDesc);
338
STDMETHOD(GetCubeMapSurface)(THIS_ D3D8Base::D3DCUBEMAP_FACES FaceType,UINT Level,D3D8Wrapper::IDirect3DSurface8** ppCubeMapSurface);
339
STDMETHOD(LockRect)(THIS_ D3D8Base::D3DCUBEMAP_FACES FaceType,UINT Level,D3D8Base::D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags);
340
STDMETHOD(UnlockRect)(THIS_ D3D8Base::D3DCUBEMAP_FACES FaceType,UINT Level);
341
STDMETHOD(AddDirtyRect)(THIS_ D3D8Base::D3DCUBEMAP_FACES FaceType,CONST RECT* pDirtyRect);
342
};
343
344
345
class IDirect3DVertexBuffer8 : public IDirect3DResource8
346
{
347
protected:
348
D3D8Base::IDirect3DVertexBuffer8* m_pD3D;
349
static ThreadSafePointerSet m_List;
350
public:
351
352
IDirect3DVertexBuffer8(D3D8Base::IDirect3DVertexBuffer8*);
353
354
inline D3D8Base::IDirect3DVertexBuffer8* GetVertexBuffer() { return m_pD3D; }
355
356
STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,BYTE** ppbData,DWORD Flags);
357
STDMETHOD(Unlock)(THIS);
358
STDMETHOD(GetDesc)(THIS_ D3D8Base::D3DVERTEXBUFFER_DESC *pDesc);
359
};
360
361
362
363
class IDirect3DIndexBuffer8 : public IDirect3DResource8
364
{
365
protected:
366
D3D8Base::IDirect3DIndexBuffer8* m_pD3D;
367
static ThreadSafePointerSet m_List;
368
public:
369
370
IDirect3DIndexBuffer8(D3D8Base::IDirect3DIndexBuffer8*);
371
372
inline D3D8Base::IDirect3DIndexBuffer8* GetIndexBuffer() { return m_pD3D; }
373
374
STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,BYTE** ppbData,DWORD Flags);
375
STDMETHOD(Unlock)(THIS);
376
STDMETHOD(GetDesc)(THIS_ D3D8Base::D3DINDEXBUFFER_DESC *pDesc);
377
};
378
379
380
381
382
class IDirect3DSurface8 : public IDirect3DUnknown
383
{
384
protected:
385
D3D8Base::IDirect3DSurface8* m_pD3D;
386
static ThreadSafePointerSet m_List;
387
public:
388
389
IDirect3DSurface8(D3D8Base::IDirect3DSurface8*);
390
static IDirect3DSurface8* GetSurface(D3D8Base::IDirect3DSurface8* pSurface);
391
inline D3D8Base::IDirect3DSurface8* GetSurface() { return m_pD3D; }
392
393
/*** IDirect3DUnknown methods ***/
394
STDMETHOD_(ULONG, Release)(THIS);
395
396
STDMETHOD(GetDevice)(THIS_ D3D8Wrapper::IDirect3DDevice8** ppDevice);
397
STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags);
398
STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData);
399
STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid);
400
STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer);
401
STDMETHOD(GetDesc)(THIS_ D3D8Base::D3DSURFACE_DESC *pDesc);
402
STDMETHOD(LockRect)(THIS_ D3D8Base::D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags);
403
STDMETHOD(UnlockRect)(THIS);
404
};
405
406
407
408
409
class IDirect3DVolume8 : public IDirect3DUnknown
410
{
411
protected:
412
D3D8Base::IDirect3DVolume8* m_pD3D;
413
static ThreadSafePointerSet m_List;
414
public:
415
416
IDirect3DVolume8(D3D8Base::IDirect3DVolume8*);
417
418
419
STDMETHOD(GetDevice)(THIS_ D3D8Wrapper::IDirect3DDevice8** ppDevice);
420
STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags);
421
STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData);
422
STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid);
423
STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer);
424
STDMETHOD(GetDesc)(THIS_ D3D8Base::D3DVOLUME_DESC *pDesc);
425
STDMETHOD(LockBox)(THIS_ D3D8Base::D3DLOCKED_BOX * pLockedVolume,CONST D3D8Base::D3DBOX* pBox,DWORD Flags);
426
STDMETHOD(UnlockBox)(THIS);
427
};
428
429
430
typedef D3D8Base::IDirect3D8* (WINAPI *D3DCREATE)(UINT);
431
IDirect3D8* WINAPI Direct3DCreate8(UINT Version);
432
extern IDirect3DDevice8 *last_device;
433
extern IDirect3DSurface8 *render_surface;
434
extern void (*rendering_callback)( int );
435
}
436
}
437