00000157048D2A8E 83 3C 38 FF cmp dword ptr [rax+rdi],0FFFFFFFFh
0xc0000005 -> The thread tried to read from or write to a virtual address for which it does not have the appropriate access
I guess it's because I'm doing these stuff in wrong function (FrameStageNotify) and entity is getting removed when I'm doing this check. but strange thing is it's crashing in this exact location. there are a lot of other functions using entity in my FrameStageNotify hook.
Any idea why my cheat is crashing?
Edit:
Okay it's the first function that I'm calling, it's because of that It's getting crashed in this function everytime. Any solution? I guess FrameStage is not good place to work with entities.
0xc0000005 -> The thread tried to read from or write to a virtual address for which it does not have the appropriate access
C++:
void Hacks::ColorIfIllusion(CBaseEntity* entity)
{
const char* className = entity->SchemaBinding()->BinaryName;
if (!className)
return;
if (strstr(className, "CDOTA_Unit_Hero_ArcWarden")) return;
if (strstr(className, "C_DOTA_Unit_Hero_Morphling")) return;
if (strstr(className, "C_DOTA_Unit_Hero_Meepo")) return;
const auto assignedHero = (CDOTABaseNPC_Hero*)entity;
if (!assignedHero)
return;
if (assignedHero->IsIllusion()) # No access (invalid address in here)
{
assignedHero->SetColor(ToUC(Settings::Visuals::IllusionColor));
if (Settings::Visuals::bIllusionHideHP)
{
assignedHero->SetHealthbarOffset(10000);
}
}
}
C++:
bool CDOTABaseNPC_Hero::IsIllusion() const
{
return Member<ENT_HANDLE>(Netvars["C_DOTA_BaseNPC_Hero"]["m_hReplicatingOtherHeroModel"]) != (uint32_t)4294967295; # Where crash happens
}
I guess it's because I'm doing these stuff in wrong function (FrameStageNotify) and entity is getting removed when I'm doing this check. but strange thing is it's crashing in this exact location. there are a lot of other functions using entity in my FrameStageNotify hook.
Any idea why my cheat is crashing?
Edit:
C++:
for (int32_t i = 0; i <= Interfaces::EntitySystem->GetHighestEntityIndex(); i++)
{
auto* entity = Interfaces::EntitySystem->GetEntity(i);
if (!entity)
continue;
auto binaryName = entity->SchemaBinding()->BinaryName;
if (!binaryName)
continue;
if (Settings::Visuals::bIllusionESP && strstr(binaryName, "Unit_Hero"))
{
Hacks::ColorIfIllusion(entity);
continue;
}