Skip to content

Commit

Permalink
fix: ESP crash in main menu
Browse files Browse the repository at this point in the history
still crashes when leaving a game, Unity race conditions ig
  • Loading branch information
ALittlePatate committed Jun 15, 2024
1 parent ecb8841 commit 3601c50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 4 additions & 1 deletion user/features/esp/esp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ void ComputePositionAndDrawESP(app::Object_1__Array* ents, ImColor color, bool u

void ESP::RunAzazelESP() {
app::GameObject__Array* ents = Object::FindGameObjectsWithTag("Azazel");
//app::Object_1__Array *ents = Object::FindObjectsOfType("SurvivalAzazelBehaviour", "");

if (ents == NULL)
return;
Expand All @@ -128,6 +127,8 @@ void ESP::RunDemonESP() {
std::vector<std::string> demons_c = { "SurvivalDemonBehaviour", "SpiderBehaviour", "GhostBehaviour", "BoarBehaviour", "CorpseBehaviour" };

for (std::string& class_ : demons_c) {
if (SceneName() != "Menu")
return;
app::Object_1__Array *ents = Object::FindObjectsOfType(class_.c_str(), "");
if (ents == nullptr)
continue;
Expand All @@ -147,6 +148,8 @@ void ESP::RunItemsESP() {
ComputePositionAndDrawESP(ents, col, true);
}

if (SceneName() != "Menu")
return;
ents = Object::FindObjectsOfType("KeyBehaviour", "");
if (ents != nullptr && ents->vector[0] != nullptr) {
ComputePositionAndDrawESP(ents, col, false, "Key");
Expand Down
7 changes: 3 additions & 4 deletions user/hooks/hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -759,20 +759,19 @@ HRESULT __stdcall hookD3D11Present(IDXGISwapChain* pSwapChain, UINT SyncInterval
DrawMenu(open_menu);
}

// to-do: move it to "fixed update" hook
if (settings::player_esp)
ESP::RunPlayersESP();

if (settings::goat_esp)
if (settings::goat_esp && SceneName() != "Menu")
ESP::RunGoatsESP();

if (settings::item_esp)
if (settings::item_esp && SceneName() != "Menu")
ESP::RunItemsESP();

if (settings::demon_esp)
ESP::RunDemonESP();

if (settings::azazel_esp)
if (settings::azazel_esp && SceneName() != "Menu")
ESP::RunAzazelESP();

ImGui::GetIO().MouseDrawCursor = open_menu;
Expand Down

0 comments on commit 3601c50

Please sign in to comment.