Skip to content
This repository has been archived by the owner on Dec 26, 2021. It is now read-only.

Commit

Permalink
incomplete changes
Browse files Browse the repository at this point in the history
  • Loading branch information
godgamer029 committed Aug 15, 2021
1 parent ec768c2 commit 4ce2e12
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 31 deletions.
5 changes: 4 additions & 1 deletion Horion/Module/Modules/Jetpack.cpp
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -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);

Expand All @@ -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++;
Expand Down
4 changes: 3 additions & 1 deletion Memory/GameData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ void GameData::hide() {
}

void GameData::updateGameData(C_GameMode* gameMode) {

retrieveClientInstance();
g_Data.localPlayer = g_Data.getLocalPlayer();

Expand All @@ -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
Expand Down
33 changes: 13 additions & 20 deletions Memory/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ void Hooks::Init() {
else {
g_Hooks.GameMode_startDestroyBlockHook = std::make_unique<FuncHook>(gameModeVtable[1], Hooks::GameMode_startDestroyBlock);

g_Hooks.GameMode_tickHook = std::make_unique<FuncHook>(gameModeVtable[9], Hooks::GameMode_tick);

g_Hooks.GameMode_getPickRangeHook = std::make_unique<FuncHook>(gameModeVtable[10], Hooks::GameMode_getPickRange);

g_Hooks.GameMode_attackHook = std::make_unique<FuncHook>(gameModeVtable[14], Hooks::GameMode_attack);
Expand Down Expand Up @@ -183,8 +181,8 @@ void Hooks::Init() {

// Signatures
{
void* surv_tick = reinterpret_cast<void*>(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<FuncHook>(surv_tick, Hooks::SurvivalMode_tick);
void* player_tickworld = reinterpret_cast<void*>(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<FuncHook>(player_tickworld, Hooks::Player_tickWorld);

void* _sendChatMessage = reinterpret_cast<void*>(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<FuncHook>(_sendChatMessage, Hooks::ChatScreenController_sendChatMessage);
Expand Down Expand Up @@ -330,23 +328,18 @@ void Hooks::Enable() {

}

void Hooks::GameMode_tick(C_GameMode* _this) {
static auto oTick = g_Hooks.GameMode_tickHook->GetFastcall<void, C_GameMode*>();
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<void, C_GameMode*>();
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<void*, C_Player*, __int64>();
auto o = oTick(_this, unk);

if (_this == g_Data.getLocalPlayer()){
// scuffed
// TODO: refactor all modules to not use GameMode
C_GameMode* gm = *reinterpret_cast<C_GameMode**>(reinterpret_cast<__int64>(_this) + 4656);
GameData::updateGameData(gm);
moduleMgr->onTick(gm);
}
return o;
}

void Hooks::ChatScreenController_sendChatMessage(uint8_t* _this) {
Expand Down
6 changes: 2 additions & 4 deletions Memory/Hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<FuncHook> GameMode_tickHook;
std::unique_ptr<FuncHook> SurvivalMode_tickHook;
std::unique_ptr<FuncHook> Player_tickWorldHook;
std::unique_ptr<FuncHook> ChatScreenController_sendChatMessageHook;
std::unique_ptr<FuncHook> UIScene_setupAndRenderHook;
std::unique_ptr<FuncHook> UIScene_renderHook;
Expand Down
13 changes: 8 additions & 5 deletions SDK/CEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;

Expand All @@ -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 &);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 *);

Expand Down

0 comments on commit 4ce2e12

Please sign in to comment.