main.cpp
#include <stdio.h>#include<cstdlib>#include<Windows.h>#include<iostream>#include<cmath>#include <GLFW/glfw3.h>#include "imgui/imgui.h"#include "imgui/imgui_impl_glfw.h"#include "imgui/imgui_impl_opengl3.h"#include "GetIMformation/GetIMformation.h"//声明外部变量extern DWORD g_process_id;extern HANDLE g_process_handle;extern UINT_PTR g_local_player;extern UINT_PTR g_player_list_address;extern UINT_PTR g_matrix_address;extern UINT_PTR g_angle_address;extern HWND g_game_hwnd;extern module_information engine_module;extern module_information client_module;extern module_information server_module;extern float g_client_width;extern float g_client_height;void DrawLine(Vec2& start, Vec2& end){glLineWidth(1.2);glBegin(GL_LINES);glColor4f(255, 255, 255, 100);glVertex2f(start.x, start.y);glVertex2f(end.x, end.y);glEnd();}void ShowMenu(GLFWwindow* Window){glfwSetWindowAttrib(Window, GLFW_MOUSE_PASSTHROUGH, GLFW_FALSE);}void HideMenu(GLFWwindow* Window){glfwSetWindowAttrib(Window, GLFW_MOUSE_PASSTHROUGH, GLFW_TRUE);}static void glfw_error_callback(int error, const char* description){fprintf(stderr, "Glfw Error %d: %s\n", error, description);}void GetWindowSize(){HDC hdc = GetDC(nullptr);g_client_width = GetDeviceCaps(hdc, DESKTOPHORZRES);g_client_height = GetDeviceCaps(hdc, DESKTOPVERTRES);ReleaseDC(nullptr, hdc);}int main(int, char**){/////////////////////////功能性代码////////////////////////////////////////////////////////////////////////////////////////////GetWindowSize();init_address("csgo.exe");UINT_PTR temp_address;/////////////////////////功能性代码////////////////////////////////////////////////////////////////////////////////////////////// Setup windowglfwSetErrorCallback(glfw_error_callback);if (!glfwInit())return 1;GLFWmonitor* monitor = glfwGetPrimaryMonitor();//###########################设置窗口###########################auto glsl_version = "#version 130";int Height = glfwGetVideoMode(monitor)->height;int Width = glfwGetVideoMode(monitor)->width;glfwWindowHint(GLFW_FLOATING, true);glfwWindowHint(GLFW_RESIZABLE, false);glfwWindowHint(GLFW_MAXIMIZED, true);glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, true);//###########################设置窗口###########################GLFWwindow* window = glfwCreateWindow(Width, Height, "titile", nullptr, nullptr);if (window == nullptr)return 1;glfwSetWindowAttrib(window, GLFW_DECORATED, false); //设置没有标题栏ShowWindow(GetConsoleWindow(), SW_HIDE);glfwMakeContextCurrent(window);glfwSwapInterval(1);IMGUI_CHECKVERSION();ImGui::CreateContext();ImGuiIO& io = ImGui::GetIO();(void)io;ImGui::StyleColorsDark();ImGui_ImplGlfw_InitForOpenGL(window, true);ImGui_ImplOpenGL3_Init(glsl_version);bool bMenuVisible = true;bool Dormant;int EntityTeamNum;int lifestate;int blood;int iTeamNum;float temp_pos[3];float Matrix[16];Vec2 LineOrigin;Vec2 ScreenCoord;Vec3 EntityLocation;LineOrigin.x = 0.0f;LineOrigin.y = -1.0f;UINT_PTR Entity;while (!glfwWindowShouldClose(window)){glfwPollEvents();glClear(GL_COLOR_BUFFER_BIT);ImGui_ImplOpenGL3_NewFrame();ImGui_ImplGlfw_NewFrame();ImGui::NewFrame();if (GetAsyncKeyState(VK_F11) & 1){bMenuVisible = !bMenuVisible;if (bMenuVisible)ShowMenu(window);elseHideMenu(window);}//界面设计if (bMenuVisible){ImGui::Text("USE F11 TO Hiden/Show");ImGui::Text("");if (ImGui::Button("exit")) return 0;}ReadProcessMemory(g_process_handle, (LPVOID)(client_module.module_address + dwLocalPlayer),&g_local_player, 4, nullptr);if(g_local_player!=0){ScreenCoord.x = 0.0f;ScreenCoord.y = -1.0f;g_angle_address = ReadMem<UINT_PTR>(g_process_handle, (engine_module.module_address + dwClientState), 4)+ dwClientState_ViewAngles;ReadProcessMemory(g_process_handle, (LPCVOID)(client_module.module_address + dwViewMatrix), Matrix,sizeof(float) * 16, nullptr);for (short int i = 0; i < 64; ++i){ReadProcessMemory(g_process_handle, (LPVOID)(client_module.module_address + dwLocalPlayer),&g_local_player, 4, nullptr);ReadProcessMemory(g_process_handle, (LPCVOID)(g_local_player + m_iTeamNum), &iTeamNum, 4, nullptr);//获取敌人实体ReadProcessMemory(g_process_handle, (LPCVOID)(client_module.module_address + dwEntityList + i * 0x10),&Entity, sizeof(float), nullptr);ReadProcessMemory(g_process_handle, (LPVOID)(Entity + m_bDormant), &Dormant, sizeof(bool), nullptr);ReadProcessMemory(g_process_handle, (LPVOID)(Entity + m_lifeState), &lifestate, 4, nullptr);ReadProcessMemory(g_process_handle, (LPCVOID)(Entity + m_iTeamNum), &EntityTeamNum, 4, nullptr);ReadProcessMemory(g_process_handle, (LPCVOID)(Entity + m_iHealth), &blood, 4, nullptr);if ((Entity == NULL) || (Entity == g_local_player) || (EntityTeamNum == iTeamNum) || (blood <= 0) ||lifestate || Dormant)continue;ReadProcessMemory(g_process_handle, (LPVOID)(Entity + m_vecOrigin), &temp_pos, 12, nullptr);EntityLocation.x = temp_pos[0], EntityLocation.y = temp_pos[1], EntityLocation.z = temp_pos[2];if (!WorldToScreen(EntityLocation, ScreenCoord, Matrix))continue;if (true){DrawLine(LineOrigin, ScreenCoord);}}}// RenderingImGui::Render();int display_w, display_h;glfwGetFramebufferSize(window, &display_w, &display_h);glViewport(0, 0, display_w, display_h);ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());glfwSwapBuffers(window);}// CleanupImGui_ImplOpenGL3_Shutdown();ImGui_ImplGlfw_Shutdown();ImGui::DestroyContext();glfwDestroyWindow(window);glfwTerminate();return 0;}
推荐阅读
- 投诉淘宝商家最管用的方法(淘宝商家最怕什么)
- 钩子 【pytest官方文档】解读-插件开发之hooks 函数
- 五 微软出品自动化神器【Playwright+Java】系列 之常见点击事件操作
- 爱国者手机u盘怎么用(爱国者的u盘使用方法)
- 手机,应如何正确使用(关于手机的正确用法)
- Object Detection 【YOLOv5】LabVIEW+YOLOv5快速实现实时物体识别含源码
- 不会游泳的人如何自学游泳(一般人如何学习游泳)
- 怎样在大海中游泳(在大海中怎么游泳)
- Java一次返回中国所有省市区三级树形级联+前端vue展示【200ms内】
- C++ 使用栈求解中缀、后缀表达式的值