#include "Hooks.h"
#include "Menu.h"
#include "imgui\imgui_impl_dx9.h"
#include "imgui\imgui_impl_win32.h"
#include <d3dx9tex.h>
#include "AntiAims.h"
#include <chrono>
void GUI_Init(IDirect3DDevice9* pDevice)
{
if (!vars.menu.guiinited)
{
ImGui::CreateContext();
ImGui_ImplWin32_Init(csgo->Init.Window);
ImGui_ImplDX9_Init(pDevice);
ImGuiIO& io = ImGui::GetIO();
ImFontConfig cfg;
fonts::menu_main = io.Fonts->AddFontFromFileTTF("C:/windows/fonts/verdana.ttf", 12, &cfg, io.Fonts->GetGlyphRangesCyrillic());
fonts::menu_desc = io.Fonts->AddFontFromFileTTF("C:/windows/fonts/tahoma.ttf", 13, &cfg, io.Fonts->GetGlyphRangesCyrillic());
fonts::lby_indicator = io.Fonts->AddFontFromFileTTF("C:/windows/fonts/verdanab.ttf", 25, &cfg, io.Fonts->GetGlyphRangesCyrillic());
//ImGuiFreeType::BuildFontAtlas(io.Fonts, 0x00);
vars.menu.guiinited = true;
}
}
LPDIRECT3DTEXTURE9 img = nullptr;
LPD3DXSPRITE sprite = nullptr;
string UnixTimeToExpiryDate(long long unixTime) {
string s, m, h;
if (unixTime < 0) {
csgo->DoUnload = true;
return string();
}
s = std::to_string(unixTime % 60);
unixTime /= 60;
m = std::to_string(unixTime % 60);
unixTime /= 60;
h = std::to_string(unixTime % 24);
unixTime /= 24;
if (atoi(h.c_str()) > 1000)
return "Never :)";
return std::to_string(unixTime)
+ "d:" + ("0" + h).substr(h.length() - 1)
+ "h:" + ("0" + m).substr(m.length() - 1)
+ "m:" + ("0" + s).substr(s.length() - 1)
+ "s";
}
static HRESULT __stdcall Hooked_Present(IDirect3DDevice9Ex* device, const RECT* src, const RECT* dest, HWND windowOverride, const RGNDATA* dirtyRegion) noexcept
{
IDirect3DStateBlock9* stateBlock = nullptr;
IDirect3DVertexDeclaration9* vertDec = nullptr;
if (csgo->DoUnload)
return H::SteamPresent(device, src, dest, windowOverride, dirtyRegion);
if (device->CreateStateBlock(D3DSBT_PIXELSTATE, &stateBlock))
return H::SteamPresent(device, src, dest, windowOverride, dirtyRegion);
device->GetVertexDeclaration(&vertDec);
GUI_Init(device);
csgo->render_device = device;
g_Render->SetupPresent(device);
static void* dwReturnAddress = _ReturnAddress();
if (dwReturnAddress == _ReturnAddress())
{
g_Render->PreRender(device);
features->Visuals->DrawLocalShit(device);
g_Hitmarker->Paint();
g_Render->PostRender(device);
g_Menu->draw_indicators();
g_Menu->DrawWarermark();
g_Menu->render();
g_Render->EndPresent(device);
}
stateBlock->Apply();
stateBlock->Release();
device->SetVertexDeclaration(vertDec);
return H::SteamPresent(device, src, dest, windowOverride, dirtyRegion);//return present here
}
static HRESULT D3DAPI Hooked_Reset(IDirect3DDevice9Ex* device, D3DPRESENT_PARAMETERS* params) noexcept
{
//H::SteamReset = g_pD3DX9->GetOriginal<Reset_t>(16);
if (csgo->DoUnload)
return H::SteamReset(device, params);
g_Render->InvalidateObjects();
auto hr = H::SteamReset(device, params);
if (hr >= 0) {
g_Render->CreateObjects(device);
}
return hr;
}