Commit 4aa3eecd authored by SR_team's avatar SR_team 💬

Sfae destroy dx-hook

parent ffa7eee9
......@@ -20,12 +20,20 @@ hookIDirect3DDevice9::hookIDirect3DDevice9( IDirect3DDevice9 *pOriginal ) {
}
hookIDirect3DDevice9::~hookIDirect3DDevice9( void ) {
d3d9_destroy();
if ( *reinterpret_cast<IDirect3DDevice9 **>( 0xC97C28 ) == this )
*reinterpret_cast<IDirect3DDevice9 **>( 0xC97C28 ) = origIDirect3DDevice9;
}
bool hookIDirect3DDevice9::d3d9_destroy() {
ImGui_ImplDX9_Shutdown();
ImGui_ImplWin32_Shutdown();
ImGui::DestroyContext();
// TODO: переделать во благо совместимости
if ( *reinterpret_cast<IDirect3DDevice9 **>( 0xC97C28 ) == this )
*reinterpret_cast<IDirect3DDevice9 **>( 0xC97C28 ) = origIDirect3DDevice9;
if ( *reinterpret_cast<IDirect3DDevice9 **>( 0xC97C28 ) != this ) {
*reinterpret_cast<size_t **>( this ) = *reinterpret_cast<size_t **>( origIDirect3DDevice9 );
return false;
}
return true;
}
HRESULT hookIDirect3DDevice9::QueryInterface( REFIID riid, void **ppvObj ) {
......
......@@ -334,6 +334,8 @@ public:
void __stdcall d3d9_hook( uIDirect3DDevice9 ret );
bool __stdcall d3d9_destroy();
protected:
bool __stdcall isHooked();
void __stdcall resetHooked();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment