Cleaned a bit hooks and added sanity checks.

This commit is contained in:
Nemirtingas 2019-08-26 19:36:07 +02:00
parent 2365b50c38
commit 9b178146c4
12 changed files with 595 additions and 142 deletions

View file

@ -139,7 +139,10 @@ HRESULT STDMETHODCALLTYPE DX10_Hook::MyResizeBuffers(IDXGISwapChain* _this, UINT
DX10_Hook::DX10_Hook():
initialized(false),
pDevice(nullptr),
mainRenderTargetView(nullptr)
mainRenderTargetView(nullptr),
Present(nullptr),
ResizeBuffers(nullptr),
ResizeTarget(nullptr)
{
_library = LoadLibrary(DLL_NAME);
@ -190,13 +193,9 @@ const char* DX10_Hook::get_lib_name() const
return DLL_NAME;
}
void DX10_Hook::loadFunctions(ID3D10Device *pDevice, IDXGISwapChain *pSwapChain)
void DX10_Hook::loadFunctions(IDXGISwapChain *pSwapChain)
{
void** vTable = *reinterpret_cast<void***>(pDevice);
#define LOAD_FUNC(X) (void*&)X = vTable[(int)ID3D10DeviceVTable::X]
#undef LOAD_FUNC
void** vTable;
vTable = *reinterpret_cast<void***>(pSwapChain);
#define LOAD_FUNC(X) (void*&)X = vTable[(int)IDXGISwapChainVTable::X]