From 69ba735d9639556a4988fbed45d0232537318355 Mon Sep 17 00:00:00 2001 From: ALittlePatate Date: Sun, 2 Oct 2022 19:07:31 +0200 Subject: [PATCH] add: player esp fix: many stuff --- DevourClient/Callbacks/OnUpdate.cpp | 10 ++++- DevourClient/DevourClient.vcxproj | 2 + DevourClient/Features/ESP/ESP.cpp | 48 ++++++++++++++++++++++++ DevourClient/Features/ESP/ESP.hpp | 5 +++ DevourClient/Features/Misc/Misc.cpp | 8 +++- DevourClient/Utils/Players/Players.cpp | 2 +- DevourClient/Utils/Settings/Settings.cpp | 1 + DevourClient/Utils/Settings/Settings.hpp | 1 + DevourClient/dllmain.cpp | 2 + 9 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 DevourClient/Features/ESP/ESP.cpp create mode 100644 DevourClient/Features/ESP/ESP.hpp diff --git a/DevourClient/Callbacks/OnUpdate.cpp b/DevourClient/Callbacks/OnUpdate.cpp index 35ed502..8607305 100644 --- a/DevourClient/Callbacks/OnUpdate.cpp +++ b/DevourClient/Callbacks/OnUpdate.cpp @@ -21,6 +21,12 @@ void OnUpdate() { if (settings::server_name_spoof) { Misc::SetServerName(settings::server_name); } - - Misc::UnlimitedUV(settings::unlimited_uv); + if (settings::unlimited_uv) { + settings::unlimited_uv_reset = true; + Misc::UnlimitedUV(settings::unlimited_uv); + } + if (!settings::unlimited_uv && settings::unlimited_uv_reset) { + Misc::UnlimitedUV(false); + settings::unlimited_uv_reset = false; + } } \ No newline at end of file diff --git a/DevourClient/DevourClient.vcxproj b/DevourClient/DevourClient.vcxproj index 2e9feb0..50b919a 100644 --- a/DevourClient/DevourClient.vcxproj +++ b/DevourClient/DevourClient.vcxproj @@ -303,6 +303,7 @@ + @@ -346,6 +347,7 @@ + diff --git a/DevourClient/Features/ESP/ESP.cpp b/DevourClient/Features/ESP/ESP.cpp new file mode 100644 index 0000000..fd20884 --- /dev/null +++ b/DevourClient/Features/ESP/ESP.cpp @@ -0,0 +1,48 @@ +#include "ESP.hpp" +#include "../../Utils/Settings/Settings.hpp" +#include "../../Utils/Players/Players.hpp" +#include "../../Dependencies/IL2CPP_Resolver/il2cpp_resolver.hpp" + +#include "../../Utils/Output/Output.hpp" + +void ESP::PlayerESP() { + IL2CPP::Thread::Attach(IL2CPP::Domain::Get()); + while (1) { + if (settings::player_esp || settings::player_snaplines) { + for (Unity::CGameObject* player : Players::PlayerList) { + if (!player) { + continue; + } + + Unity::Vector3 pivotPos = player->GetComponent("Transform")->GetMemberValue("position"); + + Unity::Vector3 playerFootPos; + playerFootPos.x = pivotPos.x; + playerFootPos.z = pivotPos.z; + playerFootPos.y = pivotPos.y - 2.f; //At the feet + + Unity::Vector3 playerHeadPos; + playerHeadPos.x = pivotPos.x; + playerHeadPos.z = pivotPos.z; + playerHeadPos.y = pivotPos.y + 2.f; //At the head + + Unity::CGameObject* Camera = Unity::GameObject::Find("Camera"); + if (!Camera) { + continue; + } + + Unity::CComponent* CameraMain = Camera->GetComponent("Camera"); + if (!CameraMain) { + continue; + } + + std::vector fields; + CameraMain->FetchFields(&fields); + + for (Unity::il2cppFieldInfo* field : fields) { + print("--> %s\n", field->m_pName); + } + } + } + } +} \ No newline at end of file diff --git a/DevourClient/Features/ESP/ESP.hpp b/DevourClient/Features/ESP/ESP.hpp new file mode 100644 index 0000000..12690dc --- /dev/null +++ b/DevourClient/Features/ESP/ESP.hpp @@ -0,0 +1,5 @@ +#pragma once + +namespace ESP { + void PlayerESP(); +} \ No newline at end of file diff --git a/DevourClient/Features/Misc/Misc.cpp b/DevourClient/Features/Misc/Misc.cpp index 77df613..0842e64 100644 --- a/DevourClient/Features/Misc/Misc.cpp +++ b/DevourClient/Features/Misc/Misc.cpp @@ -1,8 +1,13 @@ #include "Misc.hpp" #include "../../Utils/Output/Output.hpp" +#include void Misc::SetRank(int rank) { - Players::LocalPlayer->GetComponent("NolanRankController")->CallMethodSafe("SetRank", rank); + Unity::CComponent* NolanRankController = Players::LocalPlayer->GetComponent("NolanRankController"); + if (!NolanRankController) { + return; + } + NolanRankController->CallMethodSafe("SetRank", rank); } void Misc::WalkInlobby(bool walk) { @@ -29,7 +34,6 @@ void Misc::UnlimitedUV(bool active) { } catch (...) { settings::unlimited_uv = false; - print("Unlimited UV error"); } } diff --git a/DevourClient/Utils/Players/Players.cpp b/DevourClient/Utils/Players/Players.cpp index acd0f92..2ed22e6 100644 --- a/DevourClient/Utils/Players/Players.cpp +++ b/DevourClient/Utils/Players/Players.cpp @@ -13,7 +13,7 @@ void Players::GetPlayersThread() { * Used as a "cache" - sorta * I use this instead of my good old corroutine */ - + IL2CPP::Thread::Attach(IL2CPP::Domain::Get()); while (1) { PlayerList.clear(); diff --git a/DevourClient/Utils/Settings/Settings.cpp b/DevourClient/Utils/Settings/Settings.cpp index 70f776f..cfbe48b 100644 --- a/DevourClient/Utils/Settings/Settings.cpp +++ b/DevourClient/Utils/Settings/Settings.cpp @@ -5,6 +5,7 @@ namespace settings { float flashlight_color[4] = { 255.f, 255.f, 255.f, 255.f }; bool unlimited_uv = false; + bool unlimited_uv_reset = true; bool fullbright = false; bool player_esp = false; diff --git a/DevourClient/Utils/Settings/Settings.hpp b/DevourClient/Utils/Settings/Settings.hpp index b01c5ce..2997030 100644 --- a/DevourClient/Utils/Settings/Settings.hpp +++ b/DevourClient/Utils/Settings/Settings.hpp @@ -9,6 +9,7 @@ namespace settings { extern float flashlight_color[4]; extern bool unlimited_uv; + extern bool unlimited_uv_reset; extern bool fullbright; extern bool player_esp; diff --git a/DevourClient/dllmain.cpp b/DevourClient/dllmain.cpp index e863915..2f494c9 100644 --- a/DevourClient/dllmain.cpp +++ b/DevourClient/dllmain.cpp @@ -9,6 +9,7 @@ #include "Utils/Output/Output.hpp" #include "Callbacks/OnUpdate.hpp" #include "Utils/Players/Players.hpp" +#include "Features/ESP/ESP.hpp" #include @@ -64,6 +65,7 @@ DWORD WINAPI Main() { IL2CPP::Callback::OnUpdate::Add(OnUpdate); CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Players::GetPlayersThread, 0, 0, 0); + CreateThread(0, 0, (LPTHREAD_START_ROUTINE)ESP::PlayerESP, 0, 0, 0); //running in a different thread to help performance return TRUE; }