Temp fix for random crashes during the game while using ESP

This commit is contained in:
KnucklesB
2024-07-16 16:13:15 -03:00
parent c99f820fa6
commit 61d331d38f
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() { 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) if (ents == NULL)
return; return;
@@ -140,10 +151,16 @@ void ESP::RunDemonESP() {
} }
} }
void ESP::RunItemsESP() { 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] }; 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])) { if (ents != nullptr || !Object::IsNull(ents->vector[0])) {
ComputePositionAndDrawESP(ents, col, true); ComputePositionAndDrawESP(ents, col, true);
} }
@@ -157,7 +174,8 @@ void ESP::RunItemsESP() {
} }
void ESP::RunGoatsESP() { 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])) if (goats == nullptr || Object::IsNull(goats->vector[0]))
return; return;

View File

@@ -2,7 +2,19 @@
#include "settings/settings.hpp" #include "settings/settings.hpp"
namespace ESP { 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 RunPlayersESP();
void RunGoatsESP(); void RunGoatsESP();
void RunItemsESP(); void RunItemsESP();

View File

@@ -94,6 +94,11 @@ typedef void(__stdcall* TNolanBehaviour_Update)(app::NolanBehaviour*, MethodInfo
TNolanBehaviour_Update oNolanBehaviour_Update = NULL; TNolanBehaviour_Update oNolanBehaviour_Update = NULL;
void __stdcall hNolanBehaviour_Update(app::NolanBehaviour* __this, MethodInfo* method) { 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)) { if (settings::spoof_level && IsLocalPlayer(__this)) {
Misc::RankSpoofer(settings::new_level); Misc::RankSpoofer(settings::new_level);
} }
@@ -778,7 +783,21 @@ HRESULT __stdcall hookD3D11Present(IDXGISwapChain* pSwapChain, UINT SyncInterval
if (settings::azazel_esp && SceneName() != "Menu") if (settings::azazel_esp && SceneName() != "Menu")
ESP::RunAzazelESP(); 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; ImGui::GetIO().MouseDrawCursor = open_menu;