Overlay & Hook cleanup.

This commit is contained in:
Nemirtingas 2019-08-27 15:45:53 +02:00
parent 44d583ee7d
commit 04847abeb7
6 changed files with 3 additions and 170 deletions

View file

@ -94,29 +94,6 @@ void DX9_Hook::prepareForOverlay(IDirect3DDevice9 *pDevice)
ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData());
}
/////////////////////////////////////////////////////////////////////////////////////
// DirectX 9 Initialization functions
//IDirect3D9* DX9_Hook::MyDirect3DCreate9(UINT SDKVersion)
//{
// auto res = hook->Direct3DCreate9(SDKVersion);
//
// if( res != nullptr )
// hook->hook_dx9(SDKVersion);
//
// return res;
//}
//
//HRESULT DX9_Hook::MyDirect3DCreate9Ex(UINT SDKVersion, IDirect3D9Ex** ppDevice)
//{
// auto res = hook->Direct3DCreate9Ex(SDKVersion, ppDevice);
//
// if (SUCCEEDED(res))
// hook->hook_dx9(SDKVersion);
//
// return res;
//}
/////////////////////////////////////////////////////////////////////////////////////
HRESULT STDMETHODCALLTYPE DX9_Hook::MyReset(IDirect3DDevice9* _this, D3DPRESENT_PARAMETERS* pPresentationParameters)
{
DX9_Hook::Inst()->resetRenderState();
@ -154,28 +131,14 @@ DX9_Hook::DX9_Hook():
Reset(nullptr)
{
_library = LoadLibrary(DLL_NAME);
// Hook to Direct3DCreate9 and Direct3DCreate9Ex so we know when it gets called.
// If its called, then DX9 will be used to render the overlay.
//Direct3DCreate9 = (decltype(Direct3DCreate9))GetProcAddress(_dll, "Direct3DCreate9");
//Direct3DCreate9Ex = (decltype(Direct3DCreate9Ex))GetProcAddress(_dll, "Direct3DCreate9Ex");
//
//BeginHook();
//HookFuncs(
// std::make_pair<void**, void*>(&(PVOID&)Direct3DCreate9, &DX9_Hook::MyDirect3DCreate9),
// std::make_pair<void**, void*>(&(PVOID&)Direct3DCreate9Ex, &DX9_Hook::MyDirect3DCreate9Ex)
//);
//EndHook();
}
DX9_Hook::~DX9_Hook()
{
PRINT_DEBUG("DX9 Hook removed\n");
//resetRenderState();
if (initialized)
{
//ImGui_ImplDX9_Shutdown(); This makes some games hang when Releasing the D3D9 device (pDevice->Release())
// maybe because D3D is already shut down when we try to free the device?
ImGui_ImplDX9_InvalidateDeviceObjects();
ImGui::DestroyContext();
}