ImGui: move initialization code to DX hook setups

Also removed unused global declaration 'g_bImGuiInitialized'.
This commit is contained in:
Kawe Mazidjatari 2024-02-25 21:15:37 +01:00
parent c3b0034478
commit b9c7cabda9
4 changed files with 6 additions and 8 deletions

View File

@ -17,10 +17,6 @@ bool HCVideoMode_Common__CreateGameWindow(int* pnRect)
g_nWindowRect[1] = pnRect[1]; g_nWindowRect[1] = pnRect[1];
const bool ret = CVideoMode_Common__CreateGameWindow(pnRect); const bool ret = CVideoMode_Common__CreateGameWindow(pnRect);
if (!ImguiSystem_Init())
Error(eDLL_T::MS, 0, "ImGui system initialization failed!\n");
return ret; return ret;
} }

View File

@ -30,9 +30,6 @@ bool CMaterialSystem::Connect(CMaterialSystem* thisptr, const CreateInterfaceFn
void CMaterialSystem::Disconnect(CMaterialSystem* thisptr) void CMaterialSystem::Disconnect(CMaterialSystem* thisptr)
{ {
#ifndef MATERIALSYSTEM_NODX
ImguiSystem_Shutdown();
#endif
CMaterialSystem__Disconnect(thisptr); CMaterialSystem__Disconnect(thisptr);
} }

View File

@ -349,6 +349,9 @@ void DirectX_Init()
Assert(0); Assert(0);
Error(eDLL_T::COMMON, 0xBAD0C0DE, "Failed to detour process: error code = %08x\n", hr); Error(eDLL_T::COMMON, 0xBAD0C0DE, "Failed to detour process: error code = %08x\n", hr);
} }
if (!ImguiSystem_Init())
Error(eDLL_T::MS, 0, "ImGui system initialization failed!\n");
} }
void DirectX_Shutdown() void DirectX_Shutdown()
@ -367,6 +370,9 @@ void DirectX_Shutdown()
// Commit the transaction // Commit the transaction
DetourTransactionCommit(); DetourTransactionCommit();
if (ImguiSystem_IsInitialized())
ImguiSystem_Shutdown();
} }
void VDXGI::GetAdr(void) const void VDXGI::GetAdr(void) const

View File

@ -22,7 +22,6 @@ typedef HRESULT(__stdcall* IDXGIResizeBuffers) (IDXGISwapChain* pSwapChain, UI
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Globals // Globals
extern BOOL g_bImGuiInitialized;
extern UINT g_nWindowRect[2]; // TODO[ AMOS ]: Remove this in favor of CGame's window rect members??? extern UINT g_nWindowRect[2]; // TODO[ AMOS ]: Remove this in favor of CGame's window rect members???
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////