forked from Hal47/dsfix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
d3d9dev.h
215 lines (210 loc) · 10.8 KB
/
d3d9dev.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#pragma once
#include <d3d9.h>
#include <wrl/client.h>
#include "d3d9int.h"
class RSManager;
class Ui;
interface hkIDirect3DDevice9 : public IDirect3DDevice9 {
private:
// callback interface
Microsoft::WRL::ComPtr<IDirect3DDevice9> m_pDevice;
Microsoft::WRL::ComPtr<IDirect3D9> m_pD3D9;
RSManager* m_pRSManager;
Ui* m_pUi;
public:
// original interface
STDMETHOD(QueryInterface)(REFIID riid, void** ppvObj);
STDMETHOD_(ULONG, AddRef)();
STDMETHOD_(ULONG, Release)();
STDMETHOD(TestCooperativeLevel)();
STDMETHOD_(UINT, GetAvailableTextureMem)();
STDMETHOD(EvictManagedResources)();
STDMETHOD(GetDirect3D)(IDirect3D9** ppD3D9);
STDMETHOD(GetDeviceCaps)(D3DCAPS9* pCaps);
STDMETHOD(GetDisplayMode)(UINT iSwapChain, D3DDISPLAYMODE* pMode);
STDMETHOD(GetCreationParameters)(D3DDEVICE_CREATION_PARAMETERS* pParameters);
STDMETHOD(SetCursorProperties)
(UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9* pCursorBitmap);
STDMETHOD_(void, SetCursorPosition)(int X, int Y, DWORD Flags);
STDMETHOD_(BOOL, ShowCursor)(BOOL bShow);
STDMETHOD(CreateAdditionalSwapChain)
(D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain);
STDMETHOD(GetSwapChain)(UINT iSwapChain, IDirect3DSwapChain9** pSwapChain);
STDMETHOD_(UINT, GetNumberOfSwapChains)();
STDMETHOD(Reset)(D3DPRESENT_PARAMETERS* pPresentationParameters);
STDMETHOD(Present)
(CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride,
CONST RGNDATA* pDirtyRegion);
STDMETHOD(GetBackBuffer)
(UINT iSwapChain, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer);
STDMETHOD(GetRasterStatus)(UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus);
STDMETHOD(SetDialogBoxMode)(BOOL bEnableDialogs);
STDMETHOD_(void, SetGammaRamp)
(UINT iSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp);
STDMETHOD_(void, GetGammaRamp)(UINT iSwapChain, D3DGAMMARAMP* pRamp);
STDMETHOD(CreateTexture)
(UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool,
IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle);
STDMETHOD(CreateVolumeTexture)
(UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool,
IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle);
STDMETHOD(CreateCubeTexture)
(UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool,
IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle);
STDMETHOD(CreateVertexBuffer)
(UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer9** ppVertexBuffer,
HANDLE* pSharedHandle);
STDMETHOD(CreateIndexBuffer)
(UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer9** ppIndexBuffer,
HANDLE* pSharedHandle);
STDMETHOD(CreateRenderTarget)
(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample,
DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle);
STDMETHOD(CreateDepthStencilSurface)
(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample,
DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle);
STDMETHOD(UpdateSurface)
(IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect,
IDirect3DSurface9* pDestinationSurface, CONST POINT* pDestPoint);
STDMETHOD(UpdateTexture)
(IDirect3DBaseTexture9* pSourceTexture, IDirect3DBaseTexture9* pDestinationTexture);
STDMETHOD(GetRenderTargetData)
(IDirect3DSurface9* pRenderTarget, IDirect3DSurface9* pDestSurface);
STDMETHOD(GetFrontBufferData)
(UINT iSwapChain, IDirect3DSurface9* pDestSurface);
STDMETHOD(StretchRect)
(IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestSurface,
CONST RECT* pDestRect, D3DTEXTUREFILTERTYPE Filter);
STDMETHOD(ColorFill)
(IDirect3DSurface9* pSurface, CONST RECT* pRect, D3DCOLOR color);
STDMETHOD(CreateOffscreenPlainSurface)
(UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9** ppSurface,
HANDLE* pSharedHandle);
STDMETHOD(SetRenderTarget)
(DWORD RenderTargetIndex, IDirect3DSurface9* pRenderTarget);
STDMETHOD(GetRenderTarget)
(DWORD RenderTargetIndex, IDirect3DSurface9** ppRenderTarget);
STDMETHOD(SetDepthStencilSurface)(IDirect3DSurface9* pNewZStencil);
STDMETHOD(GetDepthStencilSurface)(IDirect3DSurface9** ppZStencilSurface);
STDMETHOD(BeginScene)();
STDMETHOD(EndScene)();
STDMETHOD(Clear)
(DWORD Count, CONST D3DRECT* pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil);
STDMETHOD(SetTransform)
(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix);
STDMETHOD(GetTransform)(D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix);
STDMETHOD(MultiplyTransform)(D3DTRANSFORMSTATETYPE, CONST D3DMATRIX*);
STDMETHOD(SetViewport)(CONST D3DVIEWPORT9* pViewport);
STDMETHOD(GetViewport)(D3DVIEWPORT9* pViewport);
STDMETHOD(SetMaterial)(CONST D3DMATERIAL9* pMaterial);
STDMETHOD(GetMaterial)(D3DMATERIAL9* pMaterial);
STDMETHOD(SetLight)(DWORD Index, CONST D3DLIGHT9*);
STDMETHOD(GetLight)(DWORD Index, D3DLIGHT9*);
STDMETHOD(LightEnable)(DWORD Index, BOOL Enable);
STDMETHOD(GetLightEnable)(DWORD Index, BOOL* pEnable);
STDMETHOD(SetClipPlane)(DWORD Index, CONST float* pPlane);
STDMETHOD(GetClipPlane)(DWORD Index, float* pPlane);
STDMETHOD(SetRenderState)(D3DRENDERSTATETYPE State, DWORD Value);
STDMETHOD(GetRenderState)(D3DRENDERSTATETYPE State, DWORD* pValue);
STDMETHOD(CreateStateBlock)
(D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9** ppSB);
STDMETHOD(BeginStateBlock)();
STDMETHOD(EndStateBlock)(IDirect3DStateBlock9** ppSB);
STDMETHOD(SetClipStatus)(CONST D3DCLIPSTATUS9* pClipStatus);
STDMETHOD(GetClipStatus)(D3DCLIPSTATUS9* pClipStatus);
STDMETHOD(GetTexture)(DWORD Stage, IDirect3DBaseTexture9** ppTexture);
STDMETHOD(SetTexture)(DWORD Stage, IDirect3DBaseTexture9* pTexture);
STDMETHOD(GetTextureStageState)
(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD* pValue);
STDMETHOD(SetTextureStageState)
(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value);
STDMETHOD(GetSamplerState)
(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD* pValue);
STDMETHOD(SetSamplerState)
(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value);
STDMETHOD(ValidateDevice)(DWORD* pNumPasses);
STDMETHOD(SetPaletteEntries)
(UINT PaletteNumber, CONST PALETTEENTRY* pEntries);
STDMETHOD(GetPaletteEntries)(UINT PaletteNumber, PALETTEENTRY* pEntries);
STDMETHOD(SetCurrentTexturePalette)(UINT PaletteNumber);
STDMETHOD(GetCurrentTexturePalette)(UINT* PaletteNumber);
STDMETHOD(SetScissorRect)(CONST RECT* pRect);
STDMETHOD(GetScissorRect)(RECT* pRect);
STDMETHOD(SetSoftwareVertexProcessing)(BOOL bSoftware);
STDMETHOD_(BOOL, GetSoftwareVertexProcessing)();
STDMETHOD(SetNPatchMode)(float nSegments);
STDMETHOD_(float, GetNPatchMode)();
STDMETHOD(DrawPrimitive)
(D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount);
STDMETHOD(DrawIndexedPrimitive)
(D3DPRIMITIVETYPE, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex,
UINT primCount);
STDMETHOD(DrawPrimitiveUP)
(D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void* pVertexStreamZeroData,
UINT VertexStreamZeroStride);
STDMETHOD(DrawIndexedPrimitiveUP)
(D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertices, UINT PrimitiveCount,
CONST void* pIndexData, D3DFORMAT IndexDataFormat, CONST void* pVertexStreamZeroData,
UINT VertexStreamZeroStride);
STDMETHOD(ProcessVertices)
(UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9* pDestBuffer,
IDirect3DVertexDeclaration9* pVertexDecl, DWORD Flags);
STDMETHOD(CreateVertexDeclaration)
(CONST D3DVERTEXELEMENT9* pVertexElements, IDirect3DVertexDeclaration9** ppDecl);
STDMETHOD(SetVertexDeclaration)(IDirect3DVertexDeclaration9* pDecl);
STDMETHOD(GetVertexDeclaration)(IDirect3DVertexDeclaration9** ppDecl);
STDMETHOD(SetFVF)(DWORD FVF);
STDMETHOD(GetFVF)(DWORD* pFVF);
STDMETHOD(CreateVertexShader)
(CONST DWORD* pFunction, IDirect3DVertexShader9** ppShader);
STDMETHOD(SetVertexShader)(IDirect3DVertexShader9* pShader);
STDMETHOD(GetVertexShader)(IDirect3DVertexShader9** ppShader);
STDMETHOD(SetVertexShaderConstantF)
(UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount);
STDMETHOD(GetVertexShaderConstantF)
(UINT StartRegister, float* pConstantData, UINT Vector4fCount);
STDMETHOD(SetVertexShaderConstantI)
(UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount);
STDMETHOD(GetVertexShaderConstantI)
(UINT StartRegister, int* pConstantData, UINT Vector4iCount);
STDMETHOD(SetVertexShaderConstantB)
(UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount);
STDMETHOD(GetVertexShaderConstantB)
(UINT StartRegister, BOOL* pConstantData, UINT BoolCount);
STDMETHOD(SetStreamSource)
(UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride);
STDMETHOD(GetStreamSource)
(UINT StreamNumber, IDirect3DVertexBuffer9** ppStreamData, UINT* pOffsetInBytes, UINT* pStride);
STDMETHOD(SetStreamSourceFreq)(UINT StreamNumber, UINT Setting);
STDMETHOD(GetStreamSourceFreq)(UINT StreamNumber, UINT* pSetting);
STDMETHOD(SetIndices)(IDirect3DIndexBuffer9* pIndexData);
STDMETHOD(GetIndices)(IDirect3DIndexBuffer9** ppIndexData);
STDMETHOD(CreatePixelShader)
(CONST DWORD* pFunction, IDirect3DPixelShader9** ppShader);
STDMETHOD(SetPixelShader)(IDirect3DPixelShader9* pShader);
STDMETHOD(GetPixelShader)(IDirect3DPixelShader9** ppShader);
STDMETHOD(SetPixelShaderConstantF)
(UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount);
STDMETHOD(GetPixelShaderConstantF)
(UINT StartRegister, float* pConstantData, UINT Vector4fCount);
STDMETHOD(SetPixelShaderConstantI)
(UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount);
STDMETHOD(GetPixelShaderConstantI)
(UINT StartRegister, int* pConstantData, UINT Vector4iCount);
STDMETHOD(SetPixelShaderConstantB)
(UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount);
STDMETHOD(GetPixelShaderConstantB)
(UINT StartRegister, BOOL* pConstantData, UINT BoolCount);
STDMETHOD(DrawRectPatch)
(UINT Handle, CONST float* pNumSegs, CONST D3DRECTPATCH_INFO* pRectPatchInfo);
STDMETHOD(DrawTriPatch)
(UINT Handle, CONST float* pNumSegs, CONST D3DTRIPATCH_INFO* pTriPatchInfo);
STDMETHOD(DeletePatch)(UINT Handle);
STDMETHOD(CreateQuery)(D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery);
hkIDirect3DDevice9(IDirect3DDevice9* pDevice, IDirect3D9* pD3D9);
IDirect3DDevice9* getDevice();
void setRSManager(RSManager* pRSManager);
float getOcclusionScale();
void setUi(Ui* pUi);
virtual ~hkIDirect3DDevice9() = default;
};