Merge pull request #64 from JozielBorges/V2_recode

Temp fix for random crashes during the game while using ESP
This commit was merged in pull request #64.
This commit is contained in:
ALittlePatate
2024-07-17 15:52:12 +00:00
committed by GitHub
3 changed files with 70 additions and 21 deletions

View File

@@ -104,8 +104,19 @@ void ComputePositionAndDrawESP(app::Object_1__Array* ents, ImColor color, bool u
}
}
// TEMP FIX #60
app::Object_1__Array* ESP::RefreshEntList(app::Object_1__Array* ent, const char* className, const char* classNamespace) {
if (time_counter < time_refresh) return ent;
return Object::FindObjectsOfType(className, classNamespace);
}
void ESP::RunAzazelESP() {
app::GameObject__Array* ents = Object::FindGameObjectsWithTag("Azazel");
if (time_counter < (time_refresh - 1)) {
ents_azazel = Object::FindGameObjectsWithTag("Azazel");
}
app::GameObject__Array* ents = ents_azazel;
if (ents == NULL)
return;
@@ -140,10 +151,16 @@ void ESP::RunDemonESP() {
}
}
void ESP::RunItemsESP() {
ImColor col = ImColor{ settings::item_esp_color[0], settings::item_esp_color[1], settings::item_esp_color[2], settings::item_esp_color[3] };
app::Object_1__Array *ents = Object::FindObjectsOfType("SurvivalInteractable", "");
ents_item = RefreshEntList(ents_item, "SurvivalInteractable");
if (ents_item == nullptr) return;
app::Object_1__Array* ents = ents_item;
if (ents != nullptr || !Object::IsNull(ents->vector[0])) {
ComputePositionAndDrawESP(ents, col, true);
}
@@ -157,7 +174,8 @@ void ESP::RunItemsESP() {
}
void ESP::RunGoatsESP() {
app::Object_1__Array *goats = Object::FindObjectsOfType("GoatBehaviour", "");
app::Object_1__Array* goats = ESP::ents_goat;
if (goats == nullptr || Object::IsNull(goats->vector[0]))
return;

View File

@@ -2,7 +2,19 @@
#include "settings/settings.hpp"
namespace ESP {
// TEMP FIX #60
inline app::GameObject__Array* ents_azazel = NULL;
inline app::Object_1__Array* ents_item;
inline app::Object_1__Array* ents_goat;
inline int time_refresh = 100;
inline int time_counter = 0;
app::Object_1__Array* RefreshEntList(app::Object_1__Array* ent,const char* className, const char* classNamespace = "");
void RunPlayersESP();
void RunGoatsESP();
void RunItemsESP();

View File

@@ -94,6 +94,11 @@ typedef void(__stdcall* TNolanBehaviour_Update)(app::NolanBehaviour*, MethodInfo
TNolanBehaviour_Update oNolanBehaviour_Update = NULL;
void __stdcall hNolanBehaviour_Update(app::NolanBehaviour* __this, MethodInfo* method) {
// TEMP FIX #60
if (SceneName() != "Menu") {
ESP::ents_goat = Object::FindObjectsOfType("GoatBehaviour", "");
}
if (settings::spoof_level && IsLocalPlayer(__this)) {
Misc::RankSpoofer(settings::new_level);
}
@@ -778,7 +783,21 @@ HRESULT __stdcall hookD3D11Present(IDXGISwapChain* pSwapChain, UINT SyncInterval
if (settings::azazel_esp && SceneName() != "Menu")
ESP::RunAzazelESP();
ESP::time_counter += 1;
if (ESP::time_counter > ESP::time_refresh) {
ESP::time_counter = 0;
}
}
if (!IsInGame() && SceneName() == "Menu") {
if (settings::item_esp) {
ESP::ents_azazel = nullptr;
ESP::ents_item = nullptr;
ESP::ents_goat = nullptr;
}
}
ImGui::GetIO().MouseDrawCursor = open_menu;