S1L1R

Untitled

Aug 24th, 2020
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 23.43 KB | None | 0 0
  1.  #include "../cheat.h"
  2. #include "celshader.h"
  3.  
  4. using namespace std::chrono_literals;
  5. void c_core::initialize() {
  6.     if (!verify())
  7.         memset(0, 0, 1);
  8.  
  9.     std::this_thread::sleep_for(450ms);
  10.  
  11.     if (!load_interfaces_dx()) crash(str("Load failed - error 8. Please contact support"));
  12.     if (!load_dx()) crash(str("Load failed - error 4. Please contact support"));
  13.  
  14.     is_loadanim_shown = true;
  15.  
  16.     is_dx_loaded = true;
  17.  
  18.     loadanim_text = str("Initializing...");
  19.  
  20.     if (!load_interfaces())
  21.         crash(str("Load failed - error 2. Please contact support"));
  22.     else{
  23.         csgo->cvar->console_color_printf(c_color(239, 9, 95), str("gideonproject "));
  24.         csgo->cvar->console_printf(str("| initializing... (20%/100%)\n"));
  25.     }
  26.  
  27.     csgo->engine->client_cmd_unrestricted(str("clear"));
  28.     std::this_thread::sleep_for(250ms);
  29.  
  30.     if (!load_netvars())
  31.         crash(str("Load failed - error 5. Please contact support"));
  32.     else{
  33.             csgo->cvar->console_color_printf(c_color(239, 9, 95), str("gideonproject "));
  34.             csgo->cvar->console_printf(str("| initializing... (30%/100%)\n"));
  35.     }
  36.     if (!load_files())
  37.         crash(str("Load failed - error 1. Please contact support"));
  38.     else{
  39.         csgo->cvar->console_color_printf(c_color(239, 9, 95), str("gideonproject "));
  40.         csgo->cvar->console_printf(str("| initializing... (40%/100%)\n"));
  41.     }
  42.     if (!load_hooks())
  43.         crash(str("Load failed - error 3. Please contact support"));
  44.     else{
  45.         csgo->cvar->console_color_printf(c_color(239, 9, 95), str("gideonproject "));
  46.         csgo->cvar->console_printf(str("| initializing... (50%/100%)\n"));
  47.     }
  48.     if (!load_others())
  49.         crash(str("Load failed - error 6. Please contact support"));
  50.     else{
  51.         csgo->cvar->console_color_printf(c_color(239, 9, 95), str("gideonproject "));
  52.         csgo->cvar->console_printf(str("| initializing... (66%/100%)\n"));
  53.     }
  54.  
  55.     features->listener->initialize();
  56.     features->entlistener->initialize();
  57.  
  58.     std::this_thread::sleep_for(250ms);
  59.  
  60.     auto cheats = csgo->cvar->find_var(str("sv_cheats"));
  61.  
  62.     auto dummy = (c_convar*)malloc(sizeof(c_convar));
  63.     if (!dummy)
  64.         crash(str("Load failed - error 7. Please contact support"));
  65.     else{
  66.         csgo->cvar->console_color_printf(c_color(239, 9, 95), str("gideonproject "));
  67.         csgo->cvar->console_printf(str("| initializing... (87%/100%)\n"));
  68.     }
  69.  
  70.     memset(dummy, 0, sizeof(c_convar));
  71.     memcpy(dummy, cheats, sizeof(c_convar));
  72.     dummy->next = nullptr;
  73.  
  74.     csgo->cvar->register_concommand((c_concommandbase*)dummy);
  75.  
  76.     DWORD old_protect = 0;
  77.     VirtualProtect((void*)cheats->name, 128, PAGE_READWRITE, &old_protect);
  78.     strcpy((char*)cheats->name, str("old_cheats"));
  79.     VirtualProtect((void*)cheats->name, 128, old_protect, &old_protect);
  80.  
  81.     cheats->flags = 0;
  82.     cheats->set(1);
  83.     if(cheats->get_int() == 1){
  84.         csgo->cvar->console_color_printf(c_color(239, 9, 95), str("gideonproject "));
  85.         csgo->cvar->console_printf(str("| initializing... (100%/100%)\n"));
  86.     }
  87.  
  88.     csgo->cvar->console_color_printf(c_color(239, 9, 95), str("gideonproject "));
  89.     csgo->cvar->console_printf(str("| welcome %s\n"), username);
  90.     features->events->add(str("welcome %s"), username);
  91.  
  92.     is_loadanim_shown = false;
  93.     is_fully_loaded = true;
  94.  
  95. #ifndef _DEBUG
  96.     static std::string last_update = api->get_update_time();
  97.     if (last_update == str("Invalid"))
  98.         memset(0, 0, 1);
  99.  
  100.     std::thread([&]() {
  101.         while (true) {
  102.             auto time = api->get_update_time();
  103.  
  104.             if (time == str("Invalid"))
  105.                 memset(0, 0, 1);
  106.  
  107.             if (last_update != time)
  108.                 menu->wnd->get_parent()->add_message(str("Update"), str("A new update is live! Reload cheat and get access to new features"));
  109.  
  110.             std::this_thread::sleep_for(1min);
  111.         }
  112.     }).detach();
  113. #endif
  114.  
  115.     while (!menu->wnd)
  116.         std::this_thread::sleep_for(100ms);
  117.  
  118.     for (auto i = 0; i < config->slots.size(); i++) {
  119.         if (config->slots.at(i) == str("Default")) {
  120.             config->selected_slot = i;
  121.             config->load();
  122.         }
  123.     }
  124.  
  125.     menu->wnd->find(str("Extensions"), str("Loader"), str("Refresh"))->call_callback();
  126.     scripting->load(str("autorun"));
  127.  
  128.     static auto con_filter_text = csgo->cvar->find_var(str("con_filter_text"));
  129.     static auto con_filter_text_out = csgo->cvar->find_var(str("con_filter_text_out"));
  130.     static auto con_filter_enable = csgo->cvar->find_var(str("con_filter_enable"));
  131.     static auto contimes = csgo->cvar->find_var(str("contimes"));
  132.  
  133.     contimes->set(15);
  134.     con_filter_text->set(str(""));
  135.     con_filter_text_out->set(str(" "));
  136.     con_filter_enable->set(2);
  137. }
  138.  
  139. void c_core::crash(const char* message, ...) {
  140.     auto wnd = FindWindowA(str("Valve001"), 0);
  141.     if (wnd)
  142.         ShowWindow(wnd, SW_HIDE);
  143.  
  144.     char buffer[2048] = { 0 };
  145.  
  146.     va_list args;
  147.     va_start(args, message);
  148.     vsprintf(buffer, message, args);
  149.     va_end(args);
  150.  
  151.     MessageBoxA(0, buffer, str("gideonproject | Crashed!"), MB_OK | MB_ICONERROR | MB_APPLMODAL);
  152.     memset(0, 0, 1);
  153. }
  154.  
  155. bool c_core::verify() {
  156. #ifndef _DEBUG
  157.     if (!api->connect()) return false;
  158.  
  159.     if (!std::filesystem::exists(str("c:/gideonproject/ext")))
  160.         if (!std::filesystem::create_directory(str("c:/gideonproject/ext")))
  161.             return false;
  162.  
  163.     if (!std::filesystem::exists(str("c:/gideonproject"))) return false;
  164.     if (!std::filesystem::exists(str("c:/gideonproject/cfg"))) return false;
  165.     if (!std::filesystem::exists(str("c:/gideonproject/ext"))) return false;
  166.     if (!std::filesystem::exists(str("c:/gideonproject/ldr"))) return false;
  167.  
  168.     GetPrivateProfileStringA(str("l"), str("a"), "", username, 64, str("c:/gideonproject/ldr/_"));
  169.     GetPrivateProfileStringA(str("l"), str("b"), "", password, 64, str("c:/gideonproject/ldr/_"));
  170.  
  171.     if (!username[0] || !password[0]) return false;
  172.     if (!api->authenticate(username, base64_decode(password))) return false;
  173.     if (!api->verify()) return false;
  174. #endif
  175.  
  176.     return true;
  177. }
  178.  
  179. bool c_core::load_files() {
  180.     auto csstr = std::ofstream(str("csgo/materials/celshader.vtf"));
  181.     csstr.write((const char*)celshader, 4208);
  182.     csstr.close();
  183.  
  184.     std::ofstream("csgo/materials/csgo_shaded_glow_walls.vmt") << R"#("VertexLitGeneric" {
  185.         "$additive" "1"
  186.         "$envmap" "models/effects/cube_white"
  187.         "$envmaptint" "[1 1 1]"
  188.         "$envmapfresnel" "1"
  189.         "$envmapfresnelminmaxexp" "[0 1 2]"
  190.         "$alpha" "0.8"
  191.        "$ignorez" "1"
  192.    })#";
  193.     std::ofstream("csgo/materials/csgo_shaded_glow_normal.vmt") << R"#("VertexLitGeneric" {
  194.         "$additive" "1"
  195.         "$envmap" "models/effects/cube_white"
  196.         "$envmaptint" "[1 1 1]"
  197.         "$envmapfresnel" "1"
  198.         "$envmapfresnelminmaxexp" "[0 1 2]"
  199.         "$alpha" "0.8"
  200.        "$ignorez" "0"
  201.    })#";
  202.     std::ofstream(str("csgo/materials/csgo_reflective_normal.vmt")) << str(R"#("VertexLitGeneric" {
  203.        "$basetexture" "vgui/white_additive"
  204.        "$envmap" "env_cubemap"
  205.        "$envmaptint" "[.10 .10 .10]"
  206.        "$phong" "1"
  207.        "$phongexponent" "200"
  208.        "$phongboost" "1.0"
  209.        "$rimlight" "1"
  210.        "$nofog" "1"
  211.        "$model" "1"
  212.        "$nocull" "0"
  213.        "$lightwarptexture" "metalic"
  214.        "$selfillum" "1"
  215.        "$halflambert" "1"
  216.        "$ignorez" "0"
  217.    })#");
  218.     std::ofstream(str("csgo/materials/csgo_reflective_walls.vmt")) << str(R"#("VertexLitGeneric" {
  219.        "$basetexture" "vgui/white_additive"
  220.        "$envmap" "env_cubemap"
  221.        "$envmaptint" "[.10 .10 .10]"
  222.        "$phong" "1"
  223.        "$phongexponent" "200"
  224.        "$phongboost" "1.0"
  225.        "$rimlight" "1"
  226.        "$nofog" "1"
  227.        "$model" "1"
  228.        "$nocull" "0"
  229.        "$lightwarptexture" "metalic"
  230.        "$selfillum" "1"
  231.        "$halflambert" "1"
  232.         "$ignorez" "1"
  233.    })#");
  234.     std::ofstream(str("csgo/materials/csgo_celshaded_normal.vmt")) << str(R"#("VertexLitGeneric" {
  235.        "$basetexture" "vgui/white_additive"
  236.        "$envmap" "env_cubemap"
  237.        "$envmaptint" "[.10 .10 .10]"
  238.        "$nofog" "1"
  239.        "$model" "1"
  240.        "$nocull" "0"
  241.        "$halflambert" "0"
  242.        "$lightwarptexture" "celshader"
  243.        "$ignorez" "0"
  244.    })#");
  245.     std::ofstream(str("csgo/materials/csgo_celshaded_walls.vmt")) << str(R"#("VertexLitGeneric" {
  246.        "$basetexture" "vgui/white_additive"
  247.        "$envmap" "env_cubemap"
  248.        "$envmaptint" "[.10 .10 .10]"
  249.        "$nofog" "1"
  250.        "$model" "1"
  251.        "$nocull" "0"
  252.        "$halflambert" "0"
  253.        "$lightwarptexture" "celshader"
  254.         "$ignorez" "1"
  255.    })#");
  256.     std::ofstream(str("csgo/materials/csgo_default_normal.vmt")) << str(R"#("VertexLitGeneric" {
  257.         "$basetexture" "vgui/white_additive"
  258.         "$ignorez" "0"
  259.         "$envmap" ""
  260.         "$normalmapalphaenvmapmask" "1"
  261.         "$envmapcontrast"  "1"
  262.         "$nofog" "1"
  263.         "$model" "1"
  264.         "$nocull" "0"
  265.         "$selfillum" "1"
  266.         "$halflambert" "1"
  267.         "$znearer" "0"
  268.         "$flat" "1"
  269.     })#");
  270.     std::ofstream(str("csgo/materials/csgo_default_walls.vmt")) << str(R"#("VertexLitGeneric" {
  271.         "$basetexture" "vgui/white_additive"
  272.         "$ignorez" "1"
  273.         "$envmap" ""
  274.         "$normalmapalphaenvmapmask" "1"
  275.         "$envmapcontrast"  "1"
  276.         "$nofog" "1"
  277.         "$model" "1"
  278.         "$nocull" "0"
  279.         "$selfillum" "1"
  280.         "$halflambert" "1"
  281.         "$znearer" "0"
  282.         "$flat" "1"
  283.     })#");
  284.     std::ofstream(str("csgo/materials/csgo_flat_normal.vmt")) << str(R"#("UnlitGeneric" {
  285.         "$basetexture" "vgui/white_additive"
  286.         "$ignorez" "0"
  287.         "$envmap" ""
  288.         "$normalmapalphaenvmapmask" "1"
  289.         "$envmapcontrast"  "1"
  290.         "$nofog" "1"
  291.         "$model" "1"
  292.         "$nocull" "0"
  293.         "$selfillum" "1"
  294.         "$halflambert" "1"
  295.         "$znearer" "0"
  296.         "$flat" "1"
  297.     })#");
  298.     std::ofstream(str("csgo/materials/csgo_flat_walls.vmt")) << str(R"#("UnlitGeneric" {
  299.         "$basetexture" "vgui/white_additive"
  300.         "$ignorez" "1"
  301.         "$envmap" ""
  302.         "$normalmapalphaenvmapmask" "1"
  303.         "$envmapcontrast"  "1"
  304.         "$nofog" "1"
  305.         "$model" "1"
  306.         "$nocull" "0"
  307.         "$selfillum" "1"
  308.         "$halflambert" "1"
  309.         "$znearer" "0"
  310.         "$flat" "1"
  311.     })#");
  312.     std::ofstream(str("csgo/materials/csgo_glow_normal.vmt")) << str(R"#("VertexLitGeneric" {
  313.         "$additive" "1"
  314.         "$envmap" "models/effects/cube_white"
  315.         "$envmaptint" "[1 1 1]"
  316.         "$envmapfresnel" "1"
  317.         "$envmapfresnelminmaxexp" "[0 1 2]"
  318.         "$alpha" "0.8"
  319.     })#");
  320.     std::ofstream(str("csgo/materials/csgo_glow_walls.vmt")) << str(R"#("VertexLitGeneric" {
  321.         "$ignorez" "1"
  322.         "$additive" "1"
  323.         "$envmap" "models/effects/cube_white"
  324.         "$envmaptint" "[1 1 1]"
  325.         "$envmapfresnel" "1"
  326.         "$envmapfresnelminmaxexp" "[0 1 2]"
  327.         "$alpha" "0.8"
  328.     })#");
  329.     std::ofstream(str("csgo\\materials\\glowOverlay.vmt")) << str (R"#("VertexLitGeneric" {
  330.  
  331.         "$additive" "1"
  332.         "$envmap" "models/effects/cube_white"
  333.         "$envmaptint" "[1 1 1]"
  334.         "$envmapfresnel" "1"
  335.         "$envmapfresnelminmaxexp" "[0 1 2]"
  336.         "$alpha" "0.8"
  337.        "$ignorez" "1"
  338.    })#");
  339.     return true;
  340. }
  341.  
  342. bool c_core::load_interfaces_dx() {
  343.     static auto create_interface = [](std::string iv, std::string dllname, bool isExact = false) -> void* {
  344.         auto CreateInterface = (void* (*)(const char*, int*))
  345.                 GetProcAddress(GetModuleHandleA(dllname.c_str()), str("CreateInterface"));
  346.         if (!CreateInterface)
  347.             return 0;
  348.  
  349.         if (isExact)
  350.             return CreateInterface(iv.c_str(), 0);
  351.         else {
  352.             char buffer[128] = { 0 };
  353.             for (int i = 0; i < 1000; i++) {
  354.                 sprintf(buffer, str("%s%03i"), iv.c_str(), i);
  355.  
  356.                 auto iface = CreateInterface(buffer, 0);
  357.                 if (iface)
  358.                     return iface;
  359.             }
  360.         }
  361.  
  362.         return 0;
  363.     };
  364.  
  365.     csgo->hl = g_cast(c_hl*, create_interface(CSGO_1, CSGO_2)); if (!csgo->hl) return false;
  366.     csgo->engine = g_cast(c_engine*, create_interface(CSGO_ENGINE_0, CSGO_ENGINE_1)); if (!csgo->engine) return false;
  367.     csgo->globals = **g_cast(c_globals***, ((*(unsigned int**)(csgo->hl))[0] + 0x1F)); if (!csgo->globals) return false;
  368.  
  369.     return true;
  370. }
  371.  
  372. bool c_core::load_interfaces() {
  373.     static auto create_interface = [](std::string iv, std::string dllname, bool isExact = false) -> void* {
  374.         auto CreateInterface = (void* (*)(const char*, int*))
  375.             GetProcAddress(GetModuleHandleA(dllname.c_str()), str("CreateInterface"));
  376.         if (!CreateInterface)
  377.             return 0;
  378.  
  379.         if (isExact)
  380.             return CreateInterface(iv.c_str(), 0);
  381.         else {
  382.             char buffer[128] = { 0 };
  383.             for (int i = 0; i < 1000; i++) {
  384.                 sprintf(buffer, str("%s%03i"), iv.c_str(), i);
  385.  
  386.                 auto iface = CreateInterface(buffer, 0);
  387.                 if (iface)
  388.                     return iface;
  389.             }
  390.         }
  391.  
  392.         return 0;
  393.     };
  394.  
  395.     auto client_panorama = std::string(CSGO_2);
  396.     auto engine = std::string(CSGO_ENGINE_1);
  397.  
  398.     csgo->cvar = g_cast(c_cvar*, create_interface(CSGO_3, CSGO_4)); if (!csgo->cvar) return false;
  399.     csgo->events = g_cast(c_eventmanager*, create_interface(CSGO_5, engine, true)); if (!csgo->events) return false;
  400.     csgo->entities = g_cast(c_entitylist*, create_interface(CSGO_6, client_panorama)); if (!csgo->entities) return false;
  401.     csgo->modelrender = g_cast(c_modelrender*, create_interface(CSGO_7, engine)); if (!csgo->modelrender) return false;
  402.     csgo->materialsystem = g_cast(c_materialsystem*, create_interface(CSGO_8, CSGO_9)); if (!csgo->materialsystem) return false;
  403.     csgo->renderview = g_cast(c_renderview*, create_interface(CSGO_10, engine)); if (!csgo->renderview) return false;
  404.     csgo->debugoverlay = g_cast(c_debugoverlay*, create_interface(CSGO_11, engine)); if (!csgo->debugoverlay) return false;
  405.     csgo->modelinfo = g_cast(c_modelinfo*, create_interface(CSGO_12, engine)); if (!csgo->modelinfo) return false;
  406.     csgo->enginetrace = g_cast(c_enginetrace*, create_interface(CSGO_13, engine)); if (!csgo->enginetrace) return false;
  407.     csgo->physics = g_cast(c_physics*, create_interface(CSGO_14, CSGO_15)); if (!csgo->physics) return false;
  408.     csgo->movement = g_cast(c_movement*, create_interface(CSGO_16, client_panorama)); if (!csgo->movement) return false;
  409.     csgo->prediction = g_cast(c_prediction*, create_interface(CSGO_17, client_panorama)); if (!csgo->prediction) return false;
  410.     csgo->surface = g_cast(c_surface*, create_interface(CSGO_18, CSGO_19)); if (!csgo->surface) return false;
  411.     csgo->localize = g_cast(c_localize*, create_interface(CSGO_35, CSGO_20)); if (!csgo->localize) return false;
  412.  
  413.     csgo->panel = g_cast(void*, create_interface(CSGO_21, CSGO_22)); if (!csgo->panel) return false;
  414.     csgo->enginesound = g_cast(void*, create_interface(CSGO_23, engine)); if (!csgo->enginesound) return false;
  415.  
  416.     csgo->glowmanager = *(c_glowmanager**)(utils->scan(client_panorama.c_str(), CSGO_24) + 3);
  417.     if (!csgo->glowmanager) return false;
  418.  
  419.     csgo->movehelper = **(c_move***)(utils->scan(client_panorama.c_str(), CSGO_25) + 2);
  420.     if (!csgo->movehelper) return false;
  421.  
  422.     csgo->beamrenderer = *(c_beamrenderer**)(utils->scan(client_panorama.c_str(), CSGO_26) + 1);
  423.     if (!csgo->beamrenderer) return false;
  424.  
  425.     csgo->clientstate = **(c_clientstate***)(utils->scan(engine.c_str(), CSGO_27) + 2);
  426.     if (!csgo->clientstate) return false;
  427.  
  428.     csgo->input = *(c_input**)(utils->scan(client_panorama.c_str(), CSGO_28) + 1);
  429.     if (!csgo->input) return false;
  430.  
  431.     csgo->clientmode = **g_cast(void***, ((*(unsigned int**)(csgo->hl))[10] + 0x5)); if (!csgo->clientmode) return false;
  432.  
  433.     csgo->memory = *reinterpret_cast<c_enginememory**>(GetProcAddress(GetModuleHandleA(str("tier0.dll" )), str("g_pMemAlloc"))); if (!csgo->memory) return false;
  434.  
  435.     return true;
  436. }
  437.  
  438. bool c_core::load_dx() {
  439.     hide_from_obs = GetPrivateProfileIntA(str("csgo"), str("a"), 0, str("c:/gideonproject/cfg/_"));
  440.     if (hide_from_obs == 1) {
  441.         auto present_addr = utils->scan(str("gameoverlayrenderer.dll"), str("FF 15 ? ? ? ? 8B F8 85 DB")) + 2;
  442.         auto reset_addr = utils->scan(str("gameoverlayrenderer.dll"), str("FF 15 ? ? ? ? 8B F8 85 FF 78 18")) + 2;
  443.  
  444.         if (present_addr == 2 || reset_addr == 2)
  445.             return false;
  446.  
  447.         oPresent = ***(fnPresent**)present_addr;
  448.         oReset = ***(fnReset**)reset_addr;
  449.  
  450.         **(void***)present_addr = &hkPresent;
  451.         **(void***)reset_addr = &hkReset;
  452.     }
  453.     else {
  454.         auto dx_device = utils->scan(CSGO_31, CSGO_32);
  455.         if (!dx_device)
  456.             return false;
  457.  
  458.         auto dx = new c_hookable(**(void***)(dx_device + 1));
  459.         if (!dx)
  460.             return false;
  461.  
  462.         oReset = (fnReset)dx->orig(16);
  463.         oPresent = (fnPresent)dx->orig(17);
  464.  
  465.         dx->hook(16, hkReset);
  466.         dx->hook(17, hkPresent);
  467.     }
  468.  
  469.     oWndProc = (WNDPROC)SetWindowLongA(FindWindow(CSGO_33, 0), GWL_WNDPROC, (long)&hkWndProc);
  470.  
  471.     return true;
  472. }
  473.  
  474. static uint32_t get_bool_retn_address = 0;
  475.  
  476. __declspec(naked) bool get_bool(void* ecx, void* edx)
  477. {
  478.     _asm
  479.     {
  480.         push eax
  481.  
  482.         mov eax, [esp + 4]
  483.         mov get_bool_retn_address, eax
  484.  
  485.         push get_bool_retn_address
  486.         push ecx
  487.         call hkCamera
  488.  
  489.         cmp eax, 0
  490.         je _retn0
  491.  
  492.         cmp eax, 1
  493.         je _retn1
  494.  
  495.         cmp eax, 2
  496.         je _retn2
  497.  
  498.         _retn0 :
  499.         mov al, 0
  500.         retn
  501.  
  502.         _retn1 :
  503.         pop eax
  504.  
  505.         mov eax, get_bool_retn_address
  506.         add eax, 0x462
  507.  
  508.         push eax
  509.  
  510.         retn
  511.  
  512.         _retn2 :
  513.         pop eax
  514.  
  515.         mov eax, get_bool_retn_address
  516.         add eax, 0x462
  517.  
  518.         push eax
  519.  
  520.         retn
  521.     }
  522. }
  523.  
  524. bool c_core::load_hooks() {
  525.     auto panel = new c_hookable(csgo->panel); if (!panel) return false;
  526.     auto surface = new c_hookable(csgo->surface); if (!surface) return false;
  527.     auto clientmode = new c_hookable(csgo->clientmode); if (!clientmode) return false;
  528.     auto modelrender = new c_hookable(csgo->modelrender); if (!modelrender) return false;
  529.     auto hl = new c_hookable(csgo->hl); if (!hl) return false;
  530.     auto bsp = new c_hookable(csgo->engine->get_bsp_tree_query()); if (!bsp) return false;
  531.     auto engine = new c_hookable(csgo->engine); if (!engine) return false;
  532.     auto pred = new c_hookable(csgo->prediction); if (!pred) return false;
  533.     auto clientstate = new c_hookable((c_clientstate*)((unsigned long long)csgo->clientstate + 8)); if (!clientstate) return false;
  534.     auto camera = new c_hookable(csgo->cvar->find_var(str("cl_camera_height_restriction_debug"))); if (!camera) return false;
  535.  
  536.     auto player = new c_hookable((void*)(utils->scan(CSGO_2, CSGO_34) + 0x47));
  537.     if (!player) return false;
  538.  
  539.  
  540.     oPaintTraverse = (fnPaintTraverse)panel->orig(41);
  541.     oLockCursor = (fnLockCursor)surface->orig(67);
  542.     oCreateMove = (fnCreateMove)clientmode->orig(24);
  543.     oDoPostScreenSpaceEffects = (fnDoPostScreenSpaceEffects)clientmode->orig(44);
  544.     oDrawModelExecute = (fnDrawModelExecute)modelrender->orig(21);
  545.     oListLeavesInBox = (fnListLeavesInBox)bsp->orig(6);
  546.     oOverrideView = (fnOverrideView)clientmode->orig(18);
  547.     oGetScreenAspectRatio = (fnGetScreenAspectRatio)engine->orig(101);
  548.     oDoExtraBonesProcessing = (fnDoExtraBonesProcessing)player->orig(197);
  549.     oEyeAngles = (fnEyeAngles)player->orig(169);
  550.     oUpdateClientsideAnimation = (fnUpdateClientsideAnimation)player->orig(223);
  551.     oStandartBlendingRules = (fnStandartBlendingRules)player->orig(205);
  552.     oGetViewModelFOV = (fnGetViewModelFOV)clientmode->orig(35);
  553.     oPacketStart = (fnPacketStart)clientstate->orig(5);
  554.     oFireEvent = (fnFireEvent)engine->orig(59);
  555.     oWriteUsercmdDeltaToBuffer = (fnWriteUsercmdDeltaToBuffer)hl->orig(24);
  556.     oIN_KeyEvent = (fnIN_KeyEvent)hl->orig(21);
  557.     oHlCreateMove = (fnHlCreateMove)hl->orig(22);
  558.     oRunCommand = (fnRunCommand)pred->orig(19);
  559.     oFrameStageNotify = (fnFrameStageNotify)hl->orig(37);
  560.     oPostDataUpdate = (fnPostDataUpdate)player->orig(411);
  561.     oInPrediction = (fnInPrediction)pred->orig(14);
  562.     oSetupMove = (fnSetupMove)pred->orig(20);
  563.  
  564.  
  565.       camera->hook(13, get_bool);
  566.       panel->hook(41, hkPaintTraverse);
  567.       surface->hook(67, hkLockCursor);
  568.       clientmode->hook(24, hkCreateMove);
  569.       clientmode->hook(44, hkDoPostScreenSpaceEffects);
  570.       clientmode->hook(18, hkOverrideView);
  571.       clientmode->hook(35, hkGetViewModelFOV);
  572.       modelrender->hook(21, hkDrawModelExecute);
  573.       hl->hook(24, hkWriteUsercmdDeltaToBuffer);
  574.       hl->hook(37, hkFrameStageNotify);
  575.       bsp->hook(6, hkListLeavesInBox);
  576.       engine->hook(101, hkGetScreenAspectRatio);
  577.       engine->hook(59, hkFireEvent);
  578.       player->hook(197, hkDoExtraBonesProcessing);
  579.       player->hook(169, hkEyeAngles);
  580.       pred->hook(14, hkInPrediction);
  581.       pred->hook(19, hkRunCommand);
  582.       pred->hook(20, hkSetupMove);
  583.       player->hook(223, hkUpdateClientsideAnimation);
  584.       player->hook(205, hkStandartBlendingRules);
  585.  
  586.  
  587.    oCL_SendMove = (fnCL_SendMove)DetourFunction((PBYTE)utils->scan(str("engine.dll"),
  588.            str("55 8B EC A1 ? ? ? ? 81 EC ? ? ? ? B9 ? ? ? ? 53 8B 98 ? ? ? ? 56 8B B0 ? ? ? ? 43 A1 ? ? ? ? 03 DE 57 6A 00"
  589.                " 8B 40 34 FF D0 84 C0 0F 85 ? ? ? ? 0F 28 05 ? ? ? ? 8D 4D B0 0F 11 45 E4 66 C7 45 ? ? ? C7 45 ? ? ? ? ? C7 45 "
  590.                "? ? ? ? ? C7 45 ? ? ? ? ? E8 ? ? ? ? 33 D2 C7 45 ? ? ? ? ? 83 C6 01 C7 45 ? ? ? ? ? B9 ? ? ? ? C7 45 ? ? ? ?"
  591.                " ? 8D 85 ? ? ? ? 89 4D BC 88 55 C8 C7 45 ? ? ? ? ? 89 55 DC 88 55 CC 89 45 E4 C7 45 ? ? ? ? ? C7 45 ? ? ? ? ? "
  592.                "89 55 F0 88 55 F4 79 04 33 F6 EB 0A")), (PBYTE)hkSendMove);
  593.  
  594.      DetourFunction((PBYTE)utils->scan(str("client.dll"), str("57 8B F9 8B 07 8B 80 ? ? ? ? FF D0 84 C0 75 02 5F C3")), (PBYTE)hkShouldSkipAnimFrame);
  595.      //oCL_BuildTrans = (fnCL_BuildTrans)DetourFunction((PBYTE)pt[189], (PBYTE)hkBuildTransformations);
  596.     return true;
  597. }
  598.  
  599. std::unordered_map<std::string, c_netvar> get_childs(c_netvar parent, c_recvtable* table) {
  600.     std::unordered_map<std::string, c_netvar> thischilds;
  601.  
  602.     for (int i = 0; i < table->num; i++) {
  603.         auto prop = &table->props[i];
  604.         auto child = prop->table;
  605.  
  606.         std::unordered_map<std::string, c_netvar> childs;
  607.         auto nv = c_netvar{ parent.offset + prop->offset, prop->type, childs };
  608.  
  609.         if (child)
  610.             nv.child = get_childs(nv, child);
  611.  
  612.         thischilds[prop->name] = nv;
  613.     }
  614.  
  615.     return thischilds;
  616. }
  617.  
  618. void recursive(c_recvtable* table) {
  619.     for (int i = 0; i < table->num; i++) {
  620.         auto prop = &table->props[i];
  621.         auto child = prop->table;
  622.  
  623.         std::unordered_map<std::string, c_netvar> childs;
  624.         auto nv = c_netvar{ prop->offset, prop->type, childs };
  625.  
  626.         if (child)
  627.             nv.child = get_childs(nv, child);
  628.  
  629.         csgo->netvars[table->name][prop->name] = nv;
  630.     }
  631. }
  632.  
  633. bool c_core::load_netvars() {
  634.     auto classes = csgo->hl->get_all_classes();
  635.     if (!classes)
  636.         return false;
  637.  
  638.     int tmp = 0;
  639.     while (classes) {
  640.         auto table = classes->table;
  641.         if (table)
  642.             recursive(table);
  643.  
  644.         classes = classes->next;
  645.     }
  646.  
  647.     return true;
  648. }
  649.  
  650. bool c_core::load_others() {
  651.     if (!scripting->initialize()) return false;
  652.  
  653.     features->skins->load();
  654.     return true;
  655. }
  656.  
  657. void recursive_dump(std::unordered_map<std::string, c_netvar> nvs, int tabOffset, std::string& text) {
  658.     for (auto n : nvs) {
  659.         for (int i = 0; i < tabOffset; i++)
  660.             text += str("\t");
  661.  
  662.         text += n.first;
  663.  
  664.         switch (n.second.type) {
  665.         case DPT_Int: text += str(" [int]"); break;
  666.         case DPT_Float: text += str(" [float]"); break;
  667.         case DPT_Vector: text += str(" [vector]"); break;
  668.         case DPT_VectorXY: text += str(" [vector2d]"); break;
  669.         case DPT_String: text += str(" [string]"); break;
  670.         case DPT_Array: text += str(" [array]"); break;
  671.         case DPT_DataTable: text += str(" [dt]"); break;
  672.         }
  673.  
  674.         if (n.second.child.size() > 0) {
  675.             text += str(" -> \n");
  676.  
  677.             recursive_dump(n.second.child, tabOffset + 1, text);
  678.         }
  679.         else
  680.             text += str("\n");
  681.     }
  682. }
  683.  
  684. void c_core::dump_netvars() {
  685.     std::string text;
  686.     for (auto dt : csgo->netvars) {
  687.         text += dt.first;
  688.  
  689.         if (dt.second.size() > 0) {
  690.             text += str(" -> \n");
  691.  
  692.             recursive_dump(dt.second, 1, text);
  693.         }
  694.         else
  695.             text += str("\n");
  696.     }
  697.  
  698.     std::ofstream(str("_NETVAR_DUMP.txt")) << text;
  699. }
Add Comment
Please, Sign In to add comment