-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathFakeDirect3D9.cpp
112 lines (93 loc) · 3.76 KB
/
FakeDirect3D9.cpp
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
#include "FakeDirect3D9.h"
#include "FakeDirect3DDevice9.h"
FakeDirect3D9::FakeDirect3D9(IDirect3D9 *pOriginal) :
m_pIDirect3D9(pOriginal)
{
}
FakeDirect3D9::~FakeDirect3D9(void)
{
}
HRESULT FakeDirect3D9::QueryInterface(REFIID riid, void** ppvObj)
{
*ppvObj = NULL;
HRESULT hRes = m_pIDirect3D9->QueryInterface(riid, ppvObj);
if (SUCCEEDED(hRes))
*ppvObj = this;
return hRes;
}
ULONG FakeDirect3D9::AddRef(void)
{
return(m_pIDirect3D9->AddRef());
}
ULONG FakeDirect3D9::Release(void)
{
ULONG count = m_pIDirect3D9->Release();
if (count < 1)
delete(this);
return(count);
}
HRESULT FakeDirect3D9::RegisterSoftwareDevice(void* pInitializeFunction)
{
return(m_pIDirect3D9->RegisterSoftwareDevice(pInitializeFunction));
}
UINT FakeDirect3D9::GetAdapterCount(void)
{
return(m_pIDirect3D9->GetAdapterCount());
}
HRESULT FakeDirect3D9::GetAdapterIdentifier(UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier)
{
return(m_pIDirect3D9->GetAdapterIdentifier(Adapter,Flags,pIdentifier));
}
UINT FakeDirect3D9::GetAdapterModeCount(UINT Adapter, D3DFORMAT Format)
{
return(m_pIDirect3D9->GetAdapterModeCount(Adapter, Format));
}
HRESULT FakeDirect3D9::EnumAdapterModes(UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode)
{
return(m_pIDirect3D9->EnumAdapterModes(Adapter,Format,Mode,pMode));
}
HRESULT FakeDirect3D9::GetAdapterDisplayMode( UINT Adapter,D3DDISPLAYMODE* pMode)
{
return(m_pIDirect3D9->GetAdapterDisplayMode(Adapter,pMode));
}
HRESULT FakeDirect3D9::CheckDeviceType(UINT iAdapter,D3DDEVTYPE DevType,D3DFORMAT DisplayFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed)
{
return(m_pIDirect3D9->CheckDeviceType(iAdapter,DevType,DisplayFormat,BackBufferFormat,bWindowed));
}
HRESULT FakeDirect3D9::CheckDeviceFormat(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat)
{
return(m_pIDirect3D9->CheckDeviceFormat(Adapter,DeviceType,AdapterFormat,Usage,RType,CheckFormat));
}
HRESULT FakeDirect3D9::CheckDeviceMultiSampleType(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels)
{
return(m_pIDirect3D9->CheckDeviceMultiSampleType(Adapter,DeviceType,SurfaceFormat,Windowed,MultiSampleType,pQualityLevels));
}
HRESULT FakeDirect3D9::CheckDepthStencilMatch(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat)
{
return(m_pIDirect3D9->CheckDepthStencilMatch(Adapter,DeviceType,AdapterFormat,RenderTargetFormat,DepthStencilFormat));
}
HRESULT FakeDirect3D9::CheckDeviceFormatConversion(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat)
{
return(m_pIDirect3D9->CheckDeviceFormatConversion(Adapter,DeviceType,SourceFormat,TargetFormat));
}
HRESULT FakeDirect3D9::GetDeviceCaps(UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps)
{
return(m_pIDirect3D9->GetDeviceCaps(Adapter,DeviceType,pCaps));
}
HMONITOR FakeDirect3D9::GetAdapterMonitor(UINT Adapter)
{
return(m_pIDirect3D9->GetAdapterMonitor(Adapter));
}
HRESULT FakeDirect3D9::CreateDevice(UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface)
{
if (pPresentationParameters->BackBufferWidth == 800 &&
pPresentationParameters->BackBufferHeight == 600)
{
pPresentationParameters->BackBufferWidth = 1920;
pPresentationParameters->BackBufferHeight = 1080;
}
pPresentationParameters->PresentationInterval = D3DPRESENT_INTERVAL_ONE; // force VSYNC
HRESULT hres = m_pIDirect3D9->CreateDevice(Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface);
*ppReturnedDeviceInterface = new FakeDirect3DDevice9(*ppReturnedDeviceInterface);
return(hres);
}