Crash csgo!

Начинающий
Статус
Оффлайн
Регистрация
22 Ноя 2019
Сообщения
45
Реакции[?]
8
Поинты[?]
0
// VMTHooks
g_Hooks.pClientHook = std::make_unique<VMTHook>(g_pClientDll);
g_Hooks.pPredictionHook = std::make_unique<VMTHook>(g_pPrediction);
g_Hooks.pEngineHook = std::make_unique<VMTHook>(g_pEngine);
g_Hooks.pClientModeHook = std::make_unique<VMTHook>(g_pClientMode);
g_Hooks.pSurfaceHook = std::make_unique<VMTHook>(g_pSurface);
g_Hooks.pPanelHook = std::make_unique<VMTHook>(g_pPanel);
g_Hooks.pModelHook = std::make_unique<VMTHook>(g_pModelRender);
g_Hooks.pRenderViewHook = std::make_unique<VMTHook>(g_pRenderView);
g_Hooks.D3DHook = std::make_unique<VMTHook>((DWORD**)shaderapidx9);
// Hook the table functions
g_Hooks.pClientHook->Hook(vtable_indexes::frameStage, Hooks::FrameStageNotify);
g_Hooks.pPredictionHook->Hook(14, Hooks::inprediction);
g_Hooks.pClientHook->Hook(24, Hooks::WriteUsercmdDeltaToBuffer_hook);

g_Hooks.pClientModeHook->Hook(vtable_indexes::createMove, Hooks::CreateMove);
g_Hooks.pClientModeHook->Hook(44, Hooks::DoPostScreenEffects);
g_Hooks.pEngineHook->Hook(59, Hooks::fire_event);
//g_Hooks.pEngineHook->Hook(93, Hooks::IsHLTV);
g_Hooks.pClientModeHook->Hook(vtable_indexes::view, Hooks::OverrideView);
g_Hooks.pSurfaceHook->Hook(vtable_indexes::lockCursor, Hooks::LockCursor);
g_Hooks.pPanelHook->Hook(vtable_indexes::paint, Hooks::PaintTraverse);
g_Hooks.pModelHook->Hook(vtable_indexes::dme, Hooks::DrawModelExecute);
g_Hooks.D3DHook->Hook(vtable_indexes::end_scene, Hooks::Hooked_EndScene);
g_Hooks.D3DHook->Hook(vtable_indexes::end_scene_reset, Hooks::Hooked_EndScene_Reset);
g_Hooks.pRenderViewHook->Hook(vtable_indexes::sceneEnd, Hooks::SceneEnd);

......................
void __stdcall Hooks::Hooked_EndScene(IDirect3DDevice9* pDevice)
{
static auto oEndScene = g_Hooks.D3DHook->GetOriginal<EndSceneFn>(vtable_indexes::end_scene);



if (!initialized) {
g_Menu.setup(pDevice);

ImGuiIO& io = ImGui::GetIO();
io.MouseDrawCursor = 1;
io.Fonts->AddFontDefault();

D3DVIEWPORT9 d3d_viewport;
pDevice->GetViewport(&d3d_viewport);

pDevice->CreateStateBlock(D3DSBT_ALL, &state_block);
state_block->Capture();

pDevice->SetVertexShader(nullptr);
pDevice->SetPixelShader(nullptr);
pDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE);

pDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
pDevice->SetRenderState(D3DRS_FOGENABLE, FALSE);
pDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);

pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
pDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE);
pDevice->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
pDevice->SetRenderState(D3DRS_STENCILENABLE, FALSE);

pDevice->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, TRUE);
pDevice->SetRenderState(D3DRS_ANTIALIASEDLINEENABLE, TRUE);

pDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
pDevice->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
pDevice->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, TRUE);
//device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
pDevice->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_INVDESTALPHA);
//device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
pDevice->SetRenderState(D3DRS_DESTBLENDALPHA, D3DBLEND_ONE);

pDevice->SetRenderState(D3DRS_SRGBWRITEENABLE, FALSE);
pDevice->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_ALPHA);

ImGui_ImplWin32_Init(g_Hooks.hCSGOWindow);
ImGui_ImplDX9_Init(pDevice);

ImGui_ImplDX9_NewFrame();

//g_Menu.menu();



state_block->Apply();
state_block->Release();
}

ImGui::Render();


return oEndScene(pDevice);
}

extern LRESULT ImGui_ImplDX9_WndProcHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
LRESULT Hooks::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{

if (uMsg == WM_KEYDOWN && wParam == VK_INSERT)
g_Menu.is_opened = !g_Menu.is_opened;

if (ImGui_ImplDX9_WndProcHandler(hWnd, uMsg, wParam, lParam) && GetKeyState(VK_INSERT) == 1)
return 1l;

return DefWindowProc(hWnd, uMsg, wParam, lParam);
//return CallWindowProcA(g_Hooks.pOriginalWNDProc, hWnd, uMsg, wParam, lParam);
}

Why does this crash csgo , I used the latest version of imgui
 
Keine panik!
Эксперт
Статус
Оффлайн
Регистрация
29 Апр 2020
Сообщения
812
Реакции[?]
417
Поинты[?]
49K
Compile your source in debug mode, with symbols enabled.
Then attach to game process before your hooks get installed.
When it crash you will get information about its location in visual studio window (address and reason), therefore you can understand where it crashes and why.
 
Сверху Снизу