2y ago · Feb 18, 2024 3:40 PM
Hey everyone,
Sharing an architectural breakdown of how to build a clean internal GUI menu for Phasmophobia (Unity IL2CPP/Mono runtime) using Dear ImGui and IL2CPP domain inspection.
1. Locating the GhostAI Instance:
In Phasmophobia, the main ghost behavior and state variables are managed by and singletons:
2. Reading Player Sanity & Fuse Box Status:
Player sanity levels are stored in or :
3. Drawing the ImGui Menu Window:
Feel free to ask any questions about hooking the DirectX Present loop or resolving IL2CPP method pointers!
Sharing an architectural breakdown of how to build a clean internal GUI menu for Phasmophobia (Unity IL2CPP/Mono runtime) using Dear ImGui and IL2CPP domain inspection.
1. Locating the GhostAI Instance:
In Phasmophobia, the main ghost behavior and state variables are managed by
CPP
GhostAI CPP
GhostTraits CPP
// Conceptual C# / IL2CPP struct representation
public class GhostAI : MonoBehaviour {
public GhostTraits ghostTraits;
public GhostInteraction ghostInteraction;
public bool isHunting;
public float huntingSpeed;
public GhostState currentState; // Idle, Wandering, Hunting, Interacting
}
public class GhostTraits {
public GhostType ghostType; // Spirit, Wraith, Phantom, Demon, Revenant, etc.
public GhostEvidence[] evidenceList; // EMF5, Fingerprints, Freezing, GhostOrb, etc.
public float favoriteRoomTemperature;
}2. Reading Player Sanity & Fuse Box Status:
Player sanity levels are stored in
CPP
PlayerSanity CPP
PlayerData CPP
float currentSanity = pPlayerInstance->playerSanity->sanityLevel;3. Drawing the ImGui Menu Window:
CPP
void RenderPhasmoMenu() {
ImGui::Begin("Phasmophobia Research Assistant v2.4", nullptr, ImGuiWindowFlags_AlwaysAutoResize);
if (ImGui::CollapsingHeader("Ghost Intel", ImGuiTreeNodeFlags_DefaultOpen)) {
ImGui::Text("Ghost Type: %s", GetGhostTypeName(g_GhostAI->ghostTraits->ghostType));
ImGui::Text("Current State: %s", g_GhostAI->isHunting ? "[!] HUNTING [!]" : "Passive / Wandering");
ImGui::Text("Ghost Room: %s", g_GhostAI->favoriteRoomName);
ImGui::ProgressBar(g_GhostAI->huntingSpeed / 3.0f, ImVec2(200, 0), "Hunting Speed");
}
if (ImGui::CollapsingHeader("Evidence Auto-Tracker")) {
for (auto& evidence : g_GhostAI->ghostTraits->evidenceList) {
ImGui::BulletText("Required: %s", GetEvidenceName(evidence));
}
}
if (ImGui::CollapsingHeader("ESP & Visuals")) {
ImGui::Checkbox("Draw Ghost 3D Box ESP", &g_Config.GhostESP);
ImGui::Checkbox("Draw Fuse Box (Breaker) ESP", &g_Config.BreakerESP);
ImGui::Checkbox("Draw Cursed Possessions (Tarot, Mirror, Ouija)", &g_Config.CursedESP);
ImGui::Checkbox("Draw Bone / Evidence Item ESP", &g_Config.BoneESP);
}
ImGui::End();
}Feel free to ask any questions about hooking the DirectX Present loop or resolving IL2CPP method pointers!
GhostHunter_x · Phasmophobia & Unity Reverser
GhostAI, Sanity, EMF & Evidence inspection
GhostAI, Sanity, EMF & Evidence inspection
The following users thanked GhostHunter_x for this post: