From b082a6da30e6aa480523de9be81e869eacc0d81d Mon Sep 17 00:00:00 2001 From: Grinch_ Date: Fri, 9 Jul 2021 15:02:54 +0600 Subject: [PATCH] Fix crash with nvidia overlay --- CheatMenu/Hook.cpp | 16 ++++++++-------- CheatMenu/Hook.h | 2 +- CheatMenu/Vehicle.cpp | 1 + CheatMenu/pch.h | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CheatMenu/Hook.cpp b/CheatMenu/Hook.cpp index 91b2701..2bc73cb 100644 --- a/CheatMenu/Hook.cpp +++ b/CheatMenu/Hook.cpp @@ -166,19 +166,19 @@ Hook::Hook() { ImGui::CreateContext(); - // gtaRenderHook - if (init(kiero::RenderType::D3D11) == kiero::Status::Success) + if (init(kiero::RenderType::D3D9) == kiero::Status::Success) { - Globals::renderer = Render_DirectX11; - kiero::bind(8, (void**)&oPresent11, Dx11Handler); + Globals::renderer = Render_DirectX9; + kiero::bind(16, (void**)&oReset, Reset); + kiero::bind(42, (void**)&oEndScene, Dx9Handler); } else { - if (init(kiero::RenderType::D3D9) == kiero::Status::Success) + // gtaRenderHook + if (init(kiero::RenderType::D3D11) == kiero::Status::Success) { - Globals::renderer = Render_DirectX9; - kiero::bind(16, (void**)&oReset, Reset); - kiero::bind(42, (void**)&oEndScene, Dx9Handler); + Globals::renderer = Render_DirectX11; + kiero::bind(8, (void**)&oPresent11, Dx11Handler); } } } diff --git a/CheatMenu/Hook.h b/CheatMenu/Hook.h index 9a03b92..44b7fc6 100644 --- a/CheatMenu/Hook.h +++ b/CheatMenu/Hook.h @@ -15,7 +15,7 @@ private: inline static f_EndScene oEndScene; inline static f_Reset oReset; inline static bool m_bMouseVisibility; - + static void CALLBACK RenderFrame(void* ptr); static HRESULT CALLBACK Dx9Handler(IDirect3DDevice9* pDevice); static HRESULT CALLBACK Dx11Handler(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags); diff --git a/CheatMenu/Vehicle.cpp b/CheatMenu/Vehicle.cpp index 91ed068..071b384 100644 --- a/CheatMenu/Vehicle.cpp +++ b/CheatMenu/Vehicle.cpp @@ -8,6 +8,7 @@ Vehicle::Vehicle() { ParseVehiclesIDE(); ParseCarcolsDAT(); + Events::processScriptsEvent += [this] { if (!m_bImagesLoaded) diff --git a/CheatMenu/pch.h b/CheatMenu/pch.h index 79bb2f5..3f42089 100644 --- a/CheatMenu/pch.h +++ b/CheatMenu/pch.h @@ -93,7 +93,7 @@ struct STextureStructure { std::string m_FileName; std::string m_CategoryName; - void* m_pTexture; + void* m_pTexture = nullptr; }; struct HotKeyData