From 20c243a4d3a3342ac4d0277b05d5241e3a0e6148 Mon Sep 17 00:00:00 2001 From: marioCST <68396929+marioCST@users.noreply.github.com> Date: Fri, 15 May 2026 16:57:33 +0200 Subject: [PATCH 1/3] Initial 26.2X support, add entt, refactor signatures --- deps/CMakeLists.txt | 2 + src/client/Latite.cpp | 25 +-- src/client/Latite.h | 5 +- .../modules/game/ThirdPersonNametag.cpp | 2 +- src/client/memory/hook/hooks/GeneralHooks.cpp | 43 ++-- src/client/memory/hook/hooks/GeneralHooks.h | 2 +- src/mc/Addresses.h | 196 ++++++------------ src/mc/common/client/game/ClientInstance.cpp | 14 +- src/mc/common/client/game/GameCore.cpp | 7 +- src/mc/common/client/game/MinecraftGame.cpp | 6 +- src/mc/common/client/game/MinecraftGame.h | 8 +- src/mc/common/client/game/MouseAction.h | 14 ++ src/mc/common/client/game/MouseDevice.cpp | 6 + src/mc/common/client/game/MouseDevice.h | 22 ++ src/mc/common/client/game/MouseInputPacket.h | 16 -- .../common/client/game/Platform_GameCore.cpp | 14 ++ src/mc/common/client/game/Platform_GameCore.h | 14 ++ .../common/client/gui/controls/UIControl.cpp | 2 +- .../common/client/renderer/ItemRenderer.cpp | 2 +- .../client/renderer/game/LevelRenderer.h | 2 +- .../renderer/game/LevelRendererPlayer.cpp | 2 +- src/mc/common/entity/EntityContext.h | 94 +++++---- src/mc/common/entity/EntityId.h | 11 + src/mc/common/entity/EntityIdTraits.h | 13 ++ src/mc/common/entity/IEntityComponent.h | 3 + .../entity/component/AABBShapeComponent.h | 10 + .../entity/component/ActorDataFlagComponent.h | 4 +- .../component/ActorEquipmentComponent.h | 4 +- .../entity/component/ActorRotationComponent.h | 10 + .../entity/component/ActorTypeComponent.h | 4 +- .../entity/component/AttributesComponent.h | 21 +- .../entity/component/MoveInputComponent.h | 4 +- .../entity/component/RuntimeIDComponent.h | 4 +- .../entity/component/StateVectorComponent.h | 11 + src/mc/common/network/RakNetConnector.h | 8 +- src/mc/common/world/Attribute.h | 6 +- src/mc/common/world/Minecraft.cpp | 2 - src/mc/common/world/actor/Actor.cpp | 19 +- src/mc/common/world/actor/Actor.h | 14 +- src/mc/common/world/actor/player/Player.cpp | 4 +- src/mc/common/world/level/Level.cpp | 11 +- src/mc/common/world/level/block/Block.h | 2 +- src/mc/common/world/level/block/BlockLegacy.h | 8 +- src/pch.h | 3 + src/util/DrawContext.cpp | 4 +- 45 files changed, 359 insertions(+), 319 deletions(-) create mode 100644 src/mc/common/client/game/MouseAction.h create mode 100644 src/mc/common/client/game/MouseDevice.cpp create mode 100644 src/mc/common/client/game/MouseDevice.h delete mode 100644 src/mc/common/client/game/MouseInputPacket.h create mode 100644 src/mc/common/client/game/Platform_GameCore.cpp create mode 100644 src/mc/common/client/game/Platform_GameCore.h create mode 100644 src/mc/common/entity/EntityId.h create mode 100644 src/mc/common/entity/EntityIdTraits.h create mode 100644 src/mc/common/entity/IEntityComponent.h create mode 100644 src/mc/common/entity/component/AABBShapeComponent.h create mode 100644 src/mc/common/entity/component/ActorRotationComponent.h create mode 100644 src/mc/common/entity/component/StateVectorComponent.h diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 2b2e212c..2bf1466c 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -5,6 +5,7 @@ CPMAddPackage("gh:TsudaKageyu/minhook@1.3.4") CPMAddPackage("gh:brampedgex/mnemosyne#48078d302fa3ba9e22b80ca69eadf27811caf361") CPMAddPackage("gh:nlohmann/json@3.12.0") CPMAddPackage("gh:BasedInc/libhat@0.6.0") +CPMAddPackage("gh:skypjack/entt#fe8d7d78c4823e8a66a050bf86f5c6318cf76ce7") target_include_directories(Latite PRIVATE "include" @@ -16,4 +17,5 @@ target_link_libraries(Latite PRIVATE mnemosyne nlohmann_json libhat::libhat + EnTT::EnTT ) diff --git a/src/client/Latite.cpp b/src/client/Latite.cpp index 230d686a..f292f08e 100644 --- a/src/client/Latite.cpp +++ b/src/client/Latite.cpp @@ -278,18 +278,14 @@ DWORD __stdcall startThreadImpl(HINSTANCE dll) { } std::vector> sigList = { - MVSIG(Misc::minecraftGamePointer), MVSIG(MainWindow__windowProcCallback), MVSIG(LevelRenderer_renderLevel), - MVSIG(Offset::LevelRendererPlayer_origin), - MVSIG(Offset::MinecraftGame_cursorGrabbed), - MVSIG(Components::moveInputComponent), MVSIG(Options_getGamma), MVSIG(Options_getPerspective), MVSIG(Options_getHideHand), MVSIG(ClientInstance_grabCursor), MVSIG(ClientInstance_releaseCursor), - MVSIG(Level_tick), + MVSIG(MultiPlayerLevel__subTick), MVSIG(ChatScreenController_sendChatMessage), MVSIG(GameCore_handleMouseInput), MVSIG(MinecraftGame_onDeviceLost), @@ -301,27 +297,17 @@ DWORD __stdcall startThreadImpl(HINSTANCE dll) { MVSIG(RakPeer_GetAveragePing), MVSIG(ClientInputUpdateSystem_tickBaseInput), MVSIG(LocalPlayer_applyTurnDelta), - MVSIG(Vtable::TextPacket), - MVSIG(Vtable::SetTitlePacket), - MVSIG(Components::runtimeIDComponent), - MVSIG(CameraViewBob), MVSIG(ItemStackBase_getHoverName), - MVSIG(Vtable::CommandRequestPacket), MVSIG(Vtable::Level), - MVSIG(Misc::uiColorMaterial), MVSIG(Tessellator_begin), MVSIG(Tessellator_vertex), MVSIG(Tessellator_color), MVSIG(MeshHelpers_renderMeshImmediately), MVSIG(BaseActorRenderContext_BaseActorRenderContext), MVSIG(ItemRenderer_renderGuiItemNew), - MVSIG(BaseAttributeMap_getInstance), - MVSIG(UIControl_getPosition), - MVSIG(MinecraftGame_getPrimaryClientInstance), - MVSIG(Components::actorTypeComponent), + MVSIG(UIControl_updateCachedPosition), MVSIG(ActorRenderDispatcher_render), MVSIG(LevelRendererPlayer_renderOutlineSelection), - MVSIG(Components::attributesComponent), MVSIG(Dimension_getSkyColor), MVSIG(Dimension_getTimeOfDay), MVSIG(Dimension_tick), @@ -330,15 +316,14 @@ DWORD __stdcall startThreadImpl(HINSTANCE dll) { MVSIG(MinecraftPackets_createPacket), MVSIG(Actor_attack), MVSIG(GuiData__addMessage), - MVSIG(Components::actorEquipmentPersistentComponent), MVSIG(_updatePlayer), MVSIG(GameArguments__onUri), MVSIG(RenderMaterialGroup__common), MVSIG(GuiData_displayClientMessage), - MVSIG(Misc::gameCorePointer), - MVSIG(MouseInputVector), MVSIG(BaseActorRenderer_renderText), - MVSIG(AppPlatformGDK_releaseMouse) + MVSIG(AppPlatformGDK_releaseMouse), + MVSIG(Misc::Platform_GameCore), + MVSIG(Misc::mouseDevice), }; new (configMgrBuf) ConfigManager(); diff --git a/src/client/Latite.h b/src/client/Latite.h index e88ed582..447df6f3 100644 --- a/src/client/Latite.h +++ b/src/client/Latite.h @@ -56,9 +56,8 @@ class Latite final : public Listener { static constexpr std::string_view version = "v2.6.2"; static constexpr std::array supportedMinecraftVersions = { - "1.26.10", - "1.26.11", - "1.26.12", + "1.26.20", + "1.26.21" }; [[nodiscard]] static constexpr bool supportsMinecraftVersion(std::string_view version) noexcept { diff --git a/src/client/feature/module/modules/game/ThirdPersonNametag.cpp b/src/client/feature/module/modules/game/ThirdPersonNametag.cpp index 1aaf52df..ff1b81aa 100644 --- a/src/client/feature/module/modules/game/ThirdPersonNametag.cpp +++ b/src/client/feature/module/modules/game/ThirdPersonNametag.cpp @@ -1,7 +1,7 @@ #include "ThirdPersonNametag.h" #include -static constexpr size_t instructionSize = 6; +static constexpr size_t instructionSize = 2; static char originalBytes[instructionSize] = {}; static void* instructionPointer = nullptr; diff --git a/src/client/memory/hook/hooks/GeneralHooks.cpp b/src/client/memory/hook/hooks/GeneralHooks.cpp index 5f8c1635..991d3070 100644 --- a/src/client/memory/hook/hooks/GeneralHooks.cpp +++ b/src/client/memory/hook/hooks/GeneralHooks.cpp @@ -10,10 +10,10 @@ #include "client/event/events/MouseReleaseEvent.h" #include "client/screen/ScreenManager.h" #include "mc/common/client/game/GameCore.h" -#include "mc/common/client/game/MouseInputPacket.h" +#include "mc/common/client/game/MouseDevice.h" namespace { - std::shared_ptr Level_tickHook; + std::shared_ptr MultiPlayerLevel__subTickHook; std::shared_ptr ChatScreenController_sendChatMesageHook; std::shared_ptr GameRenderer_renderCurrentFrameHook; //std::shared_ptr Keyboard_feedHook; @@ -41,18 +41,15 @@ namespace { std::shared_ptr AppPlatformGDK_releaseMouseHook; } -void GenericHooks::Level_tick(SDK::Level* level) { - if (level == SDK::ClientInstance::get()->minecraft->getLevel()) { - // Clientside level - // dispatch clientside tick event.. - TickEvent ev(level); - Latite::getEventing().dispatch(ev); - Latite::getClientMessageQueue().doPrint(100); +void GenericHooks::MultiPlayerLevel__subTick(SDK::Level* level) { + TickEvent ev(level); + Latite::getEventing().dispatch(ev); + Latite::getClientMessageQueue().doPrint(100); - PluginManager::Event sEv{L"world-tick", {}, false}; - Latite::getPluginManager().dispatchEvent(sEv); - } - Level_tickHook->oFunc()(level); + PluginManager::Event sEv{L"world-tick", {}, false}; + Latite::getPluginManager().dispatchEvent(sEv); + + MultiPlayerLevel__subTickHook->oFunc()(level); } void* GenericHooks::ChatScreenController_sendChatMessage(void* controller, std::string& message) { @@ -118,14 +115,14 @@ LRESULT GenericHooks::MainWindow__windowProcCallback(HWND hwnd, UINT msg, WPARAM bool GenericHooks::GameCore_handleMouseInput(void* a1, void* a2, void* a3) { // Made up name const auto res = GameCore_handleMouseInputHook->oFunc()(a1, a2, a3); - static auto mouseInputVector = reinterpret_cast*>(Signatures::MouseInputVector.result); + const auto mouse = SDK::MouseDevice::get(); - for (size_t i = 0; i < mouseInputVector->size(); i++) { // This method sucks so fucking bad, but gets the job done - auto& start = mouseInputVector->at(i); - auto it = std::next(mouseInputVector->begin(), i); + for (size_t i = 0; i < mouse->inputs.size(); i++) { // This method sucks, but gets the job done + auto& start = mouse->inputs.at(i); + auto it = std::next(mouse->inputs.begin(), i); - const auto button = start.type; - const auto state = start.state; + const auto button = start.action; + const auto state = start.data; if (button > 0) { Vec2& mousePos = SDK::ClientInstance::get()->cursorPos; @@ -157,14 +154,14 @@ bool GenericHooks::GameCore_handleMouseInput(void* a1, void* a2, void* a3) { // PluginManager::Event ev{L"click", values, true}; if (Latite::getPluginManager().dispatchEvent(ev)) { - mouseInputVector->erase(it); + mouse->inputs.erase(it); continue; } } ClickEvent ev{ button, static_cast(state) }; if (Eventing::get().dispatch(ev)) - mouseInputVector->erase(it); + mouse->inputs.erase(it); } return res; @@ -420,8 +417,8 @@ GenericHooks::GenericHooks() : HookGroup("General") { //LoadLibraryWHook = addHook(reinterpret_cast(&::LoadLibraryA), hkLoadLibraryW); - Level_tickHook = addHook(Signatures::Level_tick.result, - Level_tick, "Level::tick"); + MultiPlayerLevel__subTickHook = addHook(Signatures::MultiPlayerLevel__subTick.result, + MultiPlayerLevel__subTick, "Level::tick"); ChatScreenController_sendChatMesageHook = addHook(Signatures::ChatScreenController_sendChatMessage.result, ChatScreenController_sendChatMessage, "ChatScreenController::sendChatMessage"); diff --git a/src/client/memory/hook/hooks/GeneralHooks.h b/src/client/memory/hook/hooks/GeneralHooks.h index 26f52923..249177d9 100644 --- a/src/client/memory/hook/hooks/GeneralHooks.h +++ b/src/client/memory/hook/hooks/GeneralHooks.h @@ -5,7 +5,7 @@ #include class GenericHooks : public HookGroup { - static void __fastcall Level_tick(SDK::Level* level); + static void __fastcall MultiPlayerLevel__subTick(SDK::Level* level); static void* __fastcall ChatScreenController_sendChatMessage(void* controller, std::string& message); static void* __fastcall GameRenderer_renderCurrentFrame(void* rend); static LRESULT __fastcall MainWindow__windowProcCallback(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); diff --git a/src/mc/Addresses.h b/src/mc/Addresses.h index 2ec8679a..09ae66f6 100644 --- a/src/mc/Addresses.h +++ b/src/mc/Addresses.h @@ -16,285 +16,207 @@ class SigImpl : public memory::signature_store { class Signatures { public: - struct Offset { - inline static SigImpl MinecraftGame_cursorGrabbed{[](memory::signature_store& store, uintptr_t) { return store.ref(2); }, - "80 B9 ? ? ? ? ? 74 ? C6 81 ? ? ? ? ? 48 8D 4C 24 ? E8 ? ? ? ? 90"_sig, - "MinecraftGame->cursorGrabbed"}; - - inline static SigImpl LevelRendererPlayer_origin{[](memory::signature_store& store, uintptr_t) { return store.ref(4); }, - "F3 0F 58 B3 ? ? ? ? 48 8B 8B"_sig, - "LevelRendererPlayer->origin"}; - - }; struct Misc { - inline static SigImpl minecraftGamePointer {[](memory::signature_store& store, uintptr_t) { return store.deref(3); }, - "48 89 15 ? ? ? ? 49 8B 40"_sig, - "MinecraftGame"}; - inline static SigImpl gameCorePointer{[](memory::signature_store& store, uintptr_t) { return store.deref(3); }, - "48 8B 05 ? ? ? ? 4C 8D 40"_sig, - "GameCore"}; // 0x770 - inline static SigImpl clickMap{[](memory::signature_store& store, uintptr_t) { return store.deref(2); }, - "89 0D ? ? ? ? 41 B7"_sig, // MouseDevice::_instance + inline static SigImpl Platform_GameCore{[](memory::signature_store& store, uintptr_t) { return store.deref(3); }, + "48 89 0D ? ? ? ? 48 85 C9"_sig, + "Platform_GameCore" + }; + + inline static SigImpl mouseDevice{[](memory::signature_store& store, uintptr_t) { return store.deref(3); }, + "4C 8D 0D ? ? ? ? 89 CA"_sig, // MouseDevice::_instance "ClickMap"}; - inline static SigImpl uiColorMaterial{[](memory::signature_store& store, uintptr_t) { return store.deref(3); }, - "48 8B 05 ? ? ? ? 4C 8B A5"_sig, - "UIFillColorMaterial"}; inline static SigImpl thirdPersonNametag{ [](memory::signature_store&, uintptr_t res) { return res; }, - "0F 84 ? ? ? ? 49 8B 45 ? 49 8B CD 48 8B 80 ? ? ? ? FF 15 ? ? ? ? 84 C0 0F 85"_sig, + "74 ? 48 8B 8D ? ? ? ? 48 89 DA E8 ? ? ? ? 84 C0"_sig, "ThirdPersonNametag" }; }; - struct Components { - inline static SigImpl moveInputComponent{[](memory::signature_store&, uintptr_t res) { return res; }, - // last 4 bytes is the hash of the component - "4C 8B 41 48 4C 8B D1 48 8B 41 50 8B 12 49 2B C0 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 - "4C 8B 41 48 4C 8B D1 48 8B 41 50 8B 12 49 2B C0 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 - "4C 8B 41 48 4C 8B D1 48 8B 41 50 8B 12 49 2B C0 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 ? 57 48 83 EC ? 8B 79 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 D1 48 8B 41 50 8B 12 49 2B C0 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 - "4C 8B 41 48 4C 8B D1 48 8B 41 50 8B 12 49 2B C0 48 C1 F8 03 48 FF C8 25 76 59 47 33"_sig, - "struct ActorDataFlagsComponent"}; - }; - struct Vtable { - inline static SigImpl TextPacket{[](memory::signature_store& store, uintptr_t) { return store.deref(3); }, - "48 8D 3D ? ? ? ? 48 89 3B 48 8D 4B ? 48 8B D0"_sig, - "const TextPacket::`vftable'"}; - inline static SigImpl CommandRequestPacket{[](memory::signature_store& store, uintptr_t) { return store.deref(3); }, - "48 8D 05 ? ? ? ? 48 89 01 48 8D 59 ? 48 89 5C 24 ? 0F 57 C0 0F 11 03 48 89 6B ? 48 89 6B"_sig, - "const CommandRequestPacket::`vftable'"}; - // "Client{} camera ticking systems" // Right below is a func allocating memory followed by a nullptr check and a memset with 0x800-ish bytes // The function called after the memset with the ptr that's been cleared is the MultiLevelPlayer ctor // 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 07 48 8D 05 ? ? ? ? 48 89 47 ? 48 8D 05 ? ? ? ? 48 89 47 ? 4C 8D B6"_sig, + "48 8D 05 ? ? ? ? 48 89 07 48 8D 05 ? ? ? ? 48 89 47 ? 48 8D 05 ? ? ? ? 48 89 BD"_sig, "const Level::`vftable'"}; - inline static SigImpl SetTitlePacket{[](memory::signature_store& store, uintptr_t) { return store.deref(3); }, - "48 8D 3D ? ? ? ? 4C 3B F8"_sig, - "const SetTitlePacket::`vftable'"}; }; inline static SigImpl LevelRenderer_renderLevel{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, - "E8 ? ? ? ? 45 32 F6 48 8B 8E"_sig, + "E8 ? ? ? ? 45 31 FF 48 83 BE"_sig, "LevelRenderer::renderLevel"}; inline static SigImpl MainWindow__windowProcCallback{[](memory::signature_store&, uintptr_t res) { return res; }, - "40 53 56 57 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 44 24 ? 48 8B F9"_sig, + "48 83 EC ? 4C 89 C0 41 89 D0 48 89 CA 48 8B 0D"_sig, "MainWindow::_windowProcCallback"}; inline static SigImpl Options_getGamma{[](memory::signature_store&, uintptr_t res) { return res; }, - "48 83 EC ? 48 8B 01 48 8D 54 ? ? 41 B8 36 00 00 00"_sig, + "48 83 EC 38 48 8B 05 ? ? ? ? 48 31 E0 48 89 44 24 ? 48 8B 01 48 8B 40 08 48 8D 54 24 ? 41 B8 36 00 00 00"_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 ? ? 41 B8 03 00 00 00"_sig, + "48 83 EC 38 48 8B 05 ? ? ? ? 48 31 E0 48 89 44 24 ? 48 8B 01 48 8B 40 08 48 8D 54 24 ? 41 B8 03 00 00 00"_sig, "Options::getPerspective"}; inline static SigImpl Options_getHideHand{[](memory::signature_store&, uintptr_t res) { return res; }, - "48 83 EC ? 48 8B 01 48 8D 54 ? ? 41 B8 A2 01 00 00"_sig, // Will probably die every update from now on, but a good sig would be thousands of bytes long + "56 48 83 EC ? 48 89 CE 48 8B 05 ? ? ? ? 48 31 E0 48 89 44 24 ? 48 8B 01 48 8B 40 ? 48 8D 54 24 ? 41 B8 A9 01 00 00"_sig, // Will probably die every update from now on, but a good sig would be thousands of bytes long "Options::getHideHand"}; inline static SigImpl ClientInstance_grabCursor{[](memory::signature_store&, uintptr_t res) { return res; }, - "40 53 48 83 EC ? 48 8B 01 48 8B D9 48 8B 80 ? ? ? ? FF 15 ? ? ? ? 84 C0 74 ? 48 8B 8B ? ? ? ? 48 8B 01 48 8B 80 ? ? ? ? 48 83 C4 ? 5B 48 FF 25 ? ? ? ? 48 83 C4 ? 5B C3 40 53"_sig, + "56 48 83 EC ? 48 89 CE 48 8B 01 48 8B 80 ? ? ? ? FF 15 ? ? ? ? 84 C0 74 ? 48 8B 8E ? ? ? ? 48 8B 01 48 8B 80 ? ? ? ? 48 8B 15 ? ? ? ? 48 83 C4 ? 5E 48 FF E2 90 48 83 C4 ? 5E C3 CC CC CC CC CC CC CC CC CC CC CC CC CC 56 48 83 EC"_sig, "ClientInstance::grabCursor"}; inline static SigImpl ClientInstance_releaseCursor{[](memory::signature_store&, uintptr_t res) { return res; }, - "40 53 48 83 EC ? 48 8B 01 48 8B D9 48 8B 80 ? ? ? ? FF 15 ? ? ? ? 84 C0 74 ? 48 8B 8B ? ? ? ? 48 8B 01 48 8B 80 ? ? ? ? 48 83 C4 ? 5B 48 FF 25 ? ? ? ? 48 83 C4 ? 5B C3 48 89 5C 24"_sig, + "56 48 83 EC ? 48 89 CE 48 8B 01 48 8B 80 ? ? ? ? FF 15 ? ? ? ? 84 C0 74 ? 48 8B 8E ? ? ? ? 48 8B 01 48 8B 80 ? ? ? ? 48 8B 15 ? ? ? ? 48 83 C4 ? 5E 48 FF E2 90 48 83 C4 ? 5E C3 CC CC CC CC CC CC CC CC CC CC CC CC CC 56 53"_sig, "ClientInstance::releaseCursor"}; - inline static SigImpl Level_tick{ [](memory::signature_store& stor, uintptr_t res) { return stor.deref(1); }, - "e8 ? ? ? ? 48 8b 4b ? 48 85 c9 74 ? 48 8b 41 ? 48 83 c1 ? 48 8b 40"_sig, - "Level::tick" }; + inline static SigImpl MultiPlayerLevel__subTick{ [](memory::signature_store&, uintptr_t res) { return res; }, + "55 41 56 56 57 53 48 83 EC ? 48 8D 6C 24 ? 48 C7 45 ? ? ? ? ? 48 89 CE E8 ? ? ? ? 48 8B 06"_sig, + "MultiPlayerLevel::_subTick" }; inline static SigImpl ChatScreenController_sendChatMessage{[](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 AC 24 ? ? ? ? 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 4C 8B FA 4C 8B F1 45 33 E4 48 8B 49"_sig, + "55 41 57 41 56 41 54 56 57 53 48 81 EC ? ? ? ? 48 8D AC 24 ? ? ? ? 48 C7 85 ? ? ? ? ? ? ? ? 48 89 D7 48 89 CE 48 83 79"_sig, "ClientInstanceScreenModel::sendChatMessage"}; inline static SigImpl MinecraftGame_onDeviceLost{[](memory::signature_store&, uintptr_t res) { return res; }, - "48 89 5C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 55 41 54 41 55 41 56 41 57 48 8B EC 48 83 EC ? 4C 8B F9 33 F6"_sig, + "55 41 57 41 56 56 57 53 48 81 EC ? ? ? ? 48 8D AC 24 ? ? ? ? 48 C7 45 ? ? ? ? ? 48 89 CF 48 8D B1 ? ? ? ? 48 8B 81"_sig, "MinecraftGame::onDeviceLost"}; inline static SigImpl GameCore_handleMouseInput{[](memory::signature_store&, uintptr_t res) { return res; }, - "48 8B C4 48 89 58 ? 55 56 57 41 54 41 55 41 56 41 57 48 8D 68 ? 48 81 EC ? ? ? ? 0F 29 70 ? 0F 29 78 ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 45 ? 4C 89 45"_sig, + "55 41 57 41 56 41 55 41 54 56 57 53 48 81 EC ? ? ? ? 48 8D AC 24 ? ? ? ? 0F 29 B5 ? ? ? ? 48 C7 85 ? ? ? ? ? ? ? ? 4C 89 45 ? 4C 8B 21"_sig, "GameCore::handleMouseInput"}; - inline static SigImpl MouseInputVector{[](memory::signature_store& store, uintptr_t) { return store.deref(3); }, - "48 2B 05 ? ? ? ? 8B 0D"_sig, - "MouseInputVector"}; - - inline static SigImpl RenderController_getOverlayColor{[](memory::signature_store&, uintptr_t res) { return res; }, - "40 53 55 56 57 48 83 EC ? 49 8B 78"_sig, + inline static SigImpl RenderController_getOverlayColor{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, + "E8 ? ? ? ? 44 0F 29 45 ? 4C 89 F1"_sig, "RenderController::getOverlayColor"}; inline static SigImpl ScreenView_setupAndRender{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, - "E8 ? ? ? ? 48 8B 4B ? 48 85 C9 74 ? 48 8B 01 48 8B D6"_sig, + "E8 ? ? ? ? 48 89 F9 48 89 F2 E8 ? ? ? ? 48 8D 4D ? E8 ? ? ? ? 48 8D 4D ? E8 ? ? ? ? F2 0F 10 45"_sig, "ScreenView::setupAndRender"}; inline static SigImpl KeyMap{[](memory::signature_store& store, uintptr_t) { return store.deref(3); }, - "48 8D 0D ? ? ? ? 48 8B 15 ? ? ? ? 48 8D 3C 99"_sig, + "48 8D 3D ? ? ? ? C7 04 B7"_sig, "KeyMap"}; inline static SigImpl MinecraftGame__update{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, - "E8 ? ? ? ? BA ? ? ? ? 48 8B 8E ? ? ? ? E8 ? ? ? ? 48 8B BE"_sig, + "E8 ? ? ? ? 48 8B 8E ? ? ? ? BA ? ? ? ? E8 ? ? ? ? 48 8B B6"_sig, "MinecraftGame::_update"}; // ref: your GPU ("AMD Radeon RX 5500") inline static SigImpl GpuInfo{[](memory::signature_store& store, uintptr_t) { return store.deref(3); }, - "48 8D 0D ? ? ? ? E8 ? ? ? ? 49 8B 07 49 8B CF 48 8B 40"_sig, + "48 8D 0D ? ? ? ? 4C 8D 44 24 ? BA ? ? ? ? 41 B9 ? ? ? ? E8 ? ? ? ? 48 C7 05"_sig, "GpuInfo"}; // ref: RakPeer vtable; 88 51 12 c3 -> xref -> third func above it inline static SigImpl RakPeer_GetAveragePing{[](memory::signature_store&, uintptr_t res) { return res; }, - "48 8B C4 55 48 8D 6C 24 ? 48 81 EC ? ? ? ? 0F 10 4A ? 4C 8B 1A 4C 3B 1D ? ? ? ? 0F 10 42 ? 48 89 58 ? 48 8B D9 0F 10 52 ? 0F 10 5A ? 0F 10 62 ? 0F 10 6A ? 0F 29 70 ? 0F 10 72 ? 0F 29 78 ? 0F B7 82 ? ? ? ? 0F 10 BA ? ? ? ? 66 89 45 ? 0F B7 82 ? ? ? ? 66 89 45 ? 0F 11 4C 24 ? 74 ? 44 8B 49"_sig, + "48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 31 E0 48 89 84 24 ? ? ? ? 48 8B 02 48 3B 05 ? ? ? ? 0F 85"_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 ? 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 ? 44 0F 29 48 ? 44 0F 29 50 ? 44 0F 29 98 ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 45 ? 4C 8B EA"_sig, + "55 41 56 56 57 53 48 81 EC ? ? ? ? 48 8D AC 24 ? ? ? ? 0F 29 7D ? 0F 29 75 ? 48 C7 45 ? ? ? ? ? 48 89 D7 48 89 CE"_sig, "LocalPlayer::applyTurnDelta"}; // see what accesses things in moveinputhandler inline static SigImpl ClientInputUpdateSystem_tickBaseInput{[](memory::signature_store&, uintptr_t res) { return res; }, - "4C 8B DC 53 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 44 24 ? 48 8B 9C 24"_sig, + "41 57 41 56 41 55 41 54 56 57 55 53 48 81 EC ? ? ? ? 0F 29 7C 24 ? 0F 29 74 24 ? 4C 89 4C 24 ? 4C 89 44 24"_sig, "ClientInputUpdateSystem::tickBaseInput"}; - inline static SigImpl CameraViewBob{[](memory::signature_store&, uintptr_t res) { return res; }, - "40 53 48 81 ec ? ? ? ? 48 8b 05 ? ? ? ? 48 33 c4 48 89 44 24 ? 49 8b 00"_sig, - "CameraViewBob"}; - inline static SigImpl ItemStackBase_getHoverName{[](memory::signature_store&, uintptr_t res) { return res; }, - "48 89 5C 24 ? 48 89 54 24 ? 55 56 57 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 84 24 ? ? ? ? 48 8B FA"_sig, + "55 41 56 56 57 53 48 83 EC ? 48 8D 6C 24 ? 48 C7 45 ? ? ? ? ? 48 89 D6 48 8D 7D ? 48 89 FA E8 ? ? ? ? 48 89 F9"_sig, "ItemStackBase::getHoverName"}; inline static SigImpl Tessellator_vertex{[](memory::signature_store&, uintptr_t res) { return res; }, - "48 8B C4 48 89 58 ? 48 89 68 ? 56 57 41 54 41 56 41 57 48 81 EC ? ? ? ? 0F 29 70 ? 0F 29 78 ? 44 0F 29 40 ? 44 0F 29 48 ? 44 0F 28 C3"_sig, + "56 57 48 83 EC ? 0F 29 7C 24 ? 0F 29 74 24 ? 48 8B 05 ? ? ? ? 48 31 E0 48 89 44 24 ? 8B 81"_sig, "Tessellator::vertex"}; inline static SigImpl Tessellator_begin{[](memory::signature_store&, uintptr_t res) { return res; }, - "40 57 48 83 EC ? 80 B9 ? ? ? ? ? 4C 8B D1"_sig, + "41 56 56 57 55 53 48 83 EC ? 48 8B 05 ? ? ? ? 48 31 E0 48 89 44 24 ? 80 B9 ? ? ? ? ? 0F 85"_sig, "Tessellator::begin"}; inline static SigImpl Tessellator_color{[](memory::signature_store&, uintptr_t res) { return res; }, - "F3 0F 10 42 ? 41 B8"_sig, + "80 B9 ? ? ? ? ? 0F 85 ? ? ? ? F3 0F 10 05 ? ? ? ? F3 0F 10 0A"_sig, "Tessellator::color"}; - inline static SigImpl MeshHelpers_renderMeshImmediately{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, - "E8 ? ? ? ? 41 C6 45 ? ? F3 41 0F 10 5E"_sig, + inline static SigImpl MeshHelpers_renderMeshImmediately{[](memory::signature_store&, uintptr_t res) { return res; }, + "55 41 57 41 56 56 57 53 48 81 EC ? ? ? ? 48 8D AC 24 ? ? ? ? 48 C7 85 ? ? ? ? ? ? ? ? 4D 89 CE 4C 89 C7 48 89 D6 48 89 CB 48 89 D1 E8 ? ? ? ? 84 C0 75"_sig, "MeshHelpers::renderMeshImmediately"}; inline static SigImpl BaseActorRenderContext_BaseActorRenderContext{[](memory::signature_store&, uintptr_t res) { return res; }, - "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 48 89 4C 24 ? 57 48 83 EC ? 49 8B F8 48 8B DA 48 8B F1 48 8D 05 ? ? ? ? 48 89 01 33 ED"_sig, + "55 56 57 53 48 83 EC ? 48 8D 6C 24 ? 48 C7 45 ? ? ? ? ? 4C 89 C6 48 89 D7 48 89 CB 48 8D 05 ? ? ? ? 48 89 01 0F 57 C0"_sig, "BaseActorRenderContext::BaseActorRenderContext"}; inline static SigImpl ItemRenderer_renderGuiItemNew{ [](memory::signature_store& store, uintptr_t) { return store.deref(1); }, - "E8 ? ? ? ? 4C 8D 4C 24 ? 4C 8D 44 24 ? 48 8B D5 E8 ? ? ? ? 80 BF"_sig, + "E8 ? ? ? ? 4C 8D 45 ? 4C 8D 8D ? ? ? ? 48 89 F2 E8 ? ? ? ? 80 BF"_sig, "ItemRenderer::renderGuiItemNew"}; - inline static SigImpl BaseAttributeMap_getInstance{[](memory::signature_store& store, uintptr_t) { return store.deref(1); }, - "E8 ? ? ? ? 4C 8B 76 ? 48 8B 44 24"_sig, - "BaseAttributeMap::getInstance"}; - - inline static SigImpl UIControl_getPosition{[](memory::signature_store&, uintptr_t res) { return res; }, - "48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC ? 0F 29 74 24 ? 0F 29 7C 24 ? 48 8B F9 F6 41"_sig, - "UIControl::getPosition"}; - - inline static SigImpl MinecraftGame_getPrimaryClientInstance{[](memory::signature_store&, uintptr_t res) { return res; }, - "4C 8B 81 ? ? ? ? 49 8B D0 49 8B 48"_sig, - "MinecraftGame::getPrimaryClientInstance"}; + inline static SigImpl UIControl_updateCachedPosition{[](memory::signature_store&, uintptr_t res) { return res; }, + "55 56 57 48 83 EC ? 48 8D 6C 24 ? 0F 29 75 ? 48 C7 45 ? ? ? ? ? 48 89 CE 0F 57 F6 0F 29 75"_sig, + "UIControl::updateCachedPosition"}; 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 ? ? ? ? 0F 29 B4 24 ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 45 ? 4D 8B E1 49 8B F0 4C 8B FA"_sig, + "55 41 57 41 56 41 55 41 54 56 57 53 48 81 EC ? ? ? ? 48 8D AC 24 ? ? ? ? 0F 29 75 ? 48 C7 45 ? ? ? ? ? 4D 89 CE 4C 89 C6 48 89 D7"_sig, "ActorRenderDispatcher::render"}; // "No renderer found - have you set the entity's description:identifier correctly?" - inline static SigImpl LevelRendererPlayer_renderOutlineSelection{[](memory::signature_store& storage, uintptr_t) { return storage.deref(1); }, - "E8 ? ? ? ? EB ? 0F B6 44 24 ? 88 44 24 ? C6 44 24"_sig, + inline static SigImpl LevelRendererPlayer_renderOutlineSelection{[](memory::signature_store&, uintptr_t res) { return res; }, + "55 41 57 41 56 41 54 56 57 53 48 81 EC ? ? ? ? 48 8D AC 24 ? ? ? ? 48 C7 45 ? ? ? ? ? 4D 89 CE 4D 89 C7"_sig, "LevelRendererPlayer::renderOutlineSelection"}; inline static SigImpl Dimension_getTimeOfDay{[](memory::signature_store&, uintptr_t res) { return res; }, - "44 8B C2 B8 ? ? ? ? F7 EA"_sig, + "48 83 EC ? 0F 29 7C 24 ? 0F 29 74 24 ? 48 63 C2"_sig, "Dimension::getTimeOfDay"}; inline static SigImpl Dimension_tick{[](memory::signature_store&, uintptr_t res) { return res; }, - "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 41 56 41 57 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 84 24 ? ? ? ? 48 8B F9 48 8B 99"_sig, + "55 56 57 53 48 83 EC ? 48 8D 6C 24 ? 48 C7 45 ? ? ? ? ? 48 89 CE 48 8B 89 ? ? ? ? E8 ? ? ? ? 48 8B 8E"_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, + "48 89 D0 41 0F 10 00 0F 11 02 F3 0F 10 05"_sig, "Dimension::getSkyColor"}; inline static SigImpl ItemStackBase_getDamageValue{ [](memory::signature_store&, uintptr_t res) { return res; }, - "40 53 48 83 EC ? 48 8B 51 ? 33 DB"_sig, + "56 57 48 83 EC ? 48 8B 05 ? ? ? ? 48 31 E0 48 89 44 24 ? 48 8B 41 ? 48 85 C0 74 ? 48 83 38"_sig, "ItemStackBase::getDamageValue" }; inline static SigImpl MinecraftPackets_createPacket{ [](memory::signature_store&, uintptr_t res) { return res; }, - "48 89 5C 24 ? 48 89 74 24 ? 55 57 41 56 48 8B EC 48 83 EC ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 45 ? 48 8B F9"_sig, + "56 48 83 EC ? 48 89 CE 81 FA"_sig, "MinecraftPackets::createPacket" }; inline static SigImpl Actor_attack{ [](memory::signature_store&, uintptr_t res) { return res; }, - "48 8B C4 48 89 58 ? 55 56 57 41 54 41 55 41 56 41 57 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 0F 29 70 ? 0F 29 78 ? 44 0F 29 40 ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 4C 89 4C 24"_sig, + "55 41 57 41 56 41 55 41 54 56 57 53 48 81 EC ? ? ? ? 48 8D AC 24 ? ? ? ? 0F 29 B5 ? ? ? ? 48 C7 85 ? ? ? ? ? ? ? ? 4D 89 CD 4C 89 C3"_sig, "Actor::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"_sig, + "55 41 57 41 56 41 55 41 54 56 57 53 48 83 EC ? 48 8D 6C 24 ? 48 C7 45 ? ? ? ? ? 44 89 C7 48 89 CE 48 81 C1"_sig, "GuiData::_addMessage(MessageContext*, UIProfanityContext)" }; - inline static SigImpl Actor_getArmor{ [](memory::signature_store& store, uintptr_t) { return store.deref(1); }, - "e8 ? ? ? ? 48 85 c0 0f 84 ? ? ? ? 48 8b 08 48 8b 01 ba ? ? ? ? 48 8b 40 ? ff 15 ? ? ? ? 48 8b f8 80 78 ? ? 0f 84 ? ? ? ? 48 8b 40 ? 48 85 c0 0f 84"_sig, - "Actor::getArmor" }; - inline static SigImpl Actor_setNameTag{ [](memory::signature_store&, uintptr_t res) { return res; }, - "48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC ? 48 8B FA 48 8B D9 48 8B 89 ? ? ? ? 48 85 C9"_sig, + "55 56 57 53 48 83 EC ? 48 8D 6C 24 ? 48 C7 45 ? ? ? ? ? 48 89 D7 48 89 CE 48 81 C1 ? ? ? ? 48 8D 55"_sig, "Actor::setNameTag" }; inline static SigImpl _updatePlayer{ [](memory::signature_store&, uintptr_t res) { return res; }, - "48 89 5C 24 ? 55 56 57 41 56 41 57 48 8D 6C 24 ? 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 45 ? 49 8B 58"_sig, + "41 57 41 56 41 55 41 54 56 57 55 53 48 83 EC ? 0F 29 74 24 ? 4C 89 C6 48 89 C8"_sig, "UpdatePlayerFromCameraSystemUtil::_updatePlayer" }; // showHowToPlayScreen 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 ? ? ? ? 48 81 EC ? ? ? ? 0F 29 B4 24 ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 48 8B F2 4C 8B F1 33 DB"_sig, + "55 41 57 41 56 41 55 41 54 56 57 53 48 81 EC ? ? ? ? 48 8D AC 24 ? ? ? ? 0F 29 B5 ? ? ? ? 48 C7 85 ? ? ? ? ? ? ? ? 49 89 D4 49 89 CD"_sig, "GameArguments::_onUri" }; inline static SigImpl RenderMaterialGroup__common{ [](memory::signature_store& store, uintptr_t) { return store.deref(3); }, - "48 8D 15 ? ? ? ? E8 ? ? ? ? 90 49 8D 8E ? ? ? ? E8"_sig, + "48 8D 15 ? ? ? ? 48 8D 4D ? 4D 89 F8 E8"_sig, "mce::RenderMaterialGroup::common" }; inline static SigImpl GuiData_displayClientMessage{ [](memory::signature_store&, uintptr_t res) { return res; }, - "40 55 53 56 57 41 56 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 41 0F B6 ? 49 8B D8"_sig, + "55 56 53 48 81 EC ? ? ? ? 48 8D AC 24 ? ? ? ? 48 C7 85 ? ? ? ? ? ? ? ? 44 88 CB"_sig, "GuiData::displayClientMessage" }; inline static SigImpl BaseActorRenderer_renderText{ [](memory::signature_store& store, uintptr_t) { return store.deref(1); }, - "E8 ? ? ? ? 48 83 C3 ? 48 3B DE 75 ? 48 8B 5C 24 ? 48 8B 6C 24 ? 48 8B 74 24 ? 48 83 C4 ? 41 5F"_sig, + "E8 ? ? ? ? 49 81 C7 ? ? ? ? 4D 39 E7 75 ? 48 83 C4"_sig, "BaseActorRenderer_renderText" }; inline static SigImpl AppPlatformGDK_releaseMouse{[](memory::signature_store&, uintptr_t res) { return res; }, - "40 53 48 83 EC ? 48 8B D9 B9 ? ? ? ? FF 15 ? ? ? ? 85 C0"_sig, + "56 57 48 83 EC ? 48 89 CE B9 ? ? ? ? FF 15"_sig, "AppPlatformGDK_releaseMouse" }; }; diff --git a/src/mc/common/client/game/ClientInstance.cpp b/src/mc/common/client/game/ClientInstance.cpp index 8b75c59a..39fa27d6 100644 --- a/src/mc/common/client/game/ClientInstance.cpp +++ b/src/mc/common/client/game/ClientInstance.cpp @@ -1,19 +1,19 @@ #include "pch.h" #include "ClientInstance.h" -#include "util/Util.h" +#include "Platform_GameCore.h" SDK::ClientInstance* SDK::ClientInstance::instance = nullptr; SDK::ClientInstance* SDK::ClientInstance::get() { if (!instance) { // IMinecraftGame - MinecraftGame** mcgame = reinterpret_cast(Signatures::Misc::minecraftGamePointer.result); - if (!*mcgame) { + const auto mcgame = Platform_GameCore::get()->getMinecraftGame(); + if (!mcgame) { return nullptr; } - instance = (*mcgame)->getPrimaryClientInstance(); + instance = mcgame->getPrimaryClientInstance(); } return instance; } @@ -32,13 +32,9 @@ SDK::GuiData* SDK::ClientInstance::getGuiData() { } SDK::Options* SDK::ClientInstance::getOptions() { - return memory::callVirtual(this, 0xB1); + return hat::member_at(this, 0xC38); } -/*SDK::ClientHMDState* SDK::ClientInstance::getClientHMDState() { - return memory::callVirtual(this, 0x197); -}*/ - void SDK::ClientInstance::grabCursor() { reinterpret_cast(Signatures::ClientInstance_grabCursor.result)(this); } diff --git a/src/mc/common/client/game/GameCore.cpp b/src/mc/common/client/game/GameCore.cpp index 668533f2..c2390261 100644 --- a/src/mc/common/client/game/GameCore.cpp +++ b/src/mc/common/client/game/GameCore.cpp @@ -1,7 +1,8 @@ #include "pch.h" #include "GameCore.h" +#include "Platform_GameCore.h" + SDK::GameCore* SDK::GameCore::get() { - static auto result = *reinterpret_cast(Signatures::Misc::gameCorePointer.result); - return result; -} \ No newline at end of file + return SDK::Platform_GameCore::get()->getGameCore(); +} diff --git a/src/mc/common/client/game/MinecraftGame.cpp b/src/mc/common/client/game/MinecraftGame.cpp index 727753d5..497a197c 100644 --- a/src/mc/common/client/game/MinecraftGame.cpp +++ b/src/mc/common/client/game/MinecraftGame.cpp @@ -3,10 +3,10 @@ #include "mc/Addresses.h" bool SDK::MinecraftGame::isCursorGrabbed() { - return hat::member_at(this, Signatures::Offset::MinecraftGame_cursorGrabbed.result); + return hat::member_at(this, 0x1E0); } SDK::ClientInstance* SDK::MinecraftGame::getPrimaryClientInstance() { - const auto map = reinterpret_cast>*>(reinterpret_cast(this) + 0xA08); - return map->at(0).get(); + const auto map = hat::member_at>>(this, 0x990); + return map.at(0).get(); } diff --git a/src/mc/common/client/game/MinecraftGame.h b/src/mc/common/client/game/MinecraftGame.h index e13cf1b0..d3d73746 100644 --- a/src/mc/common/client/game/MinecraftGame.h +++ b/src/mc/common/client/game/MinecraftGame.h @@ -10,12 +10,12 @@ namespace SDK { public: bool isCursorGrabbed(); - CLASS_FIELD(std::string, xuid, 0x358); - CLASS_FIELD(GameRenderer*, gameRenderer, 0xD78); + CLASS_FIELD(std::string, xuid, 0x2D8); + CLASS_FIELD(GameRenderer*, gameRenderer, 0xFA0); private: - CLASS_FIELD(class FontRepository**, fontRepo, 0xF18); + CLASS_FIELD(class FontRepository**, fontRepo, 0x1130); public: - CLASS_FIELD(class Font*, minecraftFont, 0xF20); + CLASS_FIELD(class Font*, minecraftFont, 0x1138); class FontRepository* getFontRepository() { return reinterpret_cast(fontRepo); diff --git a/src/mc/common/client/game/MouseAction.h b/src/mc/common/client/game/MouseAction.h new file mode 100644 index 00000000..dee295d7 --- /dev/null +++ b/src/mc/common/client/game/MouseAction.h @@ -0,0 +1,14 @@ +#pragma once + +namespace SDK { + struct MouseAction { + int16_t x; + int16_t y; + int16_t dx; + int16_t dy; + int8_t action; + int8_t data; + int pointerId; + bool forceMotionlessPointer; + }; +} diff --git a/src/mc/common/client/game/MouseDevice.cpp b/src/mc/common/client/game/MouseDevice.cpp new file mode 100644 index 00000000..0c3863ce --- /dev/null +++ b/src/mc/common/client/game/MouseDevice.cpp @@ -0,0 +1,6 @@ +#include "MouseDevice.h" + +SDK::MouseDevice* SDK::MouseDevice::get() { + static auto mouse = reinterpret_cast(Signatures::Misc::mouseDevice.result); + return mouse; +} diff --git a/src/mc/common/client/game/MouseDevice.h b/src/mc/common/client/game/MouseDevice.h new file mode 100644 index 00000000..5a9e2e34 --- /dev/null +++ b/src/mc/common/client/game/MouseDevice.h @@ -0,0 +1,22 @@ +#pragma once + +#include "MouseAction.h" + +namespace SDK { + class MouseDevice { + public: + int16_t clickX; + int16_t clickY; + int16_t x; + int16_t y; + int16_t dx; + int16_t dy; + int16_t xOld; + int16_t yOld; + bool buttonStates[7]; + std::vector inputs; + int32_t firstMovementType; + + static MouseDevice* get(); + }; +} diff --git a/src/mc/common/client/game/MouseInputPacket.h b/src/mc/common/client/game/MouseInputPacket.h deleted file mode 100644 index cd841ca5..00000000 --- a/src/mc/common/client/game/MouseInputPacket.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -struct MouseInputPacket { // Made up - int16_t x; - int16_t y; - -private: - int pad; - -public: - int8_t type; - int8_t state; - -private: - char pad2[0x8]; -}; diff --git a/src/mc/common/client/game/Platform_GameCore.cpp b/src/mc/common/client/game/Platform_GameCore.cpp new file mode 100644 index 00000000..1a747b12 --- /dev/null +++ b/src/mc/common/client/game/Platform_GameCore.cpp @@ -0,0 +1,14 @@ +#include "Platform_GameCore.h" + +SDK::MinecraftGame* SDK::Platform_GameCore::getMinecraftGame() { + return hat::member_at(this, 0x38); +} + +SDK::GameCore* SDK::Platform_GameCore::getGameCore() { + return hat::member_at(this, 0xD0); +} + +SDK::Platform_GameCore* SDK::Platform_GameCore::get() { + static auto ptr = hat::member_at(*reinterpret_cast(Signatures::Misc::Platform_GameCore.result), 0x8); + return ptr; +} diff --git a/src/mc/common/client/game/Platform_GameCore.h b/src/mc/common/client/game/Platform_GameCore.h new file mode 100644 index 00000000..e2252218 --- /dev/null +++ b/src/mc/common/client/game/Platform_GameCore.h @@ -0,0 +1,14 @@ +#pragma once + +#include "GameCore.h" +#include "MinecraftGame.h" + +namespace SDK { + class Platform_GameCore { + public: + MinecraftGame* getMinecraftGame(); + GameCore* getGameCore(); + + static Platform_GameCore* get(); + }; +} diff --git a/src/mc/common/client/gui/controls/UIControl.cpp b/src/mc/common/client/gui/controls/UIControl.cpp index 585f3312..d15a36c5 100644 --- a/src/mc/common/client/gui/controls/UIControl.cpp +++ b/src/mc/common/client/gui/controls/UIControl.cpp @@ -5,5 +5,5 @@ void SDK::UIControl::updatePos() { flags |= 1; - reinterpret_cast(Signatures::UIControl_getPosition.result)(this); + reinterpret_cast(Signatures::UIControl_updateCachedPosition.result)(this); } diff --git a/src/mc/common/client/renderer/ItemRenderer.cpp b/src/mc/common/client/renderer/ItemRenderer.cpp index af40aff9..49a5527e 100644 --- a/src/mc/common/client/renderer/ItemRenderer.cpp +++ b/src/mc/common/client/renderer/ItemRenderer.cpp @@ -4,5 +4,5 @@ void SDK::ItemRenderer::renderGuiItemNew(SDK::BaseActorRenderContext* baseActorRenderContext, SDK::ItemStack* itemStack, int mode, float x, float y, float opacity, float scale, float a9, bool ench) { using oFunc_t = void(__fastcall*)(ItemRenderer*, BaseActorRenderContext* baseActorRenderContext, ItemStack* itemStack, int, float x, float y, bool ench, float opacity, float a9, float scale, int); static auto oFunc = reinterpret_cast(Signatures::ItemRenderer_renderGuiItemNew.result); - oFunc(this, baseActorRenderContext, itemStack, mode, x, y, ench, opacity, 0, scale, 17); + oFunc(this, baseActorRenderContext, itemStack, mode, x, y, ench, opacity, a9, scale, 17); } \ No newline at end of file diff --git a/src/mc/common/client/renderer/game/LevelRenderer.h b/src/mc/common/client/renderer/game/LevelRenderer.h index 40bf0ae8..1280dd27 100644 --- a/src/mc/common/client/renderer/game/LevelRenderer.h +++ b/src/mc/common/client/renderer/game/LevelRenderer.h @@ -4,7 +4,7 @@ namespace SDK { class LevelRenderer { - CLASS_FIELD(LevelRendererPlayer*, levelRendererPlayer, 0x448); + CLASS_FIELD(LevelRendererPlayer*, levelRendererPlayer, 0x478); public: LevelRendererPlayer* getLevelRendererPlayer() { return levelRendererPlayer; diff --git a/src/mc/common/client/renderer/game/LevelRendererPlayer.cpp b/src/mc/common/client/renderer/game/LevelRendererPlayer.cpp index dd52a3f0..c8a2026c 100644 --- a/src/mc/common/client/renderer/game/LevelRendererPlayer.cpp +++ b/src/mc/common/client/renderer/game/LevelRendererPlayer.cpp @@ -4,7 +4,7 @@ #include "util/LMath.h" Vec3& SDK::LevelRendererPlayer::getOrigin() { - return hat::member_at(this, Signatures::Offset::LevelRendererPlayer_origin.result); + return hat::member_at(this, 0x710); } float& SDK::LevelRendererPlayer::getFovX() { diff --git a/src/mc/common/entity/EntityContext.h b/src/mc/common/entity/EntityContext.h index 9930361f..ce22dbd9 100644 --- a/src/mc/common/entity/EntityContext.h +++ b/src/mc/common/entity/EntityContext.h @@ -1,43 +1,53 @@ #pragma once -#include -#include -#include "util/LMath.h" - -namespace SDK { - class EntityContext { - public: - uintptr_t getBasicRegistry() { - return basicRegistry; - } - - uint32_t& getId() { - return id; - } - private: - void* entityRegistry; - uintptr_t basicRegistry; - uint32_t id; - }; - - struct AABBShapeComponent - { - public: - AABB boundingBox; - Vec2 size; - }; //Size: 0x0020 - - class StateVectorComponent - { - public: - Vec3 pos; //0x0000 - Vec3 posOld; //0x000C - Vec3 velocity; //0x0018 - }; //Size: 0x0024 - - class ActorRotationComponent - { - public: - Vec2 rotation; //0x0000 - Vec2 rotationOld; //0x0008 - }; //Size: 0x0010 -} + +#include "EntityIdTraits.h" +#include "IEntityComponent.h" + +template<> +struct entt::entt_traits : entt::basic_entt_traits { + static constexpr std::size_t page_size = 2048; +}; + +template Type> +struct entt::component_traits { + using element_type = Type; + using entity_type = EntityId; + static constexpr bool in_place_delete = true; + static constexpr std::size_t page_size = 128 * !std::is_empty_v; +}; + +template +struct entt::storage_type { + using type = basic_storage; +}; + +template Type> +struct entt::type_hash { + [[nodiscard]] static consteval id_type value() noexcept { + constexpr auto hash = Type::type_hash; // Pre-define hash to avoid compiler shenanigans + return hash; + } + + [[nodiscard]] consteval operator id_type() const noexcept { + return value(); + } +}; + +class EntityRegistry : public std::enable_shared_from_this { +public: + std::string name; + entt::basic_registry ownedRegistry; + uint32_t id; + + template + T* tryGetGlobalComponent() { + return this->ownedRegistry.ctx().find(); + } +}; + +class EntityContext { +public: + EntityRegistry& registry; + entt::basic_registry& enttRegistry; + EntityId entity; +}; diff --git a/src/mc/common/entity/EntityId.h b/src/mc/common/entity/EntityId.h new file mode 100644 index 00000000..38416eb9 --- /dev/null +++ b/src/mc/common/entity/EntityId.h @@ -0,0 +1,11 @@ +#pragma once + +struct EntityId { + uint32_t rawId; + + [[nodiscard]] constexpr bool operator==(const EntityId& other) const = default; + + [[nodiscard]] constexpr operator uint32_t() const { + return this->rawId; + } +}; diff --git a/src/mc/common/entity/EntityIdTraits.h b/src/mc/common/entity/EntityIdTraits.h new file mode 100644 index 00000000..7121a4c4 --- /dev/null +++ b/src/mc/common/entity/EntityIdTraits.h @@ -0,0 +1,13 @@ +#pragma once + +#include "EntityId.h" + +struct EntityIdTraits { + using value_type = EntityId; + + using entity_type = uint32_t; + using version_type = uint16_t; + + static constexpr entity_type entity_mask = 0x3FFFF; // lower 18 bits of raw id + static constexpr entity_type version_mask = 0x3FFF; // upper 14 bits of raw id +}; diff --git a/src/mc/common/entity/IEntityComponent.h b/src/mc/common/entity/IEntityComponent.h new file mode 100644 index 00000000..6b46b3e7 --- /dev/null +++ b/src/mc/common/entity/IEntityComponent.h @@ -0,0 +1,3 @@ +#pragma once + +struct IEntityComponent {}; diff --git a/src/mc/common/entity/component/AABBShapeComponent.h b/src/mc/common/entity/component/AABBShapeComponent.h new file mode 100644 index 00000000..4a8f93fd --- /dev/null +++ b/src/mc/common/entity/component/AABBShapeComponent.h @@ -0,0 +1,10 @@ +#pragma once + +namespace SDK { + struct AABBShapeComponent : IEntityComponent { + static constexpr uint32_t type_hash = 0xBAC1B3CF; + + AABB boundingBox; + Vec2 size; + }; +} diff --git a/src/mc/common/entity/component/ActorDataFlagComponent.h b/src/mc/common/entity/component/ActorDataFlagComponent.h index 845e5b27..e66eb69c 100644 --- a/src/mc/common/entity/component/ActorDataFlagComponent.h +++ b/src/mc/common/entity/component/ActorDataFlagComponent.h @@ -1,7 +1,9 @@ #pragma once namespace SDK { - struct ActorDataFlagComponent { + struct ActorDataFlagComponent : IEntityComponent { + static constexpr uint32_t type_hash = 0xC67426F3; + std::bitset<119> flags; }; } diff --git a/src/mc/common/entity/component/ActorEquipmentComponent.h b/src/mc/common/entity/component/ActorEquipmentComponent.h index 531d3678..9e3c1bb1 100644 --- a/src/mc/common/entity/component/ActorEquipmentComponent.h +++ b/src/mc/common/entity/component/ActorEquipmentComponent.h @@ -1,7 +1,9 @@ #pragma once namespace SDK { - struct ActorEquipmentComponent { + struct ActorEquipmentComponent : IEntityComponent { + static constexpr uint32_t type_hash = 0xB06141A9; + SDK::Inventory* handContainer; SDK::Inventory* armorContainer; }; diff --git a/src/mc/common/entity/component/ActorRotationComponent.h b/src/mc/common/entity/component/ActorRotationComponent.h new file mode 100644 index 00000000..a76c8d95 --- /dev/null +++ b/src/mc/common/entity/component/ActorRotationComponent.h @@ -0,0 +1,10 @@ +#pragma once + +namespace SDK { + struct ActorRotationComponent : IEntityComponent { + static constexpr uint32_t type_hash = 0x75DF36B7; + + Vec2 rotation; + Vec2 rotationOld; + }; +} diff --git a/src/mc/common/entity/component/ActorTypeComponent.h b/src/mc/common/entity/component/ActorTypeComponent.h index d539acae..7e77eaed 100644 --- a/src/mc/common/entity/component/ActorTypeComponent.h +++ b/src/mc/common/entity/component/ActorTypeComponent.h @@ -1,7 +1,9 @@ #pragma once namespace SDK { - struct ActorTypeComponent { + struct ActorTypeComponent : IEntityComponent { + static constexpr uint32_t type_hash = 0x4F6BA419; + uint32_t type; }; } diff --git a/src/mc/common/entity/component/AttributesComponent.h b/src/mc/common/entity/component/AttributesComponent.h index a0b4fc68..e6372cf9 100644 --- a/src/mc/common/entity/component/AttributesComponent.h +++ b/src/mc/common/entity/component/AttributesComponent.h @@ -8,7 +8,7 @@ namespace SDK { class BaseAttributeMap { std::vector ids; std::vector instances; - char pad[0x28]; + char pad[0x20]; struct AttributeResult { // Made up std::vector::iterator id; @@ -18,18 +18,21 @@ namespace SDK { public: AttributeInstance* getInstance(unsigned int id) { - using func_t = void(*)(AttributeResult&, BaseAttributeMap*, const uint32_t&); - static auto func = reinterpret_cast(Signatures::BaseAttributeMap_getInstance.result); - AttributeResult res{}; - func(res, this, id); - if (res.id == this->ids.end() || res.instance == this->instances.end()) + if (this->ids.size() != this->instances.size()) return nullptr; - return &*res.instance; + + for (size_t i = 0; i < this->ids.size(); i++) { + if (this->ids[i] == id) + return &this->instances[i]; + } + + return nullptr; } }; - class AttributesComponent { - public: + struct AttributesComponent : IEntityComponent { + static constexpr uint32_t type_hash = 0xFD3B0613; + BaseAttributeMap baseAttributes{}; }; } \ No newline at end of file diff --git a/src/mc/common/entity/component/MoveInputComponent.h b/src/mc/common/entity/component/MoveInputComponent.h index f1758653..febe6f8e 100644 --- a/src/mc/common/entity/component/MoveInputComponent.h +++ b/src/mc/common/entity/component/MoveInputComponent.h @@ -3,7 +3,9 @@ #include "MoveInputState.h" namespace SDK { - struct MoveInputComponent { + struct MoveInputComponent : IEntityComponent { + static constexpr uint32_t type_hash = 0x018B1887; + MoveInputState inputState; MoveInputState rawInputState; int8_t holdAutoJumpInWaterTicks; diff --git a/src/mc/common/entity/component/RuntimeIDComponent.h b/src/mc/common/entity/component/RuntimeIDComponent.h index 2dac599d..2457b36c 100644 --- a/src/mc/common/entity/component/RuntimeIDComponent.h +++ b/src/mc/common/entity/component/RuntimeIDComponent.h @@ -1,7 +1,9 @@ #pragma once namespace SDK { - struct RuntimeIDComponent { + struct RuntimeIDComponent : IEntityComponent { + static constexpr uint32_t type_hash = 0xFC0DBBB5; + uint64_t runtimeID; }; } diff --git a/src/mc/common/entity/component/StateVectorComponent.h b/src/mc/common/entity/component/StateVectorComponent.h new file mode 100644 index 00000000..f79e31d3 --- /dev/null +++ b/src/mc/common/entity/component/StateVectorComponent.h @@ -0,0 +1,11 @@ +#pragma once + +namespace SDK { + struct StateVectorComponent : IEntityComponent { + static constexpr uint32_t type_hash = 0x1B5D5238; + + Vec3 pos; + Vec3 posOld; + Vec3 velocity; + }; +} diff --git a/src/mc/common/network/RakNetConnector.h b/src/mc/common/network/RakNetConnector.h index 5563e43e..417ac15c 100644 --- a/src/mc/common/network/RakNetConnector.h +++ b/src/mc/common/network/RakNetConnector.h @@ -13,10 +13,10 @@ namespace SDK { RakNetConnector() = delete; - CLASS_FIELD(std::string, ipAddress, 0x3D0); - CLASS_FIELD(std::string, dns, 0x3F0); - CLASS_FIELD(uint16_t, port, 0x434); - CLASS_FIELD(std::string, featuredServer, 0x4D0); + CLASS_FIELD(std::string, ipAddress, 0x400); + CLASS_FIELD(std::string, dns, 0x420); + CLASS_FIELD(uint16_t, port, 0x464); + CLASS_FIELD(std::string, featuredServer, 0x500); class RakPeer* getPeer() { return memory::callVirtual(this, 0x19); diff --git a/src/mc/common/world/Attribute.h b/src/mc/common/world/Attribute.h index 8b3801f6..7c0d97a8 100644 --- a/src/mc/common/world/Attribute.h +++ b/src/mc/common/world/Attribute.h @@ -25,8 +25,8 @@ namespace SDK { class Attributes { public: - inline static Attribute Hunger = Attribute(1, "minecraft:hunger"); - inline static Attribute Saturation = Attribute(2, "minecraft:saturation"); - inline static Attribute Health = Attribute(6, "minecraft:health"); + inline static Attribute Hunger = Attribute(2, "minecraft:hunger"); + inline static Attribute Saturation = Attribute(3, "minecraft:saturation"); + inline static Attribute Health = Attribute(7, "minecraft:health"); }; } \ No newline at end of file diff --git a/src/mc/common/world/Minecraft.cpp b/src/mc/common/world/Minecraft.cpp index b17cbd26..b615847b 100644 --- a/src/mc/common/world/Minecraft.cpp +++ b/src/mc/common/world/Minecraft.cpp @@ -1,7 +1,5 @@ #include "pch.h" #include "Minecraft.h" -#include "mc/common/client/game/ClientInstance.h" -#include "mc/common/client/player/LocalPlayer.h" SDK::Level* SDK::Minecraft::getLevel() { if (gameSession) { diff --git a/src/mc/common/world/actor/Actor.cpp b/src/mc/common/world/actor/Actor.cpp index ca7120ea..b9cdd65f 100644 --- a/src/mc/common/world/actor/Actor.cpp +++ b/src/mc/common/world/actor/Actor.cpp @@ -10,7 +10,7 @@ #include "mc/common/entity/component/RuntimeIDComponent.h" SDK::ActorDataFlagComponent* SDK::Actor::getActorDataFlagsComponent() { - return reinterpret_cast(Signatures::Components::actorDataFlagsComponent.result)(entityContext.getBasicRegistry(), &entityContext.getId()); + return this->tryGetComponent(); } bool SDK::Actor::getStatusFlag(int flag) { @@ -58,12 +58,12 @@ void SDK::Actor::setNameTag(std::string* nametag) { return reinterpret_cast(Signatures::Actor_setNameTag.result)(this, nametag); } -int64_t SDK::Actor::getRuntimeID() { - return *reinterpret_cast(Signatures::Components::runtimeIDComponent.result)(entityContext.getBasicRegistry(), &entityContext.getId()); +uint64_t SDK::Actor::getRuntimeID() { + return this->tryGetComponent()->runtimeID; } -uint8_t SDK::Actor::getEntityTypeID() { - return *reinterpret_cast(Signatures::Components::actorTypeComponent.result)(entityContext.getBasicRegistry(), &entityContext.getId()); +uint32_t SDK::Actor::getEntityTypeID() { + return this->tryGetComponent()->type; } void SDK::Actor::swing() { @@ -76,7 +76,7 @@ bool SDK::Actor::isPlayer() { } SDK::AttributesComponent* SDK::Actor::getAttributesComponent() { - return reinterpret_cast(Signatures::Components::attributesComponent.result)(entityContext); + return this->tryGetComponent(); } SDK::AttributeInstance* SDK::Actor::getAttribute(SDK::Attribute& attribute) { @@ -110,10 +110,5 @@ bool SDK::Actor::isInvisible() { } SDK::ItemStack* SDK::Actor::getArmor(int armorSlot) { - // TODO: this is EXTREMELY scuffed - int& componentId = hat::member_at(this, 0x18); - auto obj = reinterpret_cast(Signatures::Components::actorEquipmentPersistentComponent.result) - (hat::member_at(this, 0x10), componentId); - - return (*(SDK::ItemStack*(**)(LPVOID, int))(**(uintptr_t**)((uintptr_t)obj + 8) + 56i64))(*(LPVOID*)((uintptr_t)obj + 8), armorSlot); + return this->tryGetComponent()->armorContainer->getItem(armorSlot); } diff --git a/src/mc/common/world/actor/Actor.h b/src/mc/common/world/actor/Actor.h index 53a0c95a..7bbbe4cf 100644 --- a/src/mc/common/world/actor/Actor.h +++ b/src/mc/common/world/actor/Actor.h @@ -4,7 +4,10 @@ #include "mc/common/util/MolangVariableMap.h" #include +#include "mc/common/entity/component/AABBShapeComponent.h" #include "mc/common/entity/component/ActorDataFlagComponent.h" +#include "mc/common/entity/component/ActorRotationComponent.h" +#include "mc/common/entity/component/StateVectorComponent.h" namespace SDK { class Actor { @@ -35,17 +38,22 @@ namespace SDK { int getCommandPermissionLevel(); void setNameTag(std::string* nametag); - int64_t getRuntimeID(); - uint8_t getEntityTypeID(); + uint64_t getRuntimeID(); + uint32_t getEntityTypeID(); void swing(); bool isPlayer(); - class AttributesComponent* getAttributesComponent(); + struct AttributesComponent* getAttributesComponent(); class AttributeInstance* getAttribute(class Attribute& attribute); float getHealth(); float getHunger(); float getSaturation(); bool isInvisible(); class ItemStack* getArmor(int armorSlot); + + template + T* tryGetComponent() { + return entityContext.enttRegistry.try_get(entityContext.entity); + } }; } diff --git a/src/mc/common/world/actor/player/Player.cpp b/src/mc/common/world/actor/player/Player.cpp index 4a5bcf1d..0e0e1c62 100644 --- a/src/mc/common/world/actor/player/Player.cpp +++ b/src/mc/common/world/actor/player/Player.cpp @@ -11,9 +11,7 @@ void SDK::Player::displayClientMessage(std::string const& message) { } SDK::MoveInputComponent* SDK::Player::getMoveInputComponent() { - using try_get_t = SDK::MoveInputComponent* (__fastcall*)(uintptr_t a1, uint32_t* a2); - static auto func = reinterpret_cast(Signatures::Components::moveInputComponent.result); - return func(entityContext.getBasicRegistry(), &entityContext.getId()); + return this->tryGetComponent(); } std::string SDK::Player::getXUID() { diff --git a/src/mc/common/world/level/Level.cpp b/src/mc/common/world/level/Level.cpp index 2a3e6dc8..8359432b 100644 --- a/src/mc/common/world/level/Level.cpp +++ b/src/mc/common/world/level/Level.cpp @@ -2,14 +2,15 @@ #include "Level.h" void SDK::Level::playSoundEvent(std::string const& text, Vec3 const& pos, float vol, float pitch) { - memory::callVirtual(this, 0xBA, text, pos, vol, pitch); + float unk[4]{}; + memory::callVirtual(this, 0xBB, text, pos, vol, pitch, unk); } std::vector SDK::Level::getRuntimeActorList() { std::vector list; // TODO: this might return a vector too? - memory::callVirtual&>(this, 0x142, list); + memory::callVirtual&>(this, 0x143, list); return list; } @@ -18,15 +19,15 @@ std::unordered_map* SDK::Level::getPlayerList() { } SDK::HitResult* SDK::Level::getHitResult() { - return memory::callVirtual(this, 0x14C); + return memory::callVirtual(this, 0x14D); } SDK::HitResult* SDK::Level::getLiquidHitResult() { - return reinterpret_cast(memory::callVirtual(this, 0x14D)) /*sizeof hitResult (0x60) / 8*/; + return reinterpret_cast(memory::callVirtual(this, 0x14E)) /*sizeof hitResult (0x60) / 8*/; } bool SDK::Level::isClientSide() { - return memory::callVirtual(this, 0x13B); + return memory::callVirtual(this, 0x13C); } const std::string& SDK::Level::getLevelName() { diff --git a/src/mc/common/world/level/block/Block.h b/src/mc/common/world/level/block/Block.h index 46ce19f1..86e9b392 100644 --- a/src/mc/common/world/level/block/Block.h +++ b/src/mc/common/world/level/block/Block.h @@ -5,7 +5,7 @@ namespace SDK { class Block { public: - CLASS_FIELD(BlockLegacy*, legacyBlock, 0x58); + CLASS_FIELD(BlockLegacy*, legacyBlock, 0x68); virtual ~Block() = 0; virtual int getRenderLayer() const = 0; diff --git a/src/mc/common/world/level/block/BlockLegacy.h b/src/mc/common/world/level/block/BlockLegacy.h index ab299d1c..a46294fe 100644 --- a/src/mc/common/world/level/block/BlockLegacy.h +++ b/src/mc/common/world/level/block/BlockLegacy.h @@ -6,10 +6,10 @@ namespace SDK { class BlockLegacy { public: CLASS_FIELD(std::string, translateName, 0x8); // tile.deepslate_diamond_ore - CLASS_FIELD(StringHash, name, 0x78); // deepslate_diamond_ore - CLASS_FIELD(std::string, Namespace, 0xA8); // minecraft - CLASS_FIELD(StringHash, namespacedId, 0xC8); // minecraft:deepslate_diamond_ore - CLASS_FIELD(std::string, itemGroup, 0x160); // itemGroup.name.ore + CLASS_FIELD(StringHash, name, 0x88); // deepslate_diamond_ore + CLASS_FIELD(std::string, Namespace, 0xB8); // minecraft + CLASS_FIELD(StringHash, namespacedId, 0xD8); // minecraft:deepslate_diamond_ore + CLASS_FIELD(std::string, itemGroup, 0x170); // itemGroup.name.ore private: virtual ~BlockLegacy() = 0; }; diff --git a/src/pch.h b/src/pch.h index e71e5a89..5d41cf09 100644 --- a/src/pch.h +++ b/src/pch.h @@ -20,6 +20,7 @@ #include #include #include +#include using namespace std::chrono_literals; @@ -33,6 +34,8 @@ using nlohmann::json; #include +#include + // COM #include #include diff --git a/src/util/DrawContext.cpp b/src/util/DrawContext.cpp index 91e21b95..b2786898 100644 --- a/src/util/DrawContext.cpp +++ b/src/util/DrawContext.cpp @@ -290,9 +290,9 @@ d2d::Rect MCDrawUtil::drawItem(SDK::ItemStack* item, Vec2 const& pos, float size auto it = item->getItem(); - ctx.itemRenderer->renderGuiItemNew(&ctx, item, 0, pos.x * guiScale, pos.y * guiScale, opacity, (sizeModifier * guiScale) * 3.f, 0.f, false); + ctx.itemRenderer->renderGuiItemNew(&ctx, item, 0, pos.x * guiScale, pos.y * guiScale, opacity, (sizeModifier * guiScale) * 3.f, 1.f, false); if (it && it->isGlint(item)) { - ctx.itemRenderer->renderGuiItemNew(&ctx, item, 0, pos.x * guiScale, pos.y * guiScale, opacity, (sizeModifier * guiScale) * 3.f, 0.f, true); + ctx.itemRenderer->renderGuiItemNew(&ctx, item, 0, pos.x * guiScale, pos.y * guiScale, opacity, (sizeModifier * guiScale) * 3.f, 1.f, true); } constexpr float itemSize = 16.f; From 0be6d4698156c7b3adbfad95d197036b719472e6 Mon Sep 17 00:00:00 2001 From: marioCST <68396929+marioCST@users.noreply.github.com> Date: Fri, 15 May 2026 18:44:10 +0200 Subject: [PATCH 2/3] Fix offset --- src/mc/common/network/RakNetConnector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mc/common/network/RakNetConnector.h b/src/mc/common/network/RakNetConnector.h index 417ac15c..918f6393 100644 --- a/src/mc/common/network/RakNetConnector.h +++ b/src/mc/common/network/RakNetConnector.h @@ -16,7 +16,7 @@ namespace SDK { CLASS_FIELD(std::string, ipAddress, 0x400); CLASS_FIELD(std::string, dns, 0x420); CLASS_FIELD(uint16_t, port, 0x464); - CLASS_FIELD(std::string, featuredServer, 0x500); + CLASS_FIELD(std::string, featuredServer, 0x508); class RakPeer* getPeer() { return memory::callVirtual(this, 0x19); From 84445abc04352788982ce46d28b2d36ae4b5c904 Mon Sep 17 00:00:00 2001 From: marioCST <68396929+marioCST@users.noreply.github.com> Date: Fri, 15 May 2026 19:41:40 +0200 Subject: [PATCH 3/3] Fix HideHandEvent --- src/mc/Addresses.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mc/Addresses.h b/src/mc/Addresses.h index 09ae66f6..2435fca2 100644 --- a/src/mc/Addresses.h +++ b/src/mc/Addresses.h @@ -59,7 +59,7 @@ class Signatures { "Options::getPerspective"}; inline static SigImpl Options_getHideHand{[](memory::signature_store&, uintptr_t res) { return res; }, - "56 48 83 EC ? 48 89 CE 48 8B 05 ? ? ? ? 48 31 E0 48 89 44 24 ? 48 8B 01 48 8B 40 ? 48 8D 54 24 ? 41 B8 A9 01 00 00"_sig, // Will probably die every update from now on, but a good sig would be thousands of bytes long + "48 83 EC 38 48 8B 05 ? ? ? ? 48 31 E0 48 89 44 24 ? 48 8B 01 48 8B 40 08 48 8D 54 24 ? 41 B8 AA 01 00 00"_sig, // Will probably die every update from now on, but a good sig would be thousands of bytes long "Options::getHideHand"}; inline static SigImpl ClientInstance_grabCursor{[](memory::signature_store&, uintptr_t res) { return res; },