From 4ce2e124fa1b293140c97d8e63ae8b7aee436fd5 Mon Sep 17 00:00:00 2001 From: godgamer029 <-> Date: Mon, 16 Aug 2021 00:43:57 +0200 Subject: [PATCH] incomplete changes --- Horion/Module/Modules/Jetpack.cpp | 5 ++++- Memory/GameData.cpp | 4 +++- Memory/Hooks.cpp | 33 ++++++++++++------------------- Memory/Hooks.h | 6 ++---- SDK/CEntity.h | 13 +++++++----- 5 files changed, 30 insertions(+), 31 deletions(-) diff --git a/Horion/Module/Modules/Jetpack.cpp b/Horion/Module/Modules/Jetpack.cpp index 04e76469b..0c3a69b17 100644 --- a/Horion/Module/Modules/Jetpack.cpp +++ b/Horion/Module/Modules/Jetpack.cpp @@ -1,4 +1,5 @@ #include "Jetpack.h" +#include "../../../Utils/Logger.h" Jetpack::Jetpack() : IModule('F', Category::MOVEMENT, "Fly around like you had a Jetpack!") { registerFloatSetting("speed", &this->speedMod, 1, 0.2f, 3.f); @@ -17,6 +18,7 @@ const char* Jetpack::getModuleName() { } void Jetpack::onTick(C_GameMode* gm) { + logF("hello"); float calcYaw = (gm->player->yaw + 90) * (PI / 180); float calcPitch = (gm->player->pitch) * -(PI / 180); @@ -25,7 +27,8 @@ void Jetpack::onTick(C_GameMode* gm) { moveVec.x = cos(calcYaw) * cos(calcPitch) * speedMod; moveVec.y = sin(calcPitch) * speedMod; moveVec.z = sin(calcYaw) * cos(calcPitch) * speedMod; - + + __debugbreak(); gm->player->lerpMotion(moveVec); } else { delay++; diff --git a/Memory/GameData.cpp b/Memory/GameData.cpp index d7883ca4a..359df0929 100644 --- a/Memory/GameData.cpp +++ b/Memory/GameData.cpp @@ -92,6 +92,7 @@ void GameData::hide() { } void GameData::updateGameData(C_GameMode* gameMode) { + retrieveClientInstance(); g_Data.localPlayer = g_Data.getLocalPlayer(); @@ -101,10 +102,11 @@ void GameData::updateGameData(C_GameMode* gameMode) { if (g_Data.localPlayer != nullptr) { C_GuiData* guiData = g_Data.clientInstance->getGuiData(); - + if (guiData != nullptr) { { + logF("we out hjere"); auto vecLock = Logger::GetTextToPrintLock(); auto* stringPrintVector = Logger::GetTextToPrint(); #ifdef _DEBUG diff --git a/Memory/Hooks.cpp b/Memory/Hooks.cpp index 81a12cf70..835a77168 100644 --- a/Memory/Hooks.cpp +++ b/Memory/Hooks.cpp @@ -33,8 +33,6 @@ void Hooks::Init() { else { g_Hooks.GameMode_startDestroyBlockHook = std::make_unique(gameModeVtable[1], Hooks::GameMode_startDestroyBlock); - g_Hooks.GameMode_tickHook = std::make_unique(gameModeVtable[9], Hooks::GameMode_tick); - g_Hooks.GameMode_getPickRangeHook = std::make_unique(gameModeVtable[10], Hooks::GameMode_getPickRange); g_Hooks.GameMode_attackHook = std::make_unique(gameModeVtable[14], Hooks::GameMode_attack); @@ -183,8 +181,8 @@ void Hooks::Init() { // Signatures { - void* surv_tick = reinterpret_cast(FindSignature("48 89 5C 24 10 48 89 74 24 18 55 57 41 56 48 8D 6C 24 ?? 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 45 ?? 48 8B F9 F3")); - g_Hooks.SurvivalMode_tickHook = std::make_unique(surv_tick, Hooks::SurvivalMode_tick); + void* player_tickworld = reinterpret_cast(FindSignature("48 89 5C 24 ?? 55 56 57 41 54 41 55 41 56 41 57 48 8D 6C 24 ?? 48 81 EC ?? ?? ?? ?? 0F 29 B4 24 ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 45 ?? 48 89 55 ?? 48 8B F9")); + g_Hooks.Player_tickWorldHook = std::make_unique(player_tickworld, Hooks::Player_tickWorld); void* _sendChatMessage = reinterpret_cast(FindSignature("48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC ? 48 8B D9 48 83 B9")); g_Hooks.ChatScreenController_sendChatMessageHook = std::make_unique(_sendChatMessage, Hooks::ChatScreenController_sendChatMessage); @@ -330,23 +328,18 @@ void Hooks::Enable() { } -void Hooks::GameMode_tick(C_GameMode* _this) { - static auto oTick = g_Hooks.GameMode_tickHook->GetFastcall(); - oTick(_this); - - GameData::updateGameData(_this); - if (_this->player == g_Data.getLocalPlayer() && _this->player != nullptr) { - moduleMgr->onTick(_this); - } -} - -void Hooks::SurvivalMode_tick(C_GameMode* _this) { - static auto oTick = g_Hooks.SurvivalMode_tickHook->GetFastcall(); - oTick(_this); - GameData::updateGameData(_this); - if (_this->player == g_Data.getLocalPlayer() && _this->player != nullptr) { - moduleMgr->onTick(_this); +void* Hooks::Player_tickWorld(C_Player* _this, __int64 unk) { + static auto oTick = g_Hooks.Player_tickWorldHook->GetFastcall(); + auto o = oTick(_this, unk); + + if (_this == g_Data.getLocalPlayer()){ + // scuffed + // TODO: refactor all modules to not use GameMode + C_GameMode* gm = *reinterpret_cast(reinterpret_cast<__int64>(_this) + 4656); + GameData::updateGameData(gm); + moduleMgr->onTick(gm); } + return o; } void Hooks::ChatScreenController_sendChatMessage(uint8_t* _this) { diff --git a/Memory/Hooks.h b/Memory/Hooks.h index 177b1a626..be88e1196 100644 --- a/Memory/Hooks.h +++ b/Memory/Hooks.h @@ -74,8 +74,7 @@ class Hooks { static void Enable(); private: - static void GameMode_tick(C_GameMode* _this); - static void SurvivalMode_tick(C_GameMode* _this); + static void* Player_tickWorld(C_Player* _this, __int64); static void ChatScreenController_sendChatMessage(uint8_t* _this); static __int64 UIScene_setupAndRender(C_UIScene* uiscene, __int64 screencontext); static __int64 UIScene_render(C_UIScene* uiscene, __int64 screencontext); @@ -125,8 +124,7 @@ class Hooks { static void InventoryTransactionManager__addAction(C_InventoryTransactionManager*, C_InventoryAction &); static void LevelRendererPlayer__renderNameTags(__int64 a1, __int64 a2,TextHolder* name, __int64 a4); - std::unique_ptr GameMode_tickHook; - std::unique_ptr SurvivalMode_tickHook; + std::unique_ptr Player_tickWorldHook; std::unique_ptr ChatScreenController_sendChatMessageHook; std::unique_ptr UIScene_setupAndRenderHook; std::unique_ptr UIScene_renderHook; diff --git a/SDK/CEntity.h b/SDK/CEntity.h index 52f3924f2..554e42fd3 100644 --- a/SDK/CEntity.h +++ b/SDK/CEntity.h @@ -27,7 +27,7 @@ class C_Entity { public: uintptr_t *ptrToPtrToEntList; //0x0008 private: - char pad_0010[0x110]; //0x0010 + char pad_0010[0x130]; //0x0010 public: union { struct { @@ -141,8 +141,9 @@ class C_Entity { public: virtual void setPos(vec3_t const &); + virtual bool filler(); virtual vec3_t *getPredictedMovementValues(void) const; - virtual vec3_t *getPos(void) const; + virtual vec3_t *getPos(void) const; // getStateVectorComponent virtual vec3_t *getPosOld(void) const; virtual vec3_t *getPosExtrapolated(float) const; @@ -162,7 +163,8 @@ class C_Entity { virtual __int64 getInterpolatedWalkAnimSpeed(float) const; virtual __int64 getWorldPosition(); virtual void checkBlockCollisions(AABB const &); - virtual void checkBlockCollisions(void); + virtual void updateEntityInside(); + virtual void updateEntityInside(AABB const &); virtual bool isFireImmune(); virtual bool breaksFallingBlocks(void) const; virtual bool blockedByShield(__int64 const &, C_Entity &); @@ -218,13 +220,13 @@ class C_Entity { virtual bool isInWater(void) const; virtual bool hasEnteredWater(void) const; virtual bool isImmersedInWater(void) const; - virtual bool isInWaterOrRain(void) const; virtual bool isInLava(void) const; virtual bool isUnderLiquid(__int64) const; virtual bool isOverWater(void) const; private: - virtual __int64 makeStuckInBlock(float); + virtual __int64 setBlockMovementSlowdownMultiplier(vec3_t const&); + virtual __int64 resetBlockMovementSlowdownMultiplier(); virtual __int64 getCameraOffset(void) const; virtual __int64 getShadowHeightOffs(void); virtual __int64 getShadowRadius(void) const; @@ -265,6 +267,7 @@ class C_Entity { virtual bool unk2(void) const; public: + virtual bool isAffectedByWaterBottle(void) const; virtual bool canAttack(C_Entity *, bool) const; virtual void setTarget(C_Entity *);