From 2d5f7d0da410c3385d1be8ec9e7e78b441388301 Mon Sep 17 00:00:00 2001 From: MisterY52 <11368116+MisterY52@users.noreply.github.com> Date: Tue, 6 Oct 2020 17:20:51 +0200 Subject: [PATCH] Update - Added glow players - Added an option to toggle no recoil/sway --- apex_dma/Game.cpp | 27 ++++++++++++- apex_dma/Game.h | 3 ++ apex_dma/apex_dma.cpp | 60 +++++++++++++++++++++++++++- apex_guest/Client/Client/main.cpp | 18 +++++---- apex_guest/Client/Client/overlay.cpp | 59 ++++++++++++++------------- apex_guest/Client/Client/overlay.h | 11 +---- 6 files changed, 131 insertions(+), 47 deletions(-) diff --git a/apex_dma/Game.cpp b/apex_dma/Game.cpp index 6bc2c07..422eef4 100644 --- a/apex_dma/Game.cpp +++ b/apex_dma/Game.cpp @@ -1,6 +1,7 @@ #include "prediction.h" extern bool firing_range; float smooth = 12.0f; +bool aim_no_recoil = true; uint64_t Entity::Observing(WinProcess& mem, uint64_t entitylist) { @@ -93,6 +94,27 @@ Vector Entity::GetViewAnglesV() return *(Vector*)(buffer + OFFSET_VIEWANGLES); } +bool Entity::isGlowing() +{ + return *(int*)(buffer + OFFSET_GLOW_ENABLE) == 7; +} + +void Entity::enableGlow(WinProcess& mem) +{ + mem.Write(ptr + OFFSET_GLOW_T1, 16256); + mem.Write(ptr + OFFSET_GLOW_T2, 1193322764); + mem.Write(ptr + OFFSET_GLOW_ENABLE, 7); + mem.Write(ptr + OFFSET_GLOW_THROUGH_WALLS, 2); +} + +void Entity::disableGlow(WinProcess& mem) +{ + mem.Write(ptr + OFFSET_GLOW_T1, 0); + mem.Write(ptr + OFFSET_GLOW_T2, 0); + mem.Write(ptr + OFFSET_GLOW_ENABLE, 2); + mem.Write(ptr + OFFSET_GLOW_THROUGH_WALLS, 5); +} + void Entity::SetViewAngles(WinProcess& mem, SVector angles) { mem.Write(ptr + OFFSET_VIEWANGLES, angles); @@ -115,7 +137,7 @@ QAngle Entity::GetRecoil() bool Item::isItem() { - return *(int*)(buffer + OFFSET_ITEM_GLOW) >= 1358917120 && *(int*)(buffer + OFFSET_ITEM_GLOW) <= 1646297344; + return *(int*)(buffer + OFFSET_ITEM_GLOW) >= 1358917120 && *(int*)(buffer + OFFSET_ITEM_GLOW) <= 1696628992; } bool Item::isGlowing() @@ -215,7 +237,8 @@ QAngle CalculateBestBoneAim(WinProcess& mem, Entity& from, uintptr_t t, float ma QAngle ViewAngles = from.GetViewAngles(); QAngle SwayAngles = from.GetSwayAngles(); //remove sway and recoil - CalculatedAngles-=SwayAngles-ViewAngles; + if(aim_no_recoil) + CalculatedAngles-=SwayAngles-ViewAngles; Math::NormalizeAngles(CalculatedAngles); QAngle Delta = CalculatedAngles - ViewAngles; double fov = Math::GetFov(SwayAngles, CalculatedAngles); diff --git a/apex_dma/Game.h b/apex_dma/Game.h index d72a60a..e24bea2 100644 --- a/apex_dma/Game.h +++ b/apex_dma/Game.h @@ -29,6 +29,7 @@ public: int getTeamId(); int getHealth(); int getShield(); + bool isGlowing(); Vector getAbsVelocity(); QAngle GetSwayAngles(); QAngle GetViewAngles(); @@ -36,6 +37,8 @@ public: QAngle GetRecoil(); Vector GetViewAnglesV(); + void enableGlow(WinProcess& mem); + void disableGlow(WinProcess& mem); void SetViewAngles(WinProcess& mem, SVector angles); void SetViewAngles(WinProcess& mem, QAngle& angles); Vector getBonePosition(WinProcess& mem, int id); diff --git a/apex_dma/apex_dma.cpp b/apex_dma/apex_dma.cpp index 279772f..6ab5561 100644 --- a/apex_dma/apex_dma.cpp +++ b/apex_dma/apex_dma.cpp @@ -30,6 +30,8 @@ int toRead = 100; int aim = false; bool esp = false; bool item_glow = false; +bool player_glow = false; +extern bool aim_no_recoil; int safe_level = 0; bool aiming = false; extern float smooth; @@ -176,6 +178,15 @@ void DoActions(WinProcess& mem) continue; } + if(player_glow && !Target.isGlowing()) + { + Target.enableGlow(mem); + } + else if(!player_glow && Target.isGlowing()) + { + Target.disableGlow(mem); + } + ProcessPlayer(mem, LPlayer, Target, entitylist, c); c++; } @@ -193,8 +204,49 @@ void DoActions(WinProcess& mem) { continue; } - + ProcessPlayer(mem, LPlayer, Target, entitylist, i); + + int entity_team = Target.getTeamId(); + if (entity_team == team_player) + { + continue; + } + + switch (safe_level) + { + case 1: + if (spectators > 0) + { + if(!player_glow && Target.isGlowing()) + { + Target.disableGlow(mem); + } + continue; + } + break; + case 2: + if (spectators+allied_spectators > 0) + { + if(!player_glow && Target.isGlowing()) + { + Target.disableGlow(mem); + } + continue; + } + break; + default: + break; + } + + if(player_glow && !Target.isGlowing()) + { + Target.enableGlow(mem); + } + else if(!player_glow && Target.isGlowing()) + { + Target.disableGlow(mem); + } } } spectators = tmp_spec; @@ -505,7 +557,9 @@ static void set_vars(WinProcess& mem, uint64_t add_addr) uint64_t valid_addr = mem.Read(add_addr + sizeof(uint64_t)*9); uint64_t max_dist_addr = mem.Read(add_addr + sizeof(uint64_t)*10); uint64_t item_glow_addr = mem.Read(add_addr + sizeof(uint64_t)*11); - uint64_t smooth_addr = mem.Read(add_addr + sizeof(uint64_t)*12); + uint64_t player_glow_addr = mem.Read(add_addr + sizeof(uint64_t)*12); + uint64_t aim_no_recoil_addr = mem.Read(add_addr + sizeof(uint64_t)*13); + uint64_t smooth_addr = mem.Read(add_addr + sizeof(uint64_t)*14); if(mem.Read(spec_addr)!=1) { @@ -532,6 +586,8 @@ static void set_vars(WinProcess& mem, uint64_t add_addr) aiming = mem.Read(aiming_addr); max_dist = mem.Read(max_dist_addr); item_glow = mem.Read(item_glow_addr); + player_glow = mem.Read(player_glow_addr); + aim_no_recoil = mem.Read(aim_no_recoil_addr); smooth = mem.Read(smooth_addr); if(esp && next) diff --git a/apex_guest/Client/Client/main.cpp b/apex_guest/Client/Client/main.cpp index f810dcf..a84d1b5 100644 --- a/apex_guest/Client/Client/main.cpp +++ b/apex_guest/Client/Client/main.cpp @@ -26,15 +26,17 @@ int aim = 0; //read bool esp = false; //read int safe_level = 0; //read bool item_glow = false; +bool player_glow = false; +bool aim_no_recoil = true; bool aiming = false; //read uint64_t g_Base = 0; //write -float max_dist = 200.0f*40.0f; //read +float max_dist = 200.0f * 40.0f; //read float smooth = 12.0f; bool valid = false; //write bool next = false; //read write -uint64_t add[13]; +uint64_t add[15]; bool k_f5 = 0; bool k_f6 = 0; @@ -70,7 +72,7 @@ void Overlay::RenderEsp() { std::string distance = std::to_string(players[i].dist / 39.62); distance = distance.substr(0, distance.find('.')) + "m(" + std::to_string(players[i].entity_team) + ")"; - + if (v.box) { if (players[i].visible) @@ -86,7 +88,7 @@ void Overlay::RenderEsp() } } - if(v.line) + if (v.line) DrawLine(ImVec2((float)(getWidth() / 2), (float)getHeight()), ImVec2(players[i].b_x, players[i].b_y), BLUE, 1); //LINE FROM MIDDLE SCREEN if (v.distance) @@ -123,7 +125,9 @@ int main(int argc, char** argv) add[9] = (uintptr_t)&valid; add[10] = (uintptr_t)&max_dist; add[11] = (uintptr_t)&item_glow; - add[12] = (uintptr_t)&smooth; + add[12] = (uintptr_t)&player_glow; + add[13] = (uintptr_t)&aim_no_recoil; + add[14] = (uintptr_t)&smooth; printf("add offset: 0x%I64x\n", (uint64_t)&add[0] - (uint64_t)GetModuleHandle(NULL)); Overlay ov1 = Overlay(); ov1.Start(); @@ -142,7 +146,7 @@ int main(int argc, char** argv) ready = true; printf("Ready\n"); } - + while (active) { std::this_thread::sleep_for(std::chrono::milliseconds(1)); @@ -238,7 +242,7 @@ int main(int argc, char** argv) } ready = false; ov1.Clear(); - if(!use_nvidia) + if (!use_nvidia) system("taskkill /F /T /IM overlay_ap.exe"); //custom overlay process name return 0; } diff --git a/apex_guest/Client/Client/overlay.cpp b/apex_guest/Client/Client/overlay.cpp index 18c817a..116663c 100644 --- a/apex_guest/Client/Client/overlay.cpp +++ b/apex_guest/Client/Client/overlay.cpp @@ -3,6 +3,8 @@ extern int aim; extern bool esp; extern bool item_glow; +extern bool player_glow; +extern bool aim_no_recoil; extern bool ready; extern bool use_nvidia; extern int safe_level; @@ -42,10 +44,10 @@ BOOL CALLBACK EnumWindowsCallback(HWND hwnd, LPARAM lParam) { if (wcscmp(L"CEF-OSC-WIDGET", className) == 0) //Nvidia overlay { - Process_Informations* proc = (Process_Informations*)lParam; + HWND* w = (HWND*)lParam; if (GetWindowLong(hwnd, GWL_STYLE) != nv_default && GetWindowLong(hwnd, GWL_STYLE) != nv_default_in_game) return TRUE; - proc->overlayHWND = hwnd; + *w = hwnd; return TRUE; } } @@ -53,8 +55,8 @@ BOOL CALLBACK EnumWindowsCallback(HWND hwnd, LPARAM lParam) { if (wcscmp(L"overlay", className) == 0) //Custom overlay { - Process_Informations* proc = (Process_Informations*)lParam; - proc->overlayHWND = hwnd; + HWND* w = (HWND*)lParam; + *w = hwnd; return TRUE; } } @@ -114,7 +116,7 @@ void Overlay::RenderMenu() all_spec_disable = false; } ImGui::SetNextWindowPos(ImVec2(0, 0)); - ImGui::SetNextWindowSize(ImVec2(490, 240)); + ImGui::SetNextWindowSize(ImVec2(490, 250)); ImGui::Begin("##title", (bool*)true, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar); if (ImGui::BeginTabBar("Tab")) { @@ -147,6 +149,8 @@ void Overlay::RenderMenu() { ImGui::SameLine(); ImGui::Checkbox("Visibility check", &vis_check); + ImGui::SameLine(); + ImGui::Checkbox("No recoil/sway", &aim_no_recoil); if (vis_check) { aim = 2; @@ -162,6 +166,7 @@ void Overlay::RenderMenu() } ImGui::Checkbox("Glow items", &item_glow); + ImGui::Checkbox("Glow players", &player_glow); ImGui::Text("Max distance:"); ImGui::SliderFloat("##1", &max_dist, 100.0f * 40, 800.0f * 40, "%.2f"); @@ -221,20 +226,20 @@ void Overlay::ClickThrough(bool v) if (v) { nv_edit = nv_default_in_game | WS_VISIBLE; - SetWindowLong(proc.overlayHWND, GWL_EXSTYLE, nv_ex_edit); + SetWindowLong(overlayHWND, GWL_EXSTYLE, nv_ex_edit); } else { nv_edit = nv_default | WS_VISIBLE; - SetWindowLong(proc.overlayHWND, GWL_EXSTYLE, nv_ex_edit_menu); + SetWindowLong(overlayHWND, GWL_EXSTYLE, nv_ex_edit_menu); } } DWORD Overlay::CreateOverlay() { - EnumWindows(EnumWindowsCallback, (LPARAM)&proc); + EnumWindows(EnumWindowsCallback, (LPARAM)&overlayHWND); Sleep(300); - if (proc.overlayHWND == 0) + if (overlayHWND == 0) { printf("Can't find the overlay\n"); Sleep(1000); @@ -244,19 +249,19 @@ DWORD Overlay::CreateOverlay() HDC hDC = ::GetWindowDC(NULL); width = ::GetDeviceCaps(hDC, HORZRES); height = ::GetDeviceCaps(hDC, VERTRES); - + running = true; // Initialize Direct3D - if (!CreateDeviceD3D(proc.overlayHWND)) + if (!CreateDeviceD3D(overlayHWND)) { CleanupDeviceD3D(); return 1; } // Show the window - ::ShowWindow(proc.overlayHWND, SW_SHOWDEFAULT); - ::UpdateWindow(proc.overlayHWND); + ::ShowWindow(overlayHWND, SW_SHOWDEFAULT); + ::UpdateWindow(overlayHWND); // Setup Dear ImGui context IMGUI_CHECKVERSION(); @@ -267,7 +272,7 @@ DWORD Overlay::CreateOverlay() ImGui::StyleColorsDark(); // Setup Platform/Renderer bindings - ImGui_ImplWin32_Init(proc.overlayHWND); + ImGui_ImplWin32_Init(overlayHWND); ImGui_ImplDX9_Init(g_pd3dDevice); ImVec4 clear_color = ImVec4(0.0f, 0.0f, 0.0f, 0.00f); @@ -281,10 +286,10 @@ DWORD Overlay::CreateOverlay() HWND wnd = GetWindow(GetForegroundWindow(), GW_HWNDPREV); if (use_nvidia) { - if (GetWindowLong(proc.overlayHWND, GWL_STYLE) != nv_edit) - SetWindowLong(proc.overlayHWND, GWL_STYLE, nv_edit); - if (GetWindowLong(proc.overlayHWND, GWL_EXSTYLE) != nv_ex_edit) - SetWindowLong(proc.overlayHWND, GWL_EXSTYLE, nv_ex_edit); + if (GetWindowLong(overlayHWND, GWL_STYLE) != nv_edit) + SetWindowLong(overlayHWND, GWL_STYLE, nv_edit); + if (GetWindowLong(overlayHWND, GWL_EXSTYLE) != nv_ex_edit) + SetWindowLong(overlayHWND, GWL_EXSTYLE, nv_ex_edit); if (show_menu) { ClickThrough(false); @@ -294,10 +299,10 @@ DWORD Overlay::CreateOverlay() ClickThrough(true); } } - if (wnd != proc.overlayHWND) + if (wnd != overlayHWND) { - SetWindowPos(proc.overlayHWND, wnd, 0, 0, 0, 0, SWP_ASYNCWINDOWPOS | SWP_NOMOVE | SWP_NOSIZE); - ::UpdateWindow(proc.overlayHWND); + SetWindowPos(overlayHWND, wnd, 0, 0, 0, 0, SWP_ASYNCWINDOWPOS | SWP_NOMOVE | SWP_NOSIZE); + ::UpdateWindow(overlayHWND); } if (::PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE)) @@ -337,11 +342,11 @@ DWORD Overlay::CreateOverlay() k_ins = true; } else if (!IsKeyDown(VK_INSERT) && k_ins) - { + { k_ins = false; } - - if(show_menu) + + if (show_menu) RenderMenu(); else RenderInfo(); @@ -371,7 +376,7 @@ DWORD Overlay::CreateOverlay() ClickThrough(true); CleanupDeviceD3D(); - ::DestroyWindow(proc.overlayHWND); + ::DestroyWindow(overlayHWND); return 0; } @@ -387,8 +392,8 @@ void Overlay::Clear() Sleep(50); if (use_nvidia) { - SetWindowLong(proc.overlayHWND, GWL_STYLE, nv_default); - SetWindowLong(proc.overlayHWND, GWL_EXSTYLE, nv_ex_default); + SetWindowLong(overlayHWND, GWL_STYLE, nv_default); + SetWindowLong(overlayHWND, GWL_EXSTYLE, nv_ex_default); } } diff --git a/apex_guest/Client/Client/overlay.h b/apex_guest/Client/Client/overlay.h index 7aaecbc..b389859 100644 --- a/apex_guest/Client/Client/overlay.h +++ b/apex_guest/Client/Client/overlay.h @@ -11,7 +11,6 @@ #include #include #include -#include #include "imgui/imgui.h" #include "imgui/imgui_impl_dx9.h" #include "imgui/imgui_impl_win32.h" @@ -25,11 +24,6 @@ #define ORANGE ImColor(255, 165, 0) #define WHITE ImColor(255, 255, 255) -struct Process_Informations -{ - HWND overlayHWND; -}; - typedef struct visuals { bool box = true; @@ -59,6 +53,5 @@ public: void String(ImVec2 pos, ImColor color, const char* text); private: bool running; - Process_Informations proc; -}; - + HWND overlayHWND; +}; \ No newline at end of file