From 4a3606f95b2d8301becb5da388e2cb578b367fc2 Mon Sep 17 00:00:00 2001 From: Joaquin Date: Fri, 21 Jun 2024 10:58:52 -0600 Subject: [PATCH] fix: Entity struct and remove Vacuum temporarily --- cheat/src/appdata/il2cpp-functions.h | 3 ++ cheat/src/appdata/il2cpp-types.h | 36 +++++++++++++--------- cheat/src/cheat/cheat.cpp | 2 +- cheat/src/cheat/features/EntityManager.cpp | 24 +++++++++------ cheat/src/cheat/features/FPSUnlock.cpp | 4 +-- cheat/src/cheat/features/TimeScale.cpp | 6 ++-- 6 files changed, 45 insertions(+), 30 deletions(-) diff --git a/cheat/src/appdata/il2cpp-functions.h b/cheat/src/appdata/il2cpp-functions.h index 1348ba9..508d8cd 100644 --- a/cheat/src/appdata/il2cpp-functions.h +++ b/cheat/src/appdata/il2cpp-functions.h @@ -35,6 +35,9 @@ DO_APP_FUNC(0x03A12E40, void, Transform_set_forward, (Transform* __this, Vector3 DO_APP_FUNC(0x03A11F70, int32_t, Transform_get_childCount, (Transform* __this, MethodInfo* method)); DO_APP_FUNC(0x03A2C200, String*, Scene_GetNameInternal, (int32_t sceneHandle, MethodInfo* method)); DO_APP_FUNC(0x03A2ABD0, Scene, SceneManager_GetActiveScene, (MethodInfo* method)); +DO_APP_FUNC(0x039B6E20, int32_t, Application_get_targetFrameRate, (MethodInfo* method)); +DO_APP_FUNC(0x039B7540, void, Application_set_targetFrameRate, (int32_t value, MethodInfo* method)); +DO_APP_FUNC(0x03A0E380, void, Time_3_set_timeScale, (float value, MethodInfo* method)); // No Cooldown DO_APP_FUNC(0x009B7980, void/*KAAIFMKPKAG*/*, KAAIFMKPKAG_IOFMGMJCCFO, (KAAIFMKPKAG* __this, bool DEJNILEHENL, MethodInfo* method)); diff --git a/cheat/src/appdata/il2cpp-types.h b/cheat/src/appdata/il2cpp-types.h index 8796987..7eff0e7 100644 --- a/cheat/src/appdata/il2cpp-types.h +++ b/cheat/src/appdata/il2cpp-types.h @@ -3569,8 +3569,9 @@ namespace app ECharacterType__Enum AJEHLIOMMJN; struct CharCommonInfoData* KFIFBINFDPB; struct CharResourceData* PEFKKKBMDKN; - bool NGLCGPAJJGK; - bool DPJNONIOAFH; + bool GBPOIDLOHNJ; + bool JPBGFNKOFHP; + bool FOEDEMGDJKF; struct GBJHLCNJLOJ* ILDKBCNAELG; struct CDCHBPIDJCD* NKONPDBOBAG; struct PMDPIAPKIOH* KJCAKAHDGIH; @@ -3591,19 +3592,24 @@ namespace app float CLAAFELIGIC; eCharDeadStep__Enum KKFDEBKACEJ; eCharDeadStep__Enum BNJHNGLKFPL; - float KEOJBAGNEEL; - int32_t LICJAPCPLEB; - int32_t JHHNIFHFEKM; - struct NmssSvInt* HDOOADICLPI; - bool BKIJFOEGAJI; - struct List_1_NGame_SkillUnitIdentity_* DMMKIMMGCND; - struct List_1_ENNEJEPMJLJ_* NEDACNMODEB; - struct NPPEDAMJEJN* DLMMJPACLJA; - bool GFDMJEPIKAI; - int32_t FJNGPGFMHBC; - int32_t PMLDLGALKKL; - int32_t JPFAPNECDGA; - struct GDGHJFBGAKC* FFDMOEIKOLA; + float BNOGNCGFJDL; + int32_t LDHKJNBHKHM; + int32_t LHDKJIGLOBL; + struct NmssSvInt* HPBMNIPEIFJ; + bool GODMHNKIDMM; + struct List_1_NGame_SkillUnitIdentity_* HEAPGLGMOFJ; + struct List_1_DOMJFCNEJMK_* CNFEIDKBMGP; + struct AIDDAOICKLF* BMEMLFJAJCA; + bool PCENLAEDFLI; + int32_t NFNOGFNAIFI; + int32_t BKJPEKIKLPI; + int32_t NACMOENBDMK; + struct NmssSvLong* OOFCBNHHAJP; + struct DBDAGCOEKFH* BLGJDOKOAKM; + float HKPPLOMKGEO; + float CBHPPAEFDBE; + bool NGHOPOBNIBG; + struct POGEGLODJOC* HGPHIMABFAF; }; struct ENNEJEPMJLJ diff --git a/cheat/src/cheat/cheat.cpp b/cheat/src/cheat/cheat.cpp index 8e8a91f..fb9a031 100644 --- a/cheat/src/cheat/cheat.cpp +++ b/cheat/src/cheat/cheat.cpp @@ -30,7 +30,7 @@ void init_cheat() INIT_FEATURE(NoCooldown); INIT_FEATURE(DamageHack); INIT_FEATURE(GodMode); - INIT_FEATURE(MobVacuum); + //INIT_FEATURE(MobVacuum); INIT_FEATURE(DumbEnemies); INIT_FEATURE(MissionTime); INIT_FEATURE(TimeScale); diff --git a/cheat/src/cheat/features/EntityManager.cpp b/cheat/src/cheat/features/EntityManager.cpp index a498f5b..536375d 100644 --- a/cheat/src/cheat/features/EntityManager.cpp +++ b/cheat/src/cheat/features/EntityManager.cpp @@ -32,7 +32,7 @@ namespace Cheat::Features void EntityManager::OnEnemyUpdate() { - if (m_pPlayer && m_pEnemiesVec.empty()) + if (m_pPlayer == nullptr && m_pEnemiesVec.empty()) return; for (auto& enemy : m_pEnemiesVec) @@ -55,6 +55,10 @@ namespace Cheat::Features bool EntityManager::IsCharacterAlive(app::ENNEJEPMJLJ* character) { + if (character == nullptr && + character->fields.NKONPDBOBAG->fields.IALANALADIL->fields.HOAFECEANLC->fields._.m_CachedPtr == nullptr) + return false; + return app::PCILGJOEPJM_PPAKPBOJLIP(character, nullptr); } @@ -86,21 +90,23 @@ namespace Cheat::Features auto ret = CALL_ORIGIN(ENNEJEPMJLJ_FIGHFBNIDJA_Hook, __this, method); if (__this != nullptr && - __this->fields.NKONPDBOBAG->fields.IALANALADIL->fields.HOAFECEANLC->fields._.m_CachedPtr != nullptr) + __this->fields.NKONPDBOBAG->fields.IALANALADIL->fields.HOAFECEANLC->fields._.m_CachedPtr != nullptr && + __this->fields.AJEHLIOMMJN != app::ECharacterType__Enum::None) { //LOG(xorstr("resourceName %s"), il2cppi_to_string(__this->fields.PEFKKKBMDKN->fields.m_ResourceName).c_str()); //LOG(xorstr("CharType %s"), magic_enum::enum_name(__this->fields.AJEHLIOMMJN).data()); - if (__this->fields.FHNGHHPLPGD == app::eCharGroup__Enum::PLAYER) + if (__this->fields.FHNGHHPLPGD == app::eCharGroup__Enum::PLAYER && + __this->fields.AJEHLIOMMJN == app::ECharacterType__Enum::Hunter) { - em.m_pPlayer = __this; - em.m_pPlayerGO = __this->fields.NKONPDBOBAG->fields.IALANALADIL->fields.HOAFECEANLC; + //em.m_pPlayer = __this; + //em.m_pPlayerGO = __this->fields.NKONPDBOBAG->fields.IALANALADIL->fields.HOAFECEANLC; } - - if (__this->fields.FHNGHHPLPGD == app::eCharGroup__Enum::ENEMY) + else if (__this->fields.FHNGHHPLPGD == app::eCharGroup__Enum::ENEMY && + __this->fields.AJEHLIOMMJN == app::ECharacterType__Enum::Monster) { - if (std::find(em.m_pEnemiesVec.begin(), em.m_pEnemiesVec.end(), __this) == em.m_pEnemiesVec.end()) - em.m_pEnemiesVec.push_back(__this); + //if (std::find(em.m_pEnemiesVec.begin(), em.m_pEnemiesVec.end(), __this) == em.m_pEnemiesVec.end()) + // em.m_pEnemiesVec.push_back(__this); } } diff --git a/cheat/src/cheat/features/FPSUnlock.cpp b/cheat/src/cheat/features/FPSUnlock.cpp index 0bf0d74..625b211 100644 --- a/cheat/src/cheat/features/FPSUnlock.cpp +++ b/cheat/src/cheat/features/FPSUnlock.cpp @@ -17,11 +17,11 @@ namespace Cheat::Features if (m_LastEnableStatus && !vars.FPSUnlock.value()) { - methods::Application::SetTargetFrameRate(m_OriginFPS); + app::Application_set_targetFrameRate(m_OriginFPS, nullptr); } else if (!m_LastEnableStatus && vars.FPSUnlock.value()) { - m_OriginFPS = methods::Application::GetTargetFrameRate(); + m_OriginFPS = app::Application_get_targetFrameRate(nullptr); } m_LastEnableStatus = vars.FPSUnlock.value(); if (vars.FPSUnlock.value()) diff --git a/cheat/src/cheat/features/TimeScale.cpp b/cheat/src/cheat/features/TimeScale.cpp index 0658792..73dc621 100644 --- a/cheat/src/cheat/features/TimeScale.cpp +++ b/cheat/src/cheat/features/TimeScale.cpp @@ -15,16 +15,16 @@ namespace Cheat::Features { auto& vars = Vars::GetInstance(); - if (vars.TimeScale.value()) + if (vars.TimeScale.value() && !m_DidSpeed) { - UnityResolve::UnityType::Time::SetTimeScale(vars.TimeScaleSpeed.value()); + app::Time_3_set_timeScale(vars.TimeScaleSpeed.value(), nullptr); m_DidSpeed = true; } else { if (m_DidSpeed) { - UnityResolve::UnityType::Time::SetTimeScale(1.0f); + app::Time_3_set_timeScale(1.0f, nullptr); m_DidSpeed = false; } }