From 67d23691b1063b28915bb2cbc3222d2fc12f21ab Mon Sep 17 00:00:00 2001 From: marioCST <68396929+marioCST@users.noreply.github.com> Date: Sun, 17 Nov 2024 00:25:10 +0100 Subject: [PATCH 1/5] Initial 1.21.4X update (unfinished) --- LatiteRewrite.vcxproj | 4 + src/client/Latite.cpp | 18 ++-- src/client/hook/impl/AppPlatformHooks.cpp | 3 +- src/client/hook/impl/GeneralHooks.cpp | 10 +- src/client/hook/impl/GeneralHooks.h | 2 +- src/sdk/Util.h | 24 +++++ src/sdk/Version.h | 3 +- src/sdk/common/client/game/ClientInstance.cpp | 15 ++- src/sdk/common/client/game/ClientInstance.h | 10 +- src/sdk/common/client/game/FontRepository.h | 2 +- src/sdk/common/client/game/MinecraftGame.cpp | 4 + src/sdk/common/client/game/MinecraftGame.h | 7 +- .../common/client/gui/controls/UIControl.cpp | 3 +- .../common/client/gui/controls/UIControl.h | 4 +- .../common/client/input/ClientInputHandler.h | 2 +- .../client/renderer/game/LevelRenderer.h | 2 +- .../screen/MinecraftUIRenderContext.h | 2 +- .../client/renderer/screen/ScreenContext.h | 2 +- src/sdk/common/entity/EntityContext.h | 4 - .../entity/component/ActorDataFlagComponent.h | 7 ++ .../component/ActorEquipmentComponent.h | 8 ++ .../entity/component/ActorTypeComponent.h | 7 ++ .../entity/component/AttributesComponent.h | 5 + .../entity/component/MoveInputComponent.h | 5 +- .../entity/component/RuntimeIDComponent.h | 7 ++ src/sdk/common/network/RakNetConnector.h | 8 +- src/sdk/common/world/Minecraft.cpp | 2 + src/sdk/common/world/Minecraft.h | 6 +- src/sdk/common/world/actor/Actor.cpp | 9 +- src/sdk/common/world/actor/Actor.h | 4 +- src/sdk/common/world/actor/player/Player.cpp | 4 +- src/sdk/common/world/actor/player/Player.h | 6 +- src/sdk/common/world/level/Dimension.h | 1 + src/sdk/common/world/level/Level.cpp | 14 ++- src/sdk/common/world/level/Level.h | 2 +- src/sdk/signature/storage_latest.h | 91 +++++++++---------- 36 files changed, 200 insertions(+), 107 deletions(-) create mode 100644 src/sdk/common/entity/component/ActorDataFlagComponent.h create mode 100644 src/sdk/common/entity/component/ActorEquipmentComponent.h create mode 100644 src/sdk/common/entity/component/ActorTypeComponent.h create mode 100644 src/sdk/common/entity/component/RuntimeIDComponent.h diff --git a/LatiteRewrite.vcxproj b/LatiteRewrite.vcxproj index 7b70e4e2..127030ed 100644 --- a/LatiteRewrite.vcxproj +++ b/LatiteRewrite.vcxproj @@ -562,8 +562,12 @@ + + + + diff --git a/src/client/Latite.cpp b/src/client/Latite.cpp index 81b1fa5d..ff9d9579 100644 --- a/src/client/Latite.cpp +++ b/src/client/Latite.cpp @@ -137,11 +137,15 @@ DWORD __stdcall startThread(HINSTANCE dll) { int deadCount = 0; std::unordered_map versNumMap = { - { "1.21.30", SDK::VLATEST }, - { "1.21.31", SDK::VLATEST } - // { "1.21.20", SDK::VLATEST }, - // { "1.21.21", SDK::VLATEST }, - // { "1.21.22", SDK::VLATEST }, + { "1.21.44", SDK::VLATEST}, + { "1.21.43", SDK::VLATEST}, + { "1.21.41", SDK::VLATEST}, + { "1.21.40", SDK::VLATEST}, + // { "1.21.30", SDK::V1_21_30 }, + // { "1.21.31", SDK::V1_21_30 } + // { "1.21.20", SDK::V1_21_20 }, + // { "1.21.21", SDK::V1_21_20 }, + // { "1.21.22", SDK::V1_21_20 }, //{ "1.21.0", SDK::V1_21 }, //{ "1.21.1", SDK::V1_21 }, //{ "1.21.2", SDK::V1_21 }, @@ -221,7 +225,7 @@ DWORD __stdcall startThread(HINSTANCE dll) { MVSIG(BaseActorRenderContext_BaseActorRenderContext), MVSIG(ItemRenderer_renderGuiItemNew), MVSIG(BaseAttributeMap_getInstance), - MVSIG(UIControl_setPosition), + MVSIG(UIControl_getPosition), MVSIG(MinecraftGame_getPrimaryClientInstance), MVSIG(Components::actorTypeComponent), MVSIG(ActorRenderDispatcher_render), @@ -229,7 +233,7 @@ DWORD __stdcall startThread(HINSTANCE dll) { MVSIG(Components::attributesComponent), MVSIG(Dimension_getSkyColor), MVSIG(Dimension_getTimeOfDay), - MVSIG(Weather_tick), + MVSIG(Dimension_tick), MVSIG(Misc::thirdPersonNametag), MVSIG(ItemStackBase_getDamageValue), MVSIG(MinecraftPackets_createPacket), diff --git a/src/client/hook/impl/AppPlatformHooks.cpp b/src/client/hook/impl/AppPlatformHooks.cpp index 0448d77a..ba4c85b7 100644 --- a/src/client/hook/impl/AppPlatformHooks.cpp +++ b/src/client/hook/impl/AppPlatformHooks.cpp @@ -15,5 +15,6 @@ int AppPlatformHooks::_fireAppFocusLost(SDK::AppPlatform* plat) { } AppPlatformHooks::AppPlatformHooks() { - FocusLostHook = addHook(Signatures::AppPlatform__fireAppFocusLost.result, _fireAppFocusLost, "AppPlatform::_fireAppFocusLost"); + // TODO: FIX ME + //FocusLostHook = addHook(Signatures::AppPlatform__fireAppFocusLost.result, _fireAppFocusLost, "AppPlatform::_fireAppFocusLost"); } diff --git a/src/client/hook/impl/GeneralHooks.cpp b/src/client/hook/impl/GeneralHooks.cpp index 38490f38..7c5c888e 100644 --- a/src/client/hook/impl/GeneralHooks.cpp +++ b/src/client/hook/impl/GeneralHooks.cpp @@ -28,7 +28,7 @@ namespace { std::shared_ptr OutlineSelectionHook; std::shared_ptr RenderGuiItemNewHook; std::shared_ptr GetTimeOfDayHook; - std::shared_ptr WeatherHook; + std::shared_ptr DimensionHook; std::shared_ptr FogColorHook; std::shared_ptr AddMessageHook; std::shared_ptr UpdatePlayerHook; @@ -328,15 +328,15 @@ float GenericHooks::hkGetTimeOfDay(SDK::Dimension* obj) { return ev.getTime(); } -void GenericHooks::hkWeatherTick(SDK::Weather* obj) { +void GenericHooks::hkDimensionTick(SDK::Dimension* obj) { WeatherEvent ev{}; Eventing::get().dispatch(ev); if (!ev.shouldShowWeather()) { - obj->data = SDK::Weather::WeatherData{}; + obj->weather->data = SDK::Weather::WeatherData{}; } - WeatherHook->oFunc()(obj); + DimensionHook->oFunc()(obj); } Color* GenericHooks::hkGetFogColor(SDK::Dimension* obj, Color* out, SDK::Actor* ent, float f) { @@ -449,7 +449,7 @@ GenericHooks::GenericHooks() : HookGroup("General") { FogColorHook = addHook(Signatures::Dimension_getSkyColor.result, hkGetFogColor, "Dimension::getFogColor"); GetTimeOfDayHook = addHook(Signatures::Dimension_getTimeOfDay.result, hkGetTimeOfDay, "Dimension::getTimeOfDay"); - WeatherHook = addHook(Signatures::Weather_tick.result, hkWeatherTick, "Weather::tick"); + DimensionHook = addHook(Signatures::Dimension_tick.result, hkDimensionTick, "Dimension::tick"); AddMessageHook = addHook(Signatures::GuiData__addMessage.result, hkAddMessage, "GuiData::_addMessage"); UpdatePlayerHook = addHook(Signatures::_updatePlayer.result, hkUpdatePlayer, "`anonymous namespace'::_updatePlayer"); OnUriHook = addHook(Signatures::GameArguments__onUri.result, hkOnUri, "GameArguments::_onUri"); diff --git a/src/client/hook/impl/GeneralHooks.h b/src/client/hook/impl/GeneralHooks.h index 0ec6324b..24f439a5 100644 --- a/src/client/hook/impl/GeneralHooks.h +++ b/src/client/hook/impl/GeneralHooks.h @@ -45,7 +45,7 @@ class GenericHooks : public HookGroup { static void LevelRendererPlayer_renderOutlineSelection(SDK::LevelRendererPlayer* obj, SDK::ScreenContext* scn, void* block, void* region, BlockPos pos); static void* hkRenderGuiItemNew(void* obj, SDK::BaseActorRenderContext* baseActorRenderContext, SDK::ItemStack* itemStack, int mode, float x, float y, float opacity, float scale, float a9, bool ench); static float hkGetTimeOfDay(SDK::Dimension* obj); - static void hkWeatherTick(SDK::Weather* obj); + static void hkDimensionTick(SDK::Dimension* obj); static Color* hkGetFogColor(SDK::Dimension* obj, Color* out, SDK::Actor* ent, float f); static void hkAddMessage(SDK::GuiData* obj, void* msg, uint32_t profanityContext); static void hkUpdatePlayer(SDK::CameraComponent* obj, void* a, void* b); diff --git a/src/sdk/Util.h b/src/sdk/Util.h index 19dd01d1..e5fe4b6f 100644 --- a/src/sdk/Util.h +++ b/src/sdk/Util.h @@ -29,6 +29,30 @@ namespace util { } namespace SDK { + template + extern inline const int mvGetOffset() { + switch (SDK::internalVers) { + case SDK::V1_21_40: + default: + return offs_1_21_40; + case SDK::V1_21_30: + return offs_1_21_30; + case SDK::V1_21_20: + return offs_1_21_20; + case SDK::V1_20_50: + return offs_1_20_50; + case SDK::V1_20_40: + return offs_1_20_40; + case SDK::V1_20_30: + return offs_1_20_30; + case SDK::V1_19_51: + return offs_1_19_51; + break; + case SDK::V1_18_12: + return offs_1_18_12; + } + } + template extern inline const int mvGetOffset() { switch (SDK::internalVers) { diff --git a/src/sdk/Version.h b/src/sdk/Version.h index 00bc79d6..e49c1b04 100644 --- a/src/sdk/Version.h +++ b/src/sdk/Version.h @@ -17,7 +17,8 @@ namespace SDK { V1_21 = 12100, V1_21_20 = 12120, V1_21_30 = 12130, - VLATEST = V1_21_30, + V1_21_40 = 12140, + VLATEST = V1_21_40, }; extern int internalVers; diff --git a/src/sdk/common/client/game/ClientInstance.cpp b/src/sdk/common/client/game/ClientInstance.cpp index ed8318e2..1483cd0e 100644 --- a/src/sdk/common/client/game/ClientInstance.cpp +++ b/src/sdk/common/client/game/ClientInstance.cpp @@ -39,7 +39,10 @@ SDK::BlockSource* SDK::ClientInstance::getRegion() { if (SDK::internalVers < SDK::V1_20_50) { return memory::callVirtual(this, 0x1A); } - return memory::callVirtual(this, 0x1C); + if (SDK::internalVers < SDK::V1_21_40) { + return memory::callVirtual(this, 0x1C); + } + return memory::callVirtual(this, 0x1D); } @@ -50,7 +53,10 @@ SDK::LocalPlayer* SDK::ClientInstance::getLocalPlayer() { if (SDK::internalVers < SDK::V1_20_50) { return memory::callVirtual(this, 0x1B); } - return memory::callVirtual(this, 0x1D); + if (SDK::internalVers < SDK::V1_21_40) { + return memory::callVirtual(this, 0x1D); + } + return memory::callVirtual(this, 0x1E); } SDK::GuiData* SDK::ClientInstance::getGuiData() { @@ -64,13 +70,16 @@ SDK::GuiData* SDK::ClientInstance::getGuiData() { { return util::directAccess(this, 0x558); } + if (internalVers >= V1_21_40) { + return util::directAccess(this, 0x590); + } return util::directAccess(this, 0x588); } return nullptr; } SDK::Options* SDK::ClientInstance::getOptions() { - return memory::callVirtual(this, 0xBD); + return memory::callVirtual(this, 0xBE); } void SDK::ClientInstance::grabCursor() { diff --git a/src/sdk/common/client/game/ClientInstance.h b/src/sdk/common/client/game/ClientInstance.h index e9a95ee5..1d40e055 100644 --- a/src/sdk/common/client/game/ClientInstance.h +++ b/src/sdk/common/client/game/ClientInstance.h @@ -5,11 +5,11 @@ namespace SDK { class ClientInstance { public: - MVCLASS_FIELD(class MinecraftGame*, minecraftGame, 0xC8, 0xA8, 0xA8); - MVCLASS_FIELD(class Minecraft*, minecraft, 0xD0, 0xC0, 0xC0); - MVCLASS_FIELD(class LevelRenderer*, levelRenderer, 0xE0, 0xD0, 0xD0); - MVCLASS_FIELD(class ClientInputHandler*, inputHandler, 0x0110, 0x100, 0x100); - MVCLASS_FIELD(struct Vec2, cursorPos, 0x4C8, 0x498, 0x458, 0x458); + MVCLASS_FIELD(class MinecraftGame*, minecraftGame, 0xD0, 0xC8, 0xC8, 0xC8, 0xC8, 0xC8, 0xA8, 0xA8); + MVCLASS_FIELD(class Minecraft*, minecraft, 0xD8, 0xD0, 0xD0, 0xD0, 0xD0, 0xD0, 0xC0, 0xC0); + MVCLASS_FIELD(class LevelRenderer*, levelRenderer, 0xE8, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xD0, 0xD0); + MVCLASS_FIELD(class ClientInputHandler*, inputHandler, 0x118, 0x110, 0x110, 0x110, 0x110, 0x110, 0x100, 0x100); + MVCLASS_FIELD(struct Vec2, cursorPos, 0x4D0, 0x4C8, 0x4C8, 0x4C8, 0x4C8, 0x498, 0x458, 0x458); static ClientInstance* get(); class BlockSource* getRegion(); diff --git a/src/sdk/common/client/game/FontRepository.h b/src/sdk/common/client/game/FontRepository.h index 42782f3c..f5a6b398 100644 --- a/src/sdk/common/client/game/FontRepository.h +++ b/src/sdk/common/client/game/FontRepository.h @@ -4,7 +4,7 @@ namespace SDK { class FontRepository { public: - MVCLASS_FIELD(std::vector>, fontList, 0x20, 0x28, 0x20); + MVCLASS_FIELD(std::vector>, fontList, 0x30, 0x20, 0x20, 0x20, 0x20, 0x20, 0x28, 0x20); class Font* getSmoothFont() { return fontList[7].get(); diff --git a/src/sdk/common/client/game/MinecraftGame.cpp b/src/sdk/common/client/game/MinecraftGame.cpp index b0a1fc9d..410e4708 100644 --- a/src/sdk/common/client/game/MinecraftGame.cpp +++ b/src/sdk/common/client/game/MinecraftGame.cpp @@ -11,6 +11,10 @@ bool SDK::MinecraftGame::isCursorGrabbed() { } SDK::ClientInstance* SDK::MinecraftGame::getPrimaryClientInstance() { + if (SDK::internalVers >= V1_21_40) { + const auto map = reinterpret_cast>*>(reinterpret_cast(this) + 0x828); + return map->at(0).get(); + } //19AAAB62768 // actually a NonOwnerPointer std::shared_ptr inst = nullptr; diff --git a/src/sdk/common/client/game/MinecraftGame.h b/src/sdk/common/client/game/MinecraftGame.h index 1ba0f5fb..ee4cad54 100644 --- a/src/sdk/common/client/game/MinecraftGame.h +++ b/src/sdk/common/client/game/MinecraftGame.h @@ -10,11 +10,14 @@ namespace SDK { MVCLASS_FIELD(std::string, xuid, 0x310, 0x320, 0x318, 0x318, 0x2F8, 0x618, 0x228); private: - MVCLASS_FIELD(class FontRepository**, fontRepo, 0xE08, 0xE00, 0xF60, 0xF30, 0xF20, 0x110, 0xF88); + MVCLASS_FIELD(class FontRepository**, fontRepo, 0xDE0, 0xE08, 0xE00, 0xF60, 0xF30, 0xF20, 0x110, 0xF88); public: - MVCLASS_FIELD(class Font*, minecraftFont, 0xE18, 0xE10, 0xF70, 0xF40, 0xF30, 0x120, 0xF78); + MVCLASS_FIELD(class Font*, minecraftFont, 0xDE8, 0xE18, 0xE10, 0xF70, 0xF40, 0xF30, 0x120, 0xF78); class FontRepository* getFontRepository() { + if (internalVers >= V1_21_40) { + return reinterpret_cast(fontRepo); + } if (internalVers > V1_19_41) { return *fontRepo; } diff --git a/src/sdk/common/client/gui/controls/UIControl.cpp b/src/sdk/common/client/gui/controls/UIControl.cpp index 32c40e46..39290ebe 100644 --- a/src/sdk/common/client/gui/controls/UIControl.cpp +++ b/src/sdk/common/client/gui/controls/UIControl.cpp @@ -4,5 +4,6 @@ #include "sdk/signature/storage.h" void SDK::UIControl::updatePos() { - reinterpret_cast(Signatures::UIControl_setPosition.result)(this); + flags |= 1; + reinterpret_cast(Signatures::UIControl_getPosition.result)(this); } diff --git a/src/sdk/common/client/gui/controls/UIControl.h b/src/sdk/common/client/gui/controls/UIControl.h index 60079736..3c29855a 100644 --- a/src/sdk/common/client/gui/controls/UIControl.h +++ b/src/sdk/common/client/gui/controls/UIControl.h @@ -41,9 +41,7 @@ namespace SDK { char pad_0000[16]; //0x0000 public: Vec2 position; //0x0010 - private: - char pad_0018[8]; //0x0018 - public: + uint64_t flags; //0x0018 std::string name; //0x0020 private: char pad_0040[8]; //0x0040 diff --git a/src/sdk/common/client/input/ClientInputHandler.h b/src/sdk/common/client/input/ClientInputHandler.h index 187a843a..07b51b60 100644 --- a/src/sdk/common/client/input/ClientInputHandler.h +++ b/src/sdk/common/client/input/ClientInputHandler.h @@ -10,6 +10,6 @@ namespace SDK { class ClientInputHandler { public: - MVCLASS_FIELD(ClientInputMappingFactory*, mappingFactory, 0x20, 0x18, 0x18); // ClientInputHandler::getMappingFactory + MVCLASS_FIELD(ClientInputMappingFactory*, mappingFactory, 0x28, 0x20, 0x20, 0x20, 0x20, 0x20, 0x18, 0x18); // ClientInputHandler::getMappingFactory }; } \ No newline at end of file diff --git a/src/sdk/common/client/renderer/game/LevelRenderer.h b/src/sdk/common/client/renderer/game/LevelRenderer.h index 1f98a9cd..4aa5b0bb 100644 --- a/src/sdk/common/client/renderer/game/LevelRenderer.h +++ b/src/sdk/common/client/renderer/game/LevelRenderer.h @@ -4,7 +4,7 @@ namespace SDK { class LevelRenderer { - MVCLASS_FIELD(LevelRendererPlayer*, levelRendererPlayer, 0x308, 0x288, 0x2A8); + MVCLASS_FIELD(LevelRendererPlayer*, levelRendererPlayer, 0x318, 0x308, 0x308, 0x308, 0x308, 0x308, 0x288, 0x2A8); public: LevelRendererPlayer* getLevelRendererPlayer() { if (SDK::internalVers <= V1_19_51 /*1.20+*/) { diff --git a/src/sdk/common/client/renderer/screen/MinecraftUIRenderContext.h b/src/sdk/common/client/renderer/screen/MinecraftUIRenderContext.h index b1408e55..a4dee5b7 100644 --- a/src/sdk/common/client/renderer/screen/MinecraftUIRenderContext.h +++ b/src/sdk/common/client/renderer/screen/MinecraftUIRenderContext.h @@ -51,7 +51,7 @@ namespace SDK { ScreenContext* screenContext; void flushText(float lastFlush) { - memory::callVirtual(this, 6, lastFlush); + memory::callVirtual>(this, 6, lastFlush, {}); } void drawImage(TexturePtr const& texture, Vec2 const& pos, Vec2 const& size, Vec2 const& uvPos, Vec2 const& uvSize) { diff --git a/src/sdk/common/client/renderer/screen/ScreenContext.h b/src/sdk/common/client/renderer/screen/ScreenContext.h index 001272b3..7219eca0 100644 --- a/src/sdk/common/client/renderer/screen/ScreenContext.h +++ b/src/sdk/common/client/renderer/screen/ScreenContext.h @@ -6,7 +6,7 @@ namespace SDK { class ScreenContext { public: CLASS_FIELD(Color*, shaderColor, 0x30); - CLASS_FIELD(class Tessellator*, tess, 0xC0); + CLASS_FIELD(class Tessellator*, tess, 0xC8); struct MatrixPtr { MVCLASS_FIELD(std::stack, matrixStack, 0x40, 0x30, 0x30); diff --git a/src/sdk/common/entity/EntityContext.h b/src/sdk/common/entity/EntityContext.h index 5a0af9d7..c74dcd0d 100644 --- a/src/sdk/common/entity/EntityContext.h +++ b/src/sdk/common/entity/EntityContext.h @@ -56,8 +56,4 @@ namespace SDK { Vec2 rotation; //0x0000 Vec2 rotationOld; //0x0008 }; //Size: 0x0010 - - struct ActorDataFlagComponent { - std::bitset<119> flags; - }; } diff --git a/src/sdk/common/entity/component/ActorDataFlagComponent.h b/src/sdk/common/entity/component/ActorDataFlagComponent.h new file mode 100644 index 00000000..845e5b27 --- /dev/null +++ b/src/sdk/common/entity/component/ActorDataFlagComponent.h @@ -0,0 +1,7 @@ +#pragma once + +namespace SDK { + struct ActorDataFlagComponent { + std::bitset<119> flags; + }; +} diff --git a/src/sdk/common/entity/component/ActorEquipmentComponent.h b/src/sdk/common/entity/component/ActorEquipmentComponent.h new file mode 100644 index 00000000..531d3678 --- /dev/null +++ b/src/sdk/common/entity/component/ActorEquipmentComponent.h @@ -0,0 +1,8 @@ +#pragma once + +namespace SDK { + struct ActorEquipmentComponent { + SDK::Inventory* handContainer; + SDK::Inventory* armorContainer; + }; +} diff --git a/src/sdk/common/entity/component/ActorTypeComponent.h b/src/sdk/common/entity/component/ActorTypeComponent.h new file mode 100644 index 00000000..d539acae --- /dev/null +++ b/src/sdk/common/entity/component/ActorTypeComponent.h @@ -0,0 +1,7 @@ +#pragma once + +namespace SDK { + struct ActorTypeComponent { + uint32_t type; + }; +} diff --git a/src/sdk/common/entity/component/AttributesComponent.h b/src/sdk/common/entity/component/AttributesComponent.h index 68abf1ab..15fb147f 100644 --- a/src/sdk/common/entity/component/AttributesComponent.h +++ b/src/sdk/common/entity/component/AttributesComponent.h @@ -9,6 +9,11 @@ namespace SDK { public: std::unordered_map instances; + private: + char pad[0x18]; + + public: + AttributeInstance* getInstance(unsigned int id) { using func_t = AttributeInstance&(*)(BaseAttributeMap*, unsigned int); static auto func = reinterpret_cast(Signatures::BaseAttributeMap_getInstance.result); diff --git a/src/sdk/common/entity/component/MoveInputComponent.h b/src/sdk/common/entity/component/MoveInputComponent.h index 190f1ff8..b0eef3fd 100644 --- a/src/sdk/common/entity/component/MoveInputComponent.h +++ b/src/sdk/common/entity/component/MoveInputComponent.h @@ -3,7 +3,10 @@ namespace SDK { // or MoveInputHandler in older versions - class MoveInputComponent { + struct MoveInputComponent { + private: + char pad[0x88]; + public: MVCLASS_FIELD(bool, sneak, 0x00, 0x4C, 0x4C); MVCLASS_FIELD(bool, jump, 0x06, 0x4B, 0x4B); diff --git a/src/sdk/common/entity/component/RuntimeIDComponent.h b/src/sdk/common/entity/component/RuntimeIDComponent.h new file mode 100644 index 00000000..2dac599d --- /dev/null +++ b/src/sdk/common/entity/component/RuntimeIDComponent.h @@ -0,0 +1,7 @@ +#pragma once + +namespace SDK { + struct RuntimeIDComponent { + uint64_t runtimeID; + }; +} diff --git a/src/sdk/common/network/RakNetConnector.h b/src/sdk/common/network/RakNetConnector.h index d1a7d08a..8efd5281 100644 --- a/src/sdk/common/network/RakNetConnector.h +++ b/src/sdk/common/network/RakNetConnector.h @@ -21,10 +21,10 @@ namespace SDK { RakNetConnector() = delete; - MVCLASS_FIELD(std::string, ipAddress, 0x370, 0x438, 0x438, 0x438, 0x3D0, 0x438); - MVCLASS_FIELD(std::string, dns, 0x390, 0x458, 0x458, 0x458, 0x3F0, 0x458); - MVCLASS_FIELD(uint16_t, port, 0x3B0, 0x478, 0x478, 0x478, 0x410, 0x478); - MVCLASS_FIELD(std::string, featuredServer, 0x430, 0x4F8, 0x4F8, 0x4F8, 0x4C8, 0x530); + MVCLASS_FIELD(std::string, ipAddress, 0x378, 0x370, 0x370, 0x438, 0x438, 0x438, 0x3D0, 0x438); + MVCLASS_FIELD(std::string, dns, 0x398, 0x390, 0x390, 0x458, 0x458, 0x458, 0x3F0, 0x458); + MVCLASS_FIELD(uint16_t, port, 0x3B8, 0x3B0, 0x3B0, 0x478, 0x478, 0x478, 0x410, 0x478); + MVCLASS_FIELD(std::string, featuredServer, 0x438, 0x430, 0x430, 0x4F8, 0x4F8, 0x4F8, 0x4C8, 0x530); class RakPeer* getPeer() { if (internalVers > V1_18_12) { diff --git a/src/sdk/common/world/Minecraft.cpp b/src/sdk/common/world/Minecraft.cpp index c9fb467d..6aa4b1db 100644 --- a/src/sdk/common/world/Minecraft.cpp +++ b/src/sdk/common/world/Minecraft.cpp @@ -13,6 +13,8 @@ SDK::Level* SDK::Minecraft::getLevel() { } if (gameSession) { + if (SDK::internalVers >= V1_21_40) + return reinterpret_cast(gameSession->level); auto v2 = gameSession->level; if (v2) return *v2; diff --git a/src/sdk/common/world/Minecraft.h b/src/sdk/common/world/Minecraft.h index 323adea6..3cdecc74 100644 --- a/src/sdk/common/world/Minecraft.h +++ b/src/sdk/common/world/Minecraft.h @@ -8,12 +8,12 @@ namespace SDK { public: Level* getLevel(); - CLASS_FIELD(class GameSession*, gameSession, 0xC0); - CLASS_FIELD(Timer*, timer, 0xD8); + CLASS_FIELD(class GameSession*, gameSession, 0xC8); + CLASS_FIELD(Timer*, timer, 0xE0); }; class GameSession { public: - MVCLASS_FIELD(Level**, level, 0x30, 0x28 /*1.20.40*/, 0x20, 0x20, 0x20); + MVCLASS_FIELD(Level**, level, 0x40, 0x30, 0x30, 0x30, 0x28 /*1.20.40*/, 0x20, 0x20, 0x20); }; } \ No newline at end of file diff --git a/src/sdk/common/world/actor/Actor.cpp b/src/sdk/common/world/actor/Actor.cpp index 09b12920..f24990aa 100644 --- a/src/sdk/common/world/actor/Actor.cpp +++ b/src/sdk/common/world/actor/Actor.cpp @@ -4,6 +4,11 @@ #include "sdk/common/world/Attribute.h" #include +#include "sdk/common/entity/component/ActorDataFlagComponent.h" +#include "sdk/common/entity/component/ActorEquipmentComponent.h" +#include "sdk/common/entity/component/ActorTypeComponent.h" +#include "sdk/common/entity/component/RuntimeIDComponent.h" + SDK::ActorDataFlagComponent* SDK::Actor::getActorDataFlagsComponent() { return reinterpret_cast(Signatures::Components::actorDataFlagsComponent.result)(entityContext.getBasicRegistry(), &entityContext.getId()); } @@ -69,7 +74,7 @@ Vec3& SDK::Actor::getPosOld() { int SDK::Actor::getCommandPermissionLevel() { // @dump-wbds vtable Actor, getCommandPermissionLevel - return memory::callVirtual(this, mvGetOffset<0x6B, 0x6D, 0x7C, 0xB5, 0xCC, 0xCD>()); + return memory::callVirtual(this, mvGetOffset<0x6A, 0x6B, 0x6B, 0x6D, 0x7C, 0xB5, 0xCC, 0xCD>()); } int64_t SDK::Actor::getRuntimeID() { @@ -89,7 +94,7 @@ uint8_t SDK::Actor::getEntityTypeID() { void SDK::Actor::swing() { // @dump-wbds vtable Actor, swing - return memory::callVirtual(this, SDK::mvGetOffset<0x73, 0x75, 0x86, 0xC4, 0xDB, 0xDC>()); + return memory::callVirtual(this, SDK::mvGetOffset<0x72, 0x73, 0x73, 0x75, 0x86, 0xC4, 0xDB, 0xDC>()); } bool SDK::Actor::isPlayer() { diff --git a/src/sdk/common/world/actor/Actor.h b/src/sdk/common/world/actor/Actor.h index f8357afa..85c5d27f 100644 --- a/src/sdk/common/world/actor/Actor.h +++ b/src/sdk/common/world/actor/Actor.h @@ -4,6 +4,8 @@ #include "sdk/common/util/MolangVariableMap.h" #include +#include "sdk/common/entity/component/ActorDataFlagComponent.h" + namespace SDK { class Actor { public: @@ -51,4 +53,4 @@ namespace SDK { bool isInvisible(); class ItemStack* getArmor(int armorSlot); }; -} \ No newline at end of file +} diff --git a/src/sdk/common/world/actor/player/Player.cpp b/src/sdk/common/world/actor/player/Player.cpp index 80741415..294fc715 100644 --- a/src/sdk/common/world/actor/player/Player.cpp +++ b/src/sdk/common/world/actor/player/Player.cpp @@ -8,7 +8,7 @@ void SDK::Player::displayClientMessage(std::string const& message) { if (internalVers >= V1_21_20) { std::optional opt = {}; - memory::callVirtual(this, 0xD2, message, opt); + memory::callVirtual(this, mvGetOffset<0xCE, 0xD2, 0xD2, 0x0, 0x0, 0x0, 0x0, 0x0>(), message, opt); return; } memory::callVirtual(this, mvGetOffset<0xEF, 0x15E, 0x184, 0x18A>(), message); @@ -34,5 +34,5 @@ SDK::MoveInputComponent* SDK::Player::getMoveInputComponent() { } std::string SDK::Player::getXUID() { - return memory::callVirtual(this, SDK::mvGetOffset<0xF3, 0xF6, 0x18C, 0x1B6, 0x1BC>()); + return memory::callVirtual(this, SDK::mvGetOffset<0xF2, 0xF3, 0xF3, 0xF6, 0x18C, 0x1B6, 0x1BC>()); } diff --git a/src/sdk/common/world/actor/player/Player.h b/src/sdk/common/world/actor/player/Player.h index 463a7969..0d9729f3 100644 --- a/src/sdk/common/world/actor/player/Player.h +++ b/src/sdk/common/world/actor/player/Player.h @@ -17,10 +17,10 @@ namespace SDK { // @dump-wbds Player::getSupplies, 3 MVCLASS_FIELD(PlayerInventory*, supplies, 0x628, 0x760, 0x7C0, 0x7C0, 0xB70, 0xDB8); // xref: getSupplies // @dump-wbds Player::getGameMode, 3 - MVCLASS_FIELD(GameMode*, gameMode, 0xB18, 0xB00, 0xEC8, 0xEB0, 0xE70, 0x1238, 0x1670); // xref: getGameMode + MVCLASS_FIELD(GameMode*, gameMode, 0xB28, 0xB18, 0xB00, 0xEC8, 0xEB0, 0xE70, 0x1238, 0x1670); // xref: getGameMode // @dump-wbds Player::getName, 3 - MVCLASS_FIELD(std::string, playerName, 0xCA0, 0xC88, 0x1D30, 0x1CB8, 0x1C78, 0x8C0, 0x2478); // xref: getName + MVCLASS_FIELD(std::string, playerName, 0xCB0, 0xCA0, 0xC88, 0x1D30, 0x1CB8, 0x1C78, 0x8C0, 0x2478); // xref: getName // @dump-wbds ServerPlayer::sendNetworkPacket, 18 - MVCLASS_FIELD(PacketSender*, packetSender, 0x890, 0xC48, 0xC70, 0xC70, 0x1020, 0x1438); // xref: Player::Player a3 + MVCLASS_FIELD(PacketSender*, packetSender, 0x8A0, 0x890, 0x890, 0xC48, 0xC70, 0xC70, 0x1020, 0x1438); // xref: Player::Player a3 }; } \ No newline at end of file diff --git a/src/sdk/common/world/level/Dimension.h b/src/sdk/common/world/level/Dimension.h index 4ea0c36c..9a6a4ded 100644 --- a/src/sdk/common/world/level/Dimension.h +++ b/src/sdk/common/world/level/Dimension.h @@ -7,6 +7,7 @@ namespace SDK { public: CLASS_FIELD(std::string, dimensionName, 0x20); // reclass CLASS_FIELD(class BlockSource*, region, 0xC0); // xref: Actor::getBlockSource something like that + CLASS_FIELD(class Weather*, weather, 0x1B0); CLASS_FIELD(class VillageManager*, villageManager, 0x588); // xref: getVillageManager }; } \ No newline at end of file diff --git a/src/sdk/common/world/level/Level.cpp b/src/sdk/common/world/level/Level.cpp index c4806809..0baf7bd1 100644 --- a/src/sdk/common/world/level/Level.cpp +++ b/src/sdk/common/world/level/Level.cpp @@ -2,13 +2,13 @@ #include "Level.h" void SDK::Level::playSoundEvent(std::string const& text, Vec3 const& pos, float vol, float pitch) { - static int index = mvGetOffset<0xA2, 0xA3, 0xA3, 0xBD, 0xC9>(); + static int index = mvGetOffset<0xB2, 0xA2, 0xA2, 0xA2, 0xA3, 0xA3, 0xBD, 0xC9>(); memory::callVirtual(this, index, text, pos, vol, pitch); } std::vector SDK::Level::getRuntimeActorList() { std::vector list; - static int index = mvGetOffset<0x117, 0x116, 0x125, 0x125, 0x12D, 0x13C>(); + static int index = mvGetOffset<0x134, 0x117, 0x117, 0x116, 0x125, 0x125, 0x12D, 0x13C>(); // TODO: this might return a vector too? memory::callVirtual&>(this, index, list); @@ -16,22 +16,26 @@ std::vector SDK::Level::getRuntimeActorList() { } std::unordered_map* SDK::Level::getPlayerList() { + if (internalVers >= SDK::V1_21_40) { + return reinterpret_cast*>(reinterpret_cast(this) + 0xBF0); + } + static int index = SDK::mvGetOffset<0x112, 0x111, 0x120, 0x120, 0x128, 0x137>(); return memory::callVirtual*>(this, index); } SDK::HitResult* SDK::Level::getHitResult() { - static int index = mvGetOffset<0x121, 0x120, 0x12E, 0x12E, 0x139, 0x148>(); + static int index = mvGetOffset<0x13E, 0x121, 0x121, 0x120, 0x12E, 0x12E, 0x139, 0x148>(); return memory::callVirtual(this, index); } SDK::HitResult* SDK::Level::getLiquidHitResult() { - static int index = mvGetOffset<0x122, 0x121, 0x12F, 0x12F, 0x13A, 0x149>(); + static int index = mvGetOffset<0x13F, 0x122, 0x122, 0x121, 0x12F, 0x12F, 0x13A, 0x149>(); return reinterpret_cast(memory::callVirtual(this, index)) /*sizeof hitResult (0x60) / 8*/; } bool SDK::Level::isClientSide() { - return memory::callVirtual(this, SDK::mvGetOffset<0x111, 0x110, 0x11F, 0x11F, 0x12B, 0x127>()); + return memory::callVirtual(this, SDK::mvGetOffset<0x12C, 0x111, 0x111, 0x110, 0x11F, 0x11F, 0x12B, 0x127>()); } const std::string& SDK::Level::getLevelName() { diff --git a/src/sdk/common/world/level/Level.h b/src/sdk/common/world/level/Level.h index 82dec99e..5f1ca958 100644 --- a/src/sdk/common/world/level/Level.h +++ b/src/sdk/common/world/level/Level.h @@ -24,7 +24,7 @@ namespace SDK { class HitResult* getLiquidHitResult(); bool isClientSide(); - MVCLASS_FIELD(std::shared_ptr, levelData, 0xF8); + MVCLASS_FIELD(std::shared_ptr, levelData, 0x110, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8); MVCLASS_FIELD(std::string, name, 0x290, 0x6C8, 0x698, 0x678, 0x5B8, 0x548); const std::string& getLevelName(); diff --git a/src/sdk/signature/storage_latest.h b/src/sdk/signature/storage_latest.h index 534b3b13..604e74cc 100644 --- a/src/sdk/signature/storage_latest.h +++ b/src/sdk/signature/storage_latest.h @@ -15,7 +15,7 @@ class Signatures { //89 86 ? ? ? ? 8b 43 ? 89 86 ? ? ? ? 8b 43 ? 89 86 ? ? ? ? 8b 43 ? 89 86 ? ? ? ? 8b 43 ? f3 0f 10 0d inline static SigImpl LevelRendererPlayer_origin{[](memory::signature_store& store, uintptr_t) { return store.ref(4); }, - "F3 0F 58 BB ? ? ? ? 48 8B 8B ? ? ? ?"_sig, + "F3 0F 58 BB ? ? ? ? 45 0F 57 C9"_sig, "LevelRendererPlayer->origin"}; }; @@ -23,14 +23,14 @@ class Signatures { inline static SigImpl clientInstance{}; inline static SigImpl minecraftGamePointer {[](memory::signature_store& store, uintptr_t) { return store.deref(3); }, - "48 89 0d ? ? ? ? 48 8b 00"_sig, + "48 89 0D ? ? ? ? 48 8B 08"_sig, "MinecraftGame"}; inline static SigImpl clickMap{[](memory::signature_store& store, uintptr_t) { return store.deref(2); }, - "89 0D ? ? ? ? 40 B5"_sig, // MouseDevice::_instance + "89 0D ? ? ? ? 41 B7"_sig, // MouseDevice::_instance "ClickMap"}; inline static SigImpl uiColorMaterial{[](memory::signature_store& store, uintptr_t) { return store.deref(3); }, - "48 8B 0D ? ? ? ? 48 85 C9 0F 84 C9 01 00 00"_sig, + "48 8B 05 ? ? ? ? 4C 8B AD"_sig, "UIFillColorMaterial"}; inline static SigImpl thirdPersonNametag{ [](memory::signature_store&, uintptr_t res) { return res; }, "0F 84 ? ? ? ? 49 8B D4 49 8B CD"_sig, @@ -41,34 +41,34 @@ class Signatures { struct Components { inline static SigImpl moveInputComponent{[](memory::signature_store&, uintptr_t res) { return res; }, // last 4 bytes is the hash of the component - "48 89 5C 24 08 57 48 83 EC 30 48 8B DA BA 2E CD 8B 46"_sig, + "4C 8B 41 48 4C 8B D1 48 8B 41 50 4C 8B 49 68 49 2B C0 8B 12 48 C1 F8 03 48 FF C8 25 2E CD 8B 46"_sig, "MoveInputComponent::try_get"}; inline static SigImpl runtimeIDComponent{[](memory::signature_store&, uintptr_t res) { return res; }, // last 4 bytes is the hash of the component - "48 89 5C 24 08 57 48 83 EC 30 48 8B DA BA 14 14 A1 3C"_sig, + "4C 8B 41 48 4C 8B D1 48 8B 41 50 4C 8B 49 68 49 2B C0 8B 12 48 C1 F8 03 48 FF C8 25 14 14 A1 3C"_sig, "ActorRuntimeIDComponent"}; inline static SigImpl actorTypeComponent{[](memory::signature_store&, uintptr_t res) { return res; }, // last 4 bytes is the hash of the component - "48 89 5C 24 08 57 48 83 EC 30 48 8B DA BA 14 AD F3 51"_sig, + "4C 8B 41 48 4C 8B D1 48 8B 41 50 4C 8B 49 68 49 2B C0 8B 12 48 C1 F8 03 48 FF C8 25 14 AD F3 51"_sig, "ActorTypeComponent"}; //51F3AD14 inline static SigImpl attributesComponent{[](memory::signature_store&, uintptr_t res) { return res; }, // last 4 bytes is the hash of the component - "48 89 5C 24 08 57 48 83 EC 30 48 8B DA BA 44 94 B2 B6"_sig, + "48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 30 8B 59 18 48 8B FA 48 8B 49 10 BA 44 94 B2 B6"_sig, "AttributesComponent"}; inline static SigImpl actorEquipmentPersistentComponent{ [](memory::signature_store&, uintptr_t res) { return res; }, // last 4 bytes is the hash of the component - "4C 8B 41 48 4C 8B C9 48 8B 41 50 4C 8B 51 68 49 2B C0 48 C1 F8 03 48 FF C8 25 36 48 C4 71"_sig, + "4C 8B 41 48 4C 8B D1 48 8B 41 50 4C 8B 49 68 49 2B C0 8B 12 48 C1 F8 03 48 FF C8 25 36 48 C4 71"_sig, "struct ActorEquipmentComponent" }; //76 59 47 33 inline static SigImpl actorDataFlagsComponent{ [](memory::signature_store&, uintptr_t res) { return res; }, // last 4 bytes is the hash of the component - "48 89 5C 24 08 57 48 83 EC 30 48 8B DA BA 76 59 47 33"_sig, + "4C 8B 41 48 4C 8B D1 48 8B 41 50 4C 8B 49 68 49 2B C0 8B 12 48 C1 F8 03 48 FF C8 25 76 59 47 33"_sig, "struct ActorDataFlagsComponent"}; }; @@ -77,13 +77,13 @@ class Signatures { "48 8d 05 ? ? ? ? 48 89 01 33 d2 48 89 51 ? 0f 57 c0 48 89 51 ? 48 8b c1 89 51"_sig, "const TextPacket::`vftable'"}; inline static SigImpl CommandRequestPacket{[](memory::signature_store& store, uintptr_t) { return store.deref(3); }, - "48 89 5C 24 10 48 89 74 24 18 57 48 83 EC 40 48 8B F9 33 F6 E8 ? ? ? ? 48 8B C8 48 8B 10 48 8B 42 08 BA A8 00 00 00 FF 15 ? ? ? ? 48 8B D8 48 85 C0 75 69 48 8D 05 ? ? ? ? 48 C7 44 24 28 A8 00 00 00 4C 8D 0D ? ? ? ? 48 89 44 24 20 44 8D 46 13 48 8D 15 ? ? ? ? 48 8D 0D ? ? ? ? E8 ? ? ? ? 84 C0 74 32 C7 04 25 00 00 00 00 DE C0 AD DE 48 8B DE 48 8B 74 24 60 48 8D 43 10 0F 57 C0 0F 11 07 48 89 07 48 8B C7 48 89 5F 08 48 8B 5C 24 58 48 83 C4 40 5F C3 48 85 DB 74 D4 C7 43 08 01 00 00 00 48 8D 05 ? ? ? ? 48 89 03 0F"_sig, + "48 8D 05 ? ? ? ? 48 89 45 ? 49 8B D5 48 8D 4D ? E8 ? ? ? ? 90 49 8B 4D"_sig, "const CommandRequestPacket::`vftable'"}; // "Client%d camera ticking system" // 1st of 3 data LEA's inline static SigImpl Level{[](memory::signature_store& store, uintptr_t) { return store.deref(3); }, - "48 8D 05 ? ? ? ? 48 89 03 48 8D 05 ? ? ? ? 48 89 43 ? 48 8D 05 ? ? ? ? 48 89 43 ? 48 8D BB"_sig, + "48 8D 05 ? ? ? ? 48 89 07 48 8D 05 ? ? ? ? 48 89 47 ? 48 8D 05 ? ? ? ? 48 89 47 ? B9"_sig, "const Level::`vftable'"}; inline static SigImpl SetTitlePacket{[](memory::signature_store& store, uintptr_t) { return store.deref(3); }, "48 8d 05 ? ? ? ? 48 89 01 89 51 ? 48 83 c1 ? 0f 57 c0 0f 11 01 48 89 79"_sig, @@ -95,7 +95,7 @@ class Signatures { }; inline static SigImpl LevelRenderer_renderLevel{[](memory::signature_store&, uintptr_t res) { return res; }, - "48 89 5C 24 ? 48 89 74 24 ? 57 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 84 24 ? ? ? ? 49 8B F8 48 8B DA 48 8B F1 33 D2"_sig, + "48 89 5C 24 ? 55 56 57 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 84 24 ? ? ? ? 49 8B F8 48 8B DA 48 8B E9 33 D2"_sig, "LevelRenderer::renderLevel"}; inline static SigImpl Keyboard_feed{[](memory::signature_store&, uintptr_t res) { return res; }, @@ -104,11 +104,11 @@ class Signatures { // The signature is big but it hasn't died in a while soo inline static SigImpl Options_getGamma{[](memory::signature_store&, uintptr_t res) { return res; }, - "48 83 EC ? 80 B9 ? ? ? ? ? 48 8D 54 24 ? 48 8B 01 48 8B 40 ? 74 ? 41 B8 ? ? ? ? FF 15 ? ? ? ? 48 8B 10 48 85 D2 74 ? 48 8B 42 ? 48 8B 88 ? ? ? ? 48 85 C9 74 ? E8 ? ? ? ? 48 83 C4 ? C3 F3 0F 10 42 ? 48 83 C4 ? C3 41 B8 ? ? ? ? FF 15 ? ? ? ? 48 8B 10 48 85 D2 75 ? E8 ? ? ? ? CC E8 ? ? ? ? CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC 40 53 48 83 EC ? 48 8B 01"_sig, + "48 83 EC ? 80 B9 ? ? ? ? ? 48 8D 54 24 ? 48 8B 01 48 8B 40 ? 74 ? 41 B8 ? ? ? ? FF 15 ? ? ? ? 48 8B 10 48 85 D2 74 ? 48 8B 42 ? 48 8B 88 ? ? ? ? 48 85 C9 74 ? E8 ? ? ? ? 48 83 C4 ? C3 F3 0F 10 42 ? 48 83 C4 ? C3 41 B8 ? ? ? ? FF 15 ? ? ? ? 48 8B 10 48 85 D2 75 ? E8 ? ? ? ? CC E8 ? ? ? ? CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC 48 89 5C 24"_sig, "Options::getGamma"}; inline static SigImpl Options_getPerspective{[](memory::signature_store&, uintptr_t res) { return res; }, - "48 83 ec ? 48 8b 01 48 8d 54 24 ? 41 b8 ? ? ? ? 48 8b 40 ? ff 15 ? ? ? ? 48 8b 10 48 85 d2 74 ? 48 8b 42 ? 48 8b 88 ? ? ? ? 48 85 c9 74 ? e8 ? ? ? ? 48 83 c4 ? c3 8b 42 ? 48 83 c4 ? c3 e8 ? ? ? ? cc cc cc cc cc 48 83 ec ? 48 8b 01 48 8d 54 24 ? 41 b8 ? ? ? ? 48 8b 40 ? ff 15 ? ? ? ? 48 8b 10 48 85 d2 74 ? 48 8b 42 ? 48 8b 88 ? ? ? ? 48 85 c9 74 ? e8 ? ? ? ? 48 83 c4 ? c3 8b 42 ? 48 83 c4 ? c3 e8 ? ? ? ? cc cc cc cc cc 48 89 5c 24 ? 57 48 83 ec ? 48 8b 01 0f b6 fa 41 b8 ? ? ? ? 48 8d 54 24 ? 48 8b 40 ? ff 15 ? ? ? ? 48 8b 18 48 85 db 74 ? 48 8b 43 ? 48 83 b8 ? ? ? ? ? 75 ? 48 8b cb e8 ? ? ? ? 84 c0 74 ? 41 b0 ? 40 0f b6 d7 48 8b cb e8 ? ? ? ? 48 8b 5c 24 ? 48 83 c4 ? 5f c3 e8 ? ? ? ? cc cc cc cc cc cc cc cc cc cc 48 83 ec ? 48 8b 01 48 8d 54 24 ? 41 b8 ? ? ? ? 48 8b 40 ? ff 15 ? ? ? ? 48 8b 10 48 85 d2 74 ? 48 8b 42 ? 48 8b 88 ? ? ? ? 48 85 c9 74 ? e8 ? ? ? ? 48 83 c4 ? c3 0f b6 42 ? 48 83 c4 ? c3 e8 ? ? ? ? cc cc cc cc 40 53"_sig, + "48 83 EC ? 48 8B 01 48 8D 54 ? ? 41 B8 03 00 00 00"_sig, "Options::getPerspective"}; inline static SigImpl Options_getHideHand{[](memory::signature_store&, uintptr_t res) { return res; }, @@ -132,16 +132,15 @@ class Signatures { // callsites inline static SigImpl ChatScreenController_sendChatMessage{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, - "e8 ? ? ? ? 3c ? 75 ? 48 8b 8b"_sig, + "E8 ? ? ? ? 3C ? 75 ? 48 8B 8F"_sig, "ClientInstanceScreenModel::sendChatMessage"}; inline static SigImpl GameRenderer__renderCurrentFrame{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, - "e8 ? ? ? ? 90 48 8d 8d ? ? ? ? e8 ? ? ? ? 90 48 8d 8d ? ? ? ? e8 ? ? ? ? 49 8b 84 24"_sig, + "E8 ? ? ? ? 90 EB ? 41 80 BF"_sig, "GameRenderer::_renderCurrentFrame"}; // near "and (displayProperties/realmsPlusEndDate" (below it 1 arg func with 1 arg called src) - //48 89 5c 24 ? 48 89 74 24 ? 57 48 83 ec ? 48 8b f1 c6 81 ? ? ? ? ? 48 8d b9 ? ? ? ? 48 89 7c 24 ? 48 8b cf ff 15 ? ? ? ? 85 c0 74 ? 8b c8 ff 15 ? ? ? ? 90 48 8b 5e ? 48 8b 1b 80 7b ? ? 75 ? 0f 1f 84 00 ? ? ? ? 48 8b 4b ? 48 8b 01 48 8b 40 ? ff 15 ? ? ? ? 48 8b 43 ? 80 78 ? ? 74 ? 48 8b 43 ? 80 78 ? ? 75 ? 48 3b 58 ? 75 ? 48 8b d8 48 8b 40 ? 80 78 ? ? 74 ? 48 8b d8 eb ? 48 8b d8 48 8b 08 80 79 ? ? 75 ? 0f 1f 80 ? ? ? ? 48 8b d9 48 8b 01 48 8b c8 80 78 ? ? 74 ? 80 7b ? ? 74 ? c7 86 ? ? ? ? ? ? ? ? 48 8b cf 48 8b 5c 24 ? 48 8b 74 24 ? 48 83 c4 ? 5f 48 ff 25 ? ? ? ? cc cc cc cc cc cc cc cc 48 89 5c 24 ? 48 89 74 24 - inline static SigImpl AppPlatform__fireAppFocusLost{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, - "E8 ? ? ? ? 4C 8B B3 58 07 00 00"_sig, + inline static SigImpl AppPlatform__fireAppFocusLost{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, // Call in question is inlined, this is not the correct name anymore + "E8 ? ? ? ? 48 8B 7B ? 0F 1F 80"_sig, "AppPlatform::_fireAppFocusLost"}; inline static SigImpl onClick{[](memory::signature_store&, uintptr_t res) { return res; }, @@ -160,7 +159,7 @@ class Signatures { "MinecraftGame::onAppSuspended"}; // "OnAppSuspend" "SuspendAudio" "CancelJoinGameTelemetry" inline static SigImpl RenderController_getOverlayColor{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, - "E8 ? ? ? ? E9 FD 02 00 00 8B 46 18"_sig, + "E8 ? ? ? ? 0F 28 05 ? ? ? ? 0F 11 85"_sig, "RenderController::getOverlayColor"}; inline static SigImpl ScreenView_setupAndRender{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, @@ -175,9 +174,8 @@ class Signatures { "e8 ? ? ? ? 48 8b 8b ? ? ? ? ba ? ? ? ? 48 83 c4"_sig, "MinecraftGame::_update"}; - // "Nat Punch timed out" inline static SigImpl RakNetConnector_tick{[](memory::signature_store&, uintptr_t res) { return res; }, - "4C 8B DC 49 89 5B ? 49 89 73 ? 57 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 84 24 ? ? ? ? 48 8B F9 49 C7 43"_sig, + "4C 8B DC 49 89 5B ? 49 89 6B ? 56 57 41 56 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 84 24 ? ? ? ? 48 8B F1 33 ED"_sig, "RakNetConnector::tick"}; // ref: your GPU ("AMD Radeon RX 5500") @@ -187,16 +185,16 @@ class Signatures { // ref: RakPeer vtable inline static SigImpl RakPeer_GetAveragePing{[](memory::signature_store&, uintptr_t res) { return res; }, - "48 81 ec ? ? ? ? 4c 8b d1 48 8d 4c 24 ? e8 ? ? ? ? 48 8b d0 45 33 c0 45 33 c9 49 8b ca e8 ? ? ? ? 4c 8b c0"_sig, + "48 8B C4 48 81 EC ? ? ? ? 0F 10 4A ? 4C 8B 1A 4C 3B 1D ? ? ? ? 0F 29 70 ? 0F 29 78 ? 0F 10 7A ? 0F 11 4C 24 ? 74 ? 44 8B 49"_sig, "RakPeer::GetAveragePing"}; inline static SigImpl LocalPlayer_applyTurnDelta{[](memory::signature_store&, uintptr_t res) { return res; }, - "48 8b c4 48 89 58 ? 48 89 70 ? 55 57 41 54 41 56 41 57 48 8d 68 ? 48 81 ec ? ? ? ? 0f 29 70 ? 0f 29 78 ? 44 0f 29 40 ? 44 0f 29 48 ? 44 0f 29 50 ? 48 8b 05 ? ? ? ? 48 33 c4 48 89 45 ? 4c 8b e2"_sig, + "48 89 74 24 ? 57 48 81 EC ? ? ? ? 48 8D 4A ? 48 8B F2"_sig, "LocalPlayer::applyTurnDelta"}; // see what accesses things in moveinputhandler inline static SigImpl MovePlayer{[](memory::signature_store&, uintptr_t res) { return res; }, - "4c 89 4c 24 ? 48 89 54 24 ? 48 89 4c 24 ? 55 56 57 48 8d 6c 24"_sig, + "4C 89 4C 24 ? 4C 89 44 24 ? 48 89 54 24 ? 48 89 4C 24 ? 55 57"_sig, "MovePlayer"}; inline static SigImpl MoveInputHandler_tick{}; @@ -214,7 +212,7 @@ class Signatures { "CameraViewBob"}; inline static SigImpl ItemStackBase_getHoverName{[](memory::signature_store&, uintptr_t res) { return res; }, - "48 89 5C 24 ? 55 56 57 48 81 EC ? ? ? ? 48 8B F2 48 8B F9 48 89 54 24 ? 33 ED"_sig, + "48 89 5C 24 ? 55 56 57 41 56 41 57 48 8D 6C 24 ? 48 81 EC ? ? ? ? 48 8B FA 48 8B D9"_sig, "ItemStackBase::getHoverName"}; @@ -223,7 +221,7 @@ class Signatures { "Tessellator::vertex"}; inline static SigImpl Tessellator_begin{[](memory::signature_store&, uintptr_t res) { return res; }, - "48 89 5C 24 ? 57 48 83 EC ? 80 B9 ? ? ? ? ? 45 0F B6"_sig, + "40 53 55 48 83 EC ? 80 B9 ? ? ? ? ? 44 0F B6 D2"_sig, "Tessellator::begin"}; inline static SigImpl Tessellator_color{[](memory::signature_store&, uintptr_t res) { return res; }, @@ -231,7 +229,7 @@ class Signatures { "Tessellator::color"}; inline static SigImpl MeshHelpers_renderMeshImmediately{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, - "E8 ? ? ? ? C6 47 38 ? F3 0F 10 ? ? ? ? ? 0F 57 D2"_sig, + "E8 ? ? ? ? 41 C6 44 24 ? ? F3 0F 10 1D"_sig, "MeshHelpers::renderMeshImmediately"}; inline static SigImpl BaseActorRenderContext_BaseActorRenderContext{[](memory::signature_store&, uintptr_t res) { return res; }, @@ -242,34 +240,33 @@ class Signatures { "40 55 53 56 57 41 54 41 55 41 56 41 57 48 8D 6C 24 D8 48 81 EC 28 01 00 00 0F 29 B4 24 10 01 00 00 48 8B 05 ? ? ? ? 48 33 C4 48 89 45 00 44"_sig, "ItemRenderer::renderGuiItemNew"}; - // TODO: this is actually BaseAttributeMap::getInstance inline static SigImpl BaseAttributeMap_getInstance{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, "E8 ? ? ? ? F3 0F 10 90"_sig, "BaseAttributeMap::getInstance"}; - inline static SigImpl UIControl_setPosition{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, - "e8 ? ? ? ? f3 41 0f 10 74 24 ? f3 0f 10 3d"_sig, - "UIControl::setPosition"}; + inline static SigImpl UIControl_getPosition{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, + "E8 ? ? ? ? 44 8D 7E"_sig, + "UIControl::getPosition"}; inline static SigImpl MinecraftGame_getPrimaryClientInstance{[](memory::signature_store&, uintptr_t res) { return res; }, - "40 53 48 83 ec ? 48 8b da 48 8b 91 ? ? ? ? 48 8b ca"_sig, + "48 8B 91 ? ? ? ? 48 8B CA 48 8B 42 ? 80 78 ? ? 75 ? 48 8B C8 48 8B 00 80 78 ? ? 74 ? 80 79 ? ? 75 ? 80 79 ? ? 76 ? 48 8B CA 48 3B CA"_sig, "MinecraftGame::getPrimaryClientInstance"}; inline static SigImpl ActorRenderDispatcher_render{[](memory::signature_store&, uintptr_t res) { return res; }, - "48 89 5c 24 ? 55 56 57 41 54 41 55 41 56 41 57 48 8d 6c 24 ? 48 81 ec ? ? ? ? 48 8b 05 ? ? ? ? 48 33 c4 48 89 45 ? 4d 8b e9 49 8b d8 48 8b fa 4c 8b f9"_sig, + "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 ? 4C 89 4C 24 ? 49 8B F8"_sig, "ActorRenderDispatcher::render"}; // "No renderer found - have you set the entity's description:identifier correctly?" - inline static SigImpl LevelRendererPlayer_renderOutlineSelection{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, - "e8 ? ? ? ? 48 83 c4 ? 41 5f 41 5e 41 5d 5e 5d c3 0f b6 84 24"_sig, + inline static SigImpl LevelRendererPlayer_renderOutlineSelection{[](memory::signature_store& storage, uintptr_t) { return storage.deref(1); }, + "E8 ? ? ? ? 90 48 8D 8D ? ? ? ? E8 ? ? ? ? 48 8B 86 ? ? ? ? 48 85 C0 0F 84 ? ? ? ? 80 38 ? 0F 84 ? ? ? ? 48 8B 86 ? ? ? ? 48 85 C0 74 ? F0 FF 40 ? 48 8B 86"_sig, "LevelRendererPlayer::renderOutlineSelection"}; - inline static SigImpl Dimension_getTimeOfDay{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, - "e8 ? ? ? ? 0f 28 c8 0f 57 c0 f3 0f 59 0d ? ? ? ? f3 0f 58 c9"_sig, + inline static SigImpl Dimension_getTimeOfDay{[](memory::signature_store&, uintptr_t res) { return res; }, + "44 8B C2 B8 ? ? ? ? F7 EA"_sig, "Dimension::getTimeOfDay"}; - inline static SigImpl Weather_tick{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, - "e8 ? ? ? ? 48 8b 8f ? ? ? ? e8 ? ? ? ? 48 8b 8f ? ? ? ? 48 8b 01 48 8b 80"_sig, - "Weather::tick"}; + inline static SigImpl Dimension_tick{[](memory::signature_store&, uintptr_t res) { return res; }, + "48 8B C4 48 89 58 ? 48 89 70 ? 48 89 78 ? 55 41 54 41 55 41 56 41 57 48 8D 68 ? 48 81 EC ? ? ? ? 0F 29 70 ? 0F 29 78 ? 44 0F 29 40 ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 45 ? 48 8B F1"_sig, + "Dimension::tick"}; inline static SigImpl Dimension_getSkyColor{[](memory::signature_store&, uintptr_t res) { return res; }, "41 0F 10 08 48 8B C2 0F 28 D3"_sig, @@ -280,7 +277,7 @@ class Signatures { "ItemStackBase::getDamageValue" }; inline static SigImpl MinecraftPackets_createPacket{ [](memory::signature_store&, uintptr_t res) { return res; }, - "40 53 48 83 EC ? 45 33 C0 48 8B D9 81 FA"_sig, + "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 84 24 ? ? ? ? 48 8B F9 48 89 4C 24 ? 33 ED 81 FA"_sig, "MinecraftPackets::createPacket" }; inline static SigImpl GameMode_attack{ [](memory::signature_store&, uintptr_t res) { return res; }, @@ -288,7 +285,7 @@ class Signatures { "GameMode::attack" }; inline static SigImpl GuiData__addMessage{ [](memory::signature_store&, uintptr_t res) { return res; }, - "40 53 55 56 57 41 54 41 56 41 57 48 83 EC ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 44 24 ? 45 8B F8 48 8B F2"_sig, + "48 89 5C 24 ? 55 56 57 41 56 41 57 48 83 EC ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 44 24 ? 45 8B F0 48 8B FA"_sig, "GuiData::_addMessage(MessageContext*, UIProfanityContext)" }; inline static SigImpl Actor_getArmor{ [](memory::signature_store& store, uintptr_t) { return store.deref(1); }, @@ -296,8 +293,8 @@ class Signatures { "Actor::getArmor" }; inline static SigImpl _updatePlayer{ [](memory::signature_store&, uintptr_t res) { return res; }, - "4C 8B DC 49 89 73 10"_sig, - "anonymous namespace::_updatePlayer" }; // F3 0F 11 45 17 0F 28 C7 + "4C 8B DC 49 89 5B ? 49 89 7B ? 55"_sig, + "UpdatePlayerFromCameraSystemUtil::_updatePlayer" }; inline static SigImpl GameArguments__onUri{ [](memory::signature_store&, uintptr_t res) { return res; }, "48 89 5c 24 ? 55 56 57 41 54 41 55 41 56 41 57 48 8d ac 24 ? ? ? ? b8 ? ? ? ? e8 ? ? ? ? 48 2b e0 48 8b 05 ? ? ? ? 48 33 c4 48 89 85 ? ? ? ? 4c 8b fa"_sig, @@ -308,7 +305,7 @@ class Signatures { "anonymous namespace::_bobHurt" }; inline static SigImpl RenderMaterialGroup__common{ [](memory::signature_store& store, uintptr_t) { return store.deref(3); }, - "48 8B 05 ? ? ? ? 48 8D 55 ? 48 8D 0D ? ? ? ? 48 8B 40 ? FF 15 ? ? ? ? 48 8B F8"_sig, + "48 8D 0D ? ? ? ? 48 8B 40 ? FF 15 ? ? ? ? 48 8B F0"_sig, "mce::RenderMaterialGroup::common" }; }; From 5fc8219b2bdd34d2aa98fcd75259361b56fb3788 Mon Sep 17 00:00:00 2001 From: marioCST <68396929+marioCST@users.noreply.github.com> Date: Sun, 17 Nov 2024 00:45:55 +0100 Subject: [PATCH 2/5] Fix attribute bs --- src/sdk/common/world/actor/Actor.cpp | 2 +- src/sdk/signature/storage_latest.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sdk/common/world/actor/Actor.cpp b/src/sdk/common/world/actor/Actor.cpp index f24990aa..4b49e457 100644 --- a/src/sdk/common/world/actor/Actor.cpp +++ b/src/sdk/common/world/actor/Actor.cpp @@ -102,7 +102,7 @@ bool SDK::Actor::isPlayer() { } SDK::AttributesComponent* SDK::Actor::getAttributesComponent() { - return reinterpret_cast(Signatures::Components::attributesComponent.result)(entityContext.getBasicRegistry(), &entityContext.getId()); + return reinterpret_cast(Signatures::Components::attributesComponent.result)(entityContext); } SDK::AttributeInstance* SDK::Actor::getAttribute(SDK::Attribute& attribute) { diff --git a/src/sdk/signature/storage_latest.h b/src/sdk/signature/storage_latest.h index 604e74cc..49c0eb0c 100644 --- a/src/sdk/signature/storage_latest.h +++ b/src/sdk/signature/storage_latest.h @@ -57,7 +57,7 @@ class Signatures { inline static SigImpl attributesComponent{[](memory::signature_store&, uintptr_t res) { return res; }, // last 4 bytes is the hash of the component - "48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 30 8B 59 18 48 8B FA 48 8B 49 10 BA 44 94 B2 B6"_sig, + "4C 8B 51 08 41 BB 44 94 B2 B6"_sig, "AttributesComponent"}; inline static SigImpl actorEquipmentPersistentComponent{ [](memory::signature_store&, uintptr_t res) { return res; }, @@ -241,7 +241,7 @@ class Signatures { "ItemRenderer::renderGuiItemNew"}; inline static SigImpl BaseAttributeMap_getInstance{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, - "E8 ? ? ? ? F3 0F 10 90"_sig, + "E8 ? ? ? ? 48 89 44 24 ? 48 8D 55 ? 48 8B 4C 24"_sig, "BaseAttributeMap::getInstance"}; inline static SigImpl UIControl_getPosition{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, From 7e918a36b4ef245870214239151bf628b689b662 Mon Sep 17 00:00:00 2001 From: marioCST <68396929+marioCST@users.noreply.github.com> Date: Sun, 17 Nov 2024 01:28:07 +0100 Subject: [PATCH 3/5] Various fixes --- src/sdk/common/world/actor/Mob.h | 4 ++-- src/sdk/common/world/actor/player/Player.h | 2 +- src/sdk/common/world/level/Level.cpp | 2 +- src/sdk/signature/storage_latest.h | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/sdk/common/world/actor/Mob.h b/src/sdk/common/world/actor/Mob.h index cd94979d..2cefd2a7 100644 --- a/src/sdk/common/world/actor/Mob.h +++ b/src/sdk/common/world/actor/Mob.h @@ -6,11 +6,11 @@ namespace SDK { class Mob : public Actor { public: void setSprinting(bool b) { - memory::callVirtual(this, SDK::mvGetOffset<0x96, 0x99, 0xAF, 0xFB, 0x115, 0x11C>(), b); + memory::callVirtual(this, SDK::mvGetOffset<0x92, 0x96, 0x96, 0x99, 0xAF, 0xFB, 0x115, 0x11C>(), b); } int getItemUseDuration() { - return memory::callVirtual(this, SDK::mvGetOffset<0x9F, 0xA2, 0xB9, 0x109, 0x12A, 0x12F>()); + return memory::callVirtual(this, SDK::mvGetOffset<0x9B, 0x9F, 0x9F, 0xA2, 0xB9, 0x109, 0x12A, 0x12F>()); } }; } \ No newline at end of file diff --git a/src/sdk/common/world/actor/player/Player.h b/src/sdk/common/world/actor/player/Player.h index 0d9729f3..2a424152 100644 --- a/src/sdk/common/world/actor/player/Player.h +++ b/src/sdk/common/world/actor/player/Player.h @@ -21,6 +21,6 @@ namespace SDK { // @dump-wbds Player::getName, 3 MVCLASS_FIELD(std::string, playerName, 0xCB0, 0xCA0, 0xC88, 0x1D30, 0x1CB8, 0x1C78, 0x8C0, 0x2478); // xref: getName // @dump-wbds ServerPlayer::sendNetworkPacket, 18 - MVCLASS_FIELD(PacketSender*, packetSender, 0x8A0, 0x890, 0x890, 0xC48, 0xC70, 0xC70, 0x1020, 0x1438); // xref: Player::Player a3 + MVCLASS_FIELD(PacketSender*, packetSender, 0x898, 0x890, 0x890, 0xC48, 0xC70, 0xC70, 0x1020, 0x1438); // xref: Player::Player a3 }; } \ No newline at end of file diff --git a/src/sdk/common/world/level/Level.cpp b/src/sdk/common/world/level/Level.cpp index 0baf7bd1..bb66036b 100644 --- a/src/sdk/common/world/level/Level.cpp +++ b/src/sdk/common/world/level/Level.cpp @@ -17,7 +17,7 @@ std::vector SDK::Level::getRuntimeActorList() { std::unordered_map* SDK::Level::getPlayerList() { if (internalVers >= SDK::V1_21_40) { - return reinterpret_cast*>(reinterpret_cast(this) + 0xBF0); + return *reinterpret_cast**>(reinterpret_cast(this) + 0xBF0); } static int index = SDK::mvGetOffset<0x112, 0x111, 0x120, 0x120, 0x128, 0x137>(); diff --git a/src/sdk/signature/storage_latest.h b/src/sdk/signature/storage_latest.h index 49c0eb0c..d96dac85 100644 --- a/src/sdk/signature/storage_latest.h +++ b/src/sdk/signature/storage_latest.h @@ -33,7 +33,7 @@ class Signatures { "48 8B 05 ? ? ? ? 4C 8B AD"_sig, "UIFillColorMaterial"}; inline static SigImpl thirdPersonNametag{ [](memory::signature_store&, uintptr_t res) { return res; }, - "0F 84 ? ? ? ? 49 8B D4 49 8B CD"_sig, + "0F 84 ? ? ? ? 49 8B 07 49 8B CF 48 8B 80 ? ? ? ? FF 15 ? ? ? ? 84 C0 0F 85 ? ? ? ? 41 8B 47"_sig, "ThirdPersonNametag" }; }; @@ -99,7 +99,7 @@ class Signatures { "LevelRenderer::renderLevel"}; inline static SigImpl Keyboard_feed{[](memory::signature_store&, uintptr_t res) { return res; }, - "48 83 ec ? 0f b6 c1 4c 8d 05"_sig, + "48 83 EC ? ? ? C1 4C 8D 05"_sig, "Keyboard::feed"}; // The signature is big but it hasn't died in a while soo @@ -189,7 +189,7 @@ class Signatures { "RakPeer::GetAveragePing"}; inline static SigImpl LocalPlayer_applyTurnDelta{[](memory::signature_store&, uintptr_t res) { return res; }, - "48 89 74 24 ? 57 48 81 EC ? ? ? ? 48 8D 4A ? 48 8B F2"_sig, + "48 8B C4 48 89 58 ? 48 89 70 ? 48 89 78 ? 55 41 56 41 57 48 8D 68 ? 48 81 EC ? ? ? ? 0F 29 70 ? 0F 29 78 ? 44 0F 29 40 ? 44 0F 29 48 ? 44 0F 29 50 ? 48 8B 05"_sig, "LocalPlayer::applyTurnDelta"}; // see what accesses things in moveinputhandler From 1f18d0f02fb17f21e73edd066a76f4439c1f713a Mon Sep 17 00:00:00 2001 From: marioCST <68396929+marioCST@users.noreply.github.com> Date: Sun, 17 Nov 2024 16:41:54 +0100 Subject: [PATCH 4/5] Fix FocusLostEvent --- LatiteRewrite.vcxproj | 2 -- src/client/Latite.cpp | 2 +- src/client/hook/Hooks.cpp | 1 - src/client/hook/Hooks.h | 2 -- src/client/hook/impl/AppPlatformHooks.cpp | 20 -------------------- src/client/hook/impl/AppPlatformHooks.h | 9 --------- src/client/hook/impl/MinecraftGameHooks.cpp | 12 ++++++++++++ src/client/hook/impl/MinecraftGameHooks.h | 1 + src/sdk/signature/storage_latest.h | 6 +++--- 9 files changed, 17 insertions(+), 38 deletions(-) delete mode 100644 src/client/hook/impl/AppPlatformHooks.cpp delete mode 100644 src/client/hook/impl/AppPlatformHooks.h diff --git a/LatiteRewrite.vcxproj b/LatiteRewrite.vcxproj index 127030ed..7195ae6b 100644 --- a/LatiteRewrite.vcxproj +++ b/LatiteRewrite.vcxproj @@ -468,7 +468,6 @@ - @@ -726,7 +725,6 @@ - diff --git a/src/client/Latite.cpp b/src/client/Latite.cpp index ff9d9579..cf5da2c6 100644 --- a/src/client/Latite.cpp +++ b/src/client/Latite.cpp @@ -197,7 +197,7 @@ DWORD __stdcall startThread(HINSTANCE dll) { MVSIG(ChatScreenController_sendChatMessage), MVSIG(GameRenderer__renderCurrentFrame), MVSIG(onClick), - MVSIG(AppPlatform__fireAppFocusLost), + MVSIG(MinecraftGame_onDeviceLost), MVSIG(MinecraftGame_onAppSuspended), MVSIG(RenderController_getOverlayColor), MVSIG(ScreenView_setupAndRender), diff --git a/src/client/hook/Hooks.cpp b/src/client/hook/Hooks.cpp index 1664d46a..c6123006 100644 --- a/src/client/hook/Hooks.cpp +++ b/src/client/hook/Hooks.cpp @@ -5,7 +5,6 @@ #include "impl/LevelRendererHooks.h" #include "impl/OptionHooks.h" #include "impl/DXHooks.h" -#include "impl/AppPlatformHooks.h" #include "impl/MinecraftGameHooks.h" #include "impl/RenderControllerHooks.h" #include "impl/ScreenViewHooks.h" diff --git a/src/client/hook/Hooks.h b/src/client/hook/Hooks.h index 8b1d2d1f..ff07209e 100644 --- a/src/client/hook/Hooks.h +++ b/src/client/hook/Hooks.h @@ -6,7 +6,6 @@ #include "impl/LevelRendererHooks.h" #include "impl/OptionHooks.h" #include "impl/DXHooks.h" -#include "impl/AppPlatformHooks.h" #include "impl/MinecraftGameHooks.h" #include "impl/RenderControllerHooks.h" #include "impl/ScreenViewHooks.h" @@ -19,7 +18,6 @@ class LatiteHooks final : public StaticManager FocusLostHook; -} - -int AppPlatformHooks::_fireAppFocusLost(SDK::AppPlatform* plat) { - FocusLostEvent ev{}; - if (Eventing::get().dispatch(ev)) return 0; - return FocusLostHook->oFunc()(plat); -} - -AppPlatformHooks::AppPlatformHooks() { - // TODO: FIX ME - //FocusLostHook = addHook(Signatures::AppPlatform__fireAppFocusLost.result, _fireAppFocusLost, "AppPlatform::_fireAppFocusLost"); -} diff --git a/src/client/hook/impl/AppPlatformHooks.h b/src/client/hook/impl/AppPlatformHooks.h deleted file mode 100644 index 473e68f1..00000000 --- a/src/client/hook/impl/AppPlatformHooks.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once -#include "../Hook.h" -#include "sdk/deps/Application/AppPlatform.h" - -class AppPlatformHooks : public HookGroup { - static int __fastcall _fireAppFocusLost(SDK::AppPlatform* plat); -public: - AppPlatformHooks(); -}; \ No newline at end of file diff --git a/src/client/hook/impl/MinecraftGameHooks.cpp b/src/client/hook/impl/MinecraftGameHooks.cpp index 59c886ce..2614ba09 100644 --- a/src/client/hook/impl/MinecraftGameHooks.cpp +++ b/src/client/hook/impl/MinecraftGameHooks.cpp @@ -8,6 +8,7 @@ namespace { std::shared_ptr onAppSuspendedHook; + std::shared_ptr onDeviceLostHook; std::shared_ptr _updateHook; } @@ -22,6 +23,15 @@ void* MinecraftGameHooks::onAppSuspended(SDK::MinecraftGame* game,void*a,void*b, return onAppSuspendedHook->oFunc()(game,a,b,c); } +void MinecraftGameHooks::onDeviceLost(SDK::MinecraftGame* game) { + FocusLostEvent ev{}; + + if (Eventing::get().dispatch(ev)) + return; + + onDeviceLostHook->oFunc()(game); +} + void __fastcall MinecraftGameHooks::_update(SDK::MinecraftGame* game) { _updateHook->oFunc()(game); UpdateEvent ev{}; @@ -37,6 +47,8 @@ void __fastcall MinecraftGameHooks::_update(SDK::MinecraftGame* game) { MinecraftGameHooks::MinecraftGameHooks() { onAppSuspendedHook = addHook(Signatures::MinecraftGame_onAppSuspended.result, onAppSuspended, "MinecraftGame::onAppSuspended"); + onDeviceLostHook = addHook(Signatures::MinecraftGame_onDeviceLost.result, onDeviceLost, + "MinecraftGame::onDeviceLost"); _updateHook = addHook(Signatures::MinecraftGame__update.result, _update, "MinecraftGame::_update"); } diff --git a/src/client/hook/impl/MinecraftGameHooks.h b/src/client/hook/impl/MinecraftGameHooks.h index fcefe2bd..11cc160b 100644 --- a/src/client/hook/impl/MinecraftGameHooks.h +++ b/src/client/hook/impl/MinecraftGameHooks.h @@ -4,6 +4,7 @@ class MinecraftGameHooks : public HookGroup { static void* __fastcall onAppSuspended(SDK::MinecraftGame* game,void*,void*,void*); + static void __fastcall onDeviceLost(SDK::MinecraftGame* game); static void __fastcall _update(SDK::MinecraftGame* game); public: MinecraftGameHooks(); diff --git a/src/sdk/signature/storage_latest.h b/src/sdk/signature/storage_latest.h index d96dac85..a15e3969 100644 --- a/src/sdk/signature/storage_latest.h +++ b/src/sdk/signature/storage_latest.h @@ -139,9 +139,9 @@ class Signatures { "E8 ? ? ? ? 90 EB ? 41 80 BF"_sig, "GameRenderer::_renderCurrentFrame"}; // near "and (displayProperties/realmsPlusEndDate" (below it 1 arg func with 1 arg called src) - inline static SigImpl AppPlatform__fireAppFocusLost{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, // Call in question is inlined, this is not the correct name anymore - "E8 ? ? ? ? 48 8B 7B ? 0F 1F 80"_sig, - "AppPlatform::_fireAppFocusLost"}; + inline static SigImpl MinecraftGame_onDeviceLost{[](memory::signature_store&, uintptr_t res) { return res; }, + "48 89 5C 24 ? 48 89 74 24 ? 55 57 41 54 41 56 41 57 48 8D 6C 24 ? 48 81 EC ? ? ? ? 4C 8B F9 C7 44 24"_sig, + "MinecraftGame::onDeviceLost"}; inline static SigImpl onClick{[](memory::signature_store&, uintptr_t res) { return res; }, "48 8b c4 48 89 58 ? 48 89 68 ? 48 89 70 ? 57 41 54 41 55 41 56 41 57 48 83 ec ? 44 0f b7 bc 24"_sig, From add9113e720f97749f4b92a55e175a99ee6b20fa Mon Sep 17 00:00:00 2001 From: marioCST <68396929+marioCST@users.noreply.github.com> Date: Sun, 17 Nov 2024 19:13:35 +0100 Subject: [PATCH 5/5] Fix Zoom --- src/sdk/common/client/renderer/game/LevelRendererPlayer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sdk/common/client/renderer/game/LevelRendererPlayer.cpp b/src/sdk/common/client/renderer/game/LevelRendererPlayer.cpp index d4f8c1b1..6384e855 100644 --- a/src/sdk/common/client/renderer/game/LevelRendererPlayer.cpp +++ b/src/sdk/common/client/renderer/game/LevelRendererPlayer.cpp @@ -10,6 +10,7 @@ Vec3& SDK::LevelRendererPlayer::getOrigin() { } float& SDK::LevelRendererPlayer::getFovX() { + if (SDK::internalVers >= SDK::V1_21_40) return util::directAccess(this, 0xED8); if (SDK::internalVers >= SDK::V1_21_30) return util::directAccess(this, 0xE28); if (SDK::internalVers >= SDK::V1_21) return util::directAccess(this, 0xDF0); if (SDK::internalVers >= SDK::V1_20_80) return util::directAccess(this, 0xDF8); @@ -21,6 +22,7 @@ float& SDK::LevelRendererPlayer::getFovX() { } float& SDK::LevelRendererPlayer::getFovY() { + if (SDK::internalVers >= SDK::V1_21_40) return util::directAccess(this, 0xEEC); if (SDK::internalVers >= SDK::V1_21_30) return util::directAccess(this, 0xE3C); if (SDK::internalVers >= SDK::V1_21) return util::directAccess(this, 0xE04); if (SDK::internalVers >= SDK::V1_20_80) return util::directAccess(this, 0xE0C);