Use shared font atlas and fix crash when opening overlay in some games.

This commit is contained in:
Mr_Goldberg 2022-08-21 03:45:11 -04:00
parent de6805dd8b
commit c9a102ee30
No known key found for this signature in database
GPG key ID: 8597D87419DEF278
9 changed files with 25 additions and 20 deletions

View file

@ -115,7 +115,7 @@ void DX10_Hook::_PrepareForOverlay(IDXGISwapChain* pSwapChain)
pDevice->CreateRenderTargetView(pBackBuffer, nullptr, &mainRenderTargetView);
pBackBuffer->Release();
ImGui::CreateContext();
ImGui::CreateContext((ImFontAtlas *)ImGuiFontAtlas);
ImGui_ImplDX10_Init(pDevice);
Windows_Hook::Inst()->SetInitialWindowSize(desc.OutputWindow);

View file

@ -147,7 +147,7 @@ void DX11_Hook::_PrepareForOverlay(IDXGISwapChain* pSwapChain)
return;
if(ImGui::GetCurrentContext() == nullptr)
ImGui::CreateContext();
ImGui::CreateContext((ImFontAtlas *)ImGuiFontAtlas);
ImGui_ImplDX11_Init(pDevice, pContext);

View file

@ -264,7 +264,7 @@ void DX12_Hook::_PrepareForOverlay(IDXGISwapChain* pSwapChain, ID3D12CommandQueu
//auto heaps = std::move(get_free_texture_heap());
ImGui::CreateContext();
ImGui::CreateContext((ImFontAtlas *)ImGuiFontAtlas);
ImGui_ImplDX12_Init(pDevice, bufferCount, DXGI_FORMAT_R8G8B8A8_UNORM, pSrvDescHeap,
pSrvDescHeap->GetCPUDescriptorHandleForHeapStart(),
pSrvDescHeap->GetGPUDescriptorHandleForHeapStart());

View file

@ -133,7 +133,7 @@ void DX9_Hook::_PrepareForOverlay(IDirect3DDevice9 *pDevice, HWND destWindow)
pDevice->AddRef();
_pDevice = pDevice;
ImGui::CreateContext();
ImGui::CreateContext((ImFontAtlas *)ImGuiFontAtlas);
ImGui_ImplDX9_Init(pDevice);
_LastWindow = destWindow;

View file

@ -86,7 +86,7 @@ void OpenGL_Hook::_PrepareForOverlay(HDC hDC)
if (!_Initialized)
{
ImGui::CreateContext();
ImGui::CreateContext((ImFontAtlas *)ImGuiFontAtlas);
ImGui_ImplOpenGL3_Init();
_LastWindow = hWnd;