-
Автор темы
- #1
Добрый вечер! В лобби имгуй меню не крашит. Как только запускаюсь в катку, сразу ловлю краш. В чем может быть дело?
C++:
IRenderer* pRenderer = SSystemGlobalEnvironment::Singleton()->GetRenderer();
if (!pRenderer) return false;
if (!Fun.Render.CreateDevice) {
if (SUCCEEDED(pSwapChain->GetDevice(__uuidof(ID3D11Device), (void**)&pRenderer->m_pd3dDevice))) {
pRenderer->m_pd3dDevice->GetImmediateContext(&pRenderer->m_pd3dDeviceContext);
DXGI_SWAP_CHAIN_DESC sd;
pSwapChain->GetDesc(&sd);
pRenderer->m_hWnd = sd.OutputWindow;
ID3D11Texture2D* pBackBuffer;
pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer);
pRenderer->m_pd3dDevice->CreateRenderTargetView(pBackBuffer, NULL, &pRenderer->m_pBackBuffer);
pBackBuffer->Release();
oWndProc = (WNDPROC)SetWindowLongPtr(pRenderer->m_hWnd, GWLP_WNDPROC, (LONG_PTR)WndProc);
InitImGui(pRenderer);
Fun.Render.CreateDevice = true;
}
else return hkInterFace->GetOriginalFunction<HRESULT(WINAPI*)(IDXGISwapChain*, UINT, UINT)>(8)(pSwapChain, SyncInterval, Flags);
}
auto flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoResize;
ImGui_ImplDX11_NewFrame();
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();
if ((GetAsyncKeyState(VK_HOME) & 1) || (GetAsyncKeyState(VK_END) & 1) || (GetAsyncKeyState(VK_INSERT) & 1)) Fun.Render.DrawMenu = !Fun.Render.DrawMenu;
if (Fun.Render.DrawMenu) {
ImGui::Begin("Softs", nullptr, flags); {
ImGui::SetWindowSize({ 341.f, 274.f });
ImGui::SetCursorPos( { 15.f, 35.f } );
if ( ImGui::Button ("AimBot", ImVec2(70.f, 30.f ) ) )
{
tab_ = 1;
}
ImGui::SetCursorPos ( { 95.f, 35.f } );
if ( ImGui::Button ( "Visuals" , ImVec2(70.f, 30.f)) )
{
tab_ = 2;
}
ImGui::SetCursorPos ( { 175.f, 35.f } );
if ( ImGui::Button ( "Weapon" , ImVec2(70.f, 30.f)) )
{
tab_ = 3;
}
ImGui::SetCursorPos ( { 255.f, 35.f } );
if ( ImGui::Button ( "Colors", ImVec2(70.f, 30.f)) ) {
tab_ = 4;
}
}
ImGui::End();
}
if (pFunction.Fov) {
int m_width = ImGui::GetIO().DisplaySize.x;
int m_height = ImGui::GetIO().DisplaySize.y;
ImGui::GetOverlayDrawList()->AddCircle(ImVec2(m_width / 2, m_height / 2), pFunction.fov_act2 * 4, ImColor(circle_color[0], circle_color[1], circle_color[2], circle_color[3]), 100, 1.f);
}
ImGui::Render();
pRenderer->m_pd3dDeviceContext->OMSetRenderTargets(1, &pRenderer->m_pBackBuffer, NULL);
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
return hkInterFace->GetOriginalFunction<HRESULT(WINAPI*)(IDXGISwapChain*, UINT, UINT)>(8)(pSwapChain, SyncInterval, Flags);
}