From 0a2363280237fc9c9574b5eba1e7f2389dbd2158 Mon Sep 17 00:00:00 2001 From: jeanmajid Date: Wed, 23 Jul 2025 02:42:25 +0200 Subject: [PATCH 1/5] add GuiData::displayClientMessage_hk --- .vscode/settings.json | 103 ++++++++++++++++++++++++++ src/client/CMakeLists.txt | 1 + src/client/client.cpp | 3 +- src/client/memory/sdk/gui/GuiData.cpp | 7 ++ src/client/memory/sdk/gui/GuiData.hpp | 6 ++ src/client/memory/signatures.hpp | 6 ++ 6 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json create mode 100644 src/client/memory/sdk/gui/GuiData.cpp create mode 100644 src/client/memory/sdk/gui/GuiData.hpp diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..6514828 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,103 @@ +{ + "files.associations": { + "algorithm": "cpp", + "any": "cpp", + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "bitset": "cpp", + "cctype": "cpp", + "cfenv": "cpp", + "charconv": "cpp", + "chrono": "cpp", + "cinttypes": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "compare": "cpp", + "complex": "cpp", + "concepts": "cpp", + "condition_variable": "cpp", + "coroutine": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "deque": "cpp", + "exception": "cpp", + "execution": "cpp", + "resumable": "cpp", + "filesystem": "cpp", + "format": "cpp", + "forward_list": "cpp", + "fstream": "cpp", + "functional": "cpp", + "future": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "ios": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "iterator": "cpp", + "latch": "cpp", + "limits": "cpp", + "list": "cpp", + "locale": "cpp", + "map": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "mutex": "cpp", + "new": "cpp", + "numbers": "cpp", + "numeric": "cpp", + "optional": "cpp", + "ostream": "cpp", + "queue": "cpp", + "random": "cpp", + "ranges": "cpp", + "ratio": "cpp", + "regex": "cpp", + "set": "cpp", + "shared_mutex": "cpp", + "source_location": "cpp", + "span": "cpp", + "sstream": "cpp", + "stack": "cpp", + "stdexcept": "cpp", + "stop_token": "cpp", + "streambuf": "cpp", + "string": "cpp", + "system_error": "cpp", + "thread": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "typeindex": "cpp", + "typeinfo": "cpp", + "unordered_map": "cpp", + "unordered_set": "cpp", + "utility": "cpp", + "variant": "cpp", + "vector": "cpp", + "xfacet": "cpp", + "xhash": "cpp", + "xiosbase": "cpp", + "xlocale": "cpp", + "xlocbuf": "cpp", + "xlocinfo": "cpp", + "xlocmes": "cpp", + "xlocmon": "cpp", + "xlocnum": "cpp", + "xloctime": "cpp", + "xmemory": "cpp", + "xstddef": "cpp", + "xstring": "cpp", + "xtr1common": "cpp", + "xtree": "cpp", + "xutility": "cpp", + "pointers": "cpp" + } +} \ No newline at end of file diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index e20cb07..bb51988 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -13,6 +13,7 @@ add_library(selaura_client SHARED memory/sdk/renderer/bgfx/bgfx.cpp memory/sdk/core/RenderItemInHandDescription.cpp memory/sdk/client/ClientInstanceScreenModel.cpp + memory/sdk/gui/GuiData.cpp command/impl/Help.cpp feature/impl/render/fullbright.cpp feature/impl/render/paperdoll.cpp diff --git a/src/client/client.cpp b/src/client/client.cpp index 8d46b9c..24137bb 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -31,7 +31,8 @@ namespace selaura { &Dimension::getTimeOfDay_hk, &bgfx::d3d11::RendererContextD3D11::submit_hk, &bgfx::d3d12::RendererContextD3D12::submit_hk, - &ClientInstanceScreenModel::executeCommand_hk + &ClientInstanceScreenModel::executeCommand_hk, + &GuiData::displayClientMessage_hk >(); auto end = std::chrono::steady_clock::now(); diff --git a/src/client/memory/sdk/gui/GuiData.cpp b/src/client/memory/sdk/gui/GuiData.cpp new file mode 100644 index 0000000..cc4e6f6 --- /dev/null +++ b/src/client/memory/sdk/gui/GuiData.cpp @@ -0,0 +1,7 @@ +#include "GuiData.hpp" +#include "../../patcher.hpp" + +void GuiData::displayClientMessage_hk(const std::string& message) { + selaura::call_fn<&GuiData::displayClientMessage_hk>(this, message); +} + diff --git a/src/client/memory/sdk/gui/GuiData.hpp b/src/client/memory/sdk/gui/GuiData.hpp new file mode 100644 index 0000000..980850b --- /dev/null +++ b/src/client/memory/sdk/gui/GuiData.hpp @@ -0,0 +1,6 @@ +#pragma once +#include + +struct GuiData { + void displayClientMessage_hk(const std::string& message); +}; \ No newline at end of file diff --git a/src/client/memory/signatures.hpp b/src/client/memory/signatures.hpp index ef629fd..b604ea2 100644 --- a/src/client/memory/signatures.hpp +++ b/src/client/memory/signatures.hpp @@ -16,6 +16,7 @@ #include "sdk/world/BaseLightTextureImageBuilder.hpp" #include "sdk/world/Dimension.hpp" #include "sdk/client/ClientInstanceScreenModel.hpp" +#include "sdk/gui/GuiData.hpp" namespace selaura { template @@ -99,4 +100,9 @@ namespace selaura { struct selaura::signature<&ClientInstanceScreenModel::executeCommand_hk> { static constexpr auto value = hat::compile_signature<"48 89 5C 24 ? 55 56 57 41 54 41 55 41 56 41 57 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 4C 8B EA 48 8B F1 C7 44 24">(); }; + + template <> + struct selaura::signature<&GuiData::displayClientMessage_hk> { + static constexpr auto value = hat::compile_signature<"40 55 53 56 57 41 56 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 0F 29 B4 24 ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 49 8B F8 48 8B DA 48 8B F1 0F 57 C0">(); + }; }; From 19b31cd4d84c521fd75a747b0ca7946cd18dc76e Mon Sep 17 00:00:00 2001 From: jeanmajid Date: Wed, 23 Jul 2025 04:06:52 +0200 Subject: [PATCH 2/5] Add enable and disable commands to command handler --- src/client/CMakeLists.txt | 2 ++ src/client/command/command_handler.hpp | 8 ++++++-- src/client/command/impl/Disable.cpp | 25 +++++++++++++++++++++++++ src/client/command/impl/Disable.hpp | 6 ++++++ src/client/command/impl/Enable.cpp | 25 +++++++++++++++++++++++++ src/client/command/impl/Enable.hpp | 6 ++++++ src/client/main.cpp | 5 ++++- 7 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 src/client/command/impl/Disable.cpp create mode 100644 src/client/command/impl/Disable.hpp create mode 100644 src/client/command/impl/Enable.cpp create mode 100644 src/client/command/impl/Enable.hpp diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index bb51988..4b9628a 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -15,6 +15,8 @@ add_library(selaura_client SHARED memory/sdk/client/ClientInstanceScreenModel.cpp memory/sdk/gui/GuiData.cpp command/impl/Help.cpp + command/impl/Enable.cpp + command/impl/Disable.cpp feature/impl/render/fullbright.cpp feature/impl/render/paperdoll.cpp feature/impl/render/enchant_glint.cpp diff --git a/src/client/command/command_handler.hpp b/src/client/command/command_handler.hpp index 983bc44..34d96df 100644 --- a/src/client/command/command_handler.hpp +++ b/src/client/command/command_handler.hpp @@ -8,11 +8,15 @@ #include "command.hpp" #include "impl/Help.hpp" +#include "impl/Enable.hpp" +#include "impl/Disable.hpp" namespace selaura { - constexpr std::array default_commands = { - command{ "help", "Lists all available commands", &selaura::commands::help } + constexpr std::array default_commands = { + command{ "help", "Lists all available commands", &selaura::commands::help }, + command{ "enable", "Enable a module", &selaura::commands::enable }, + command{ "disable", "Disable a module", &selaura::commands::disable } }; inline std::vector command_list; diff --git a/src/client/command/impl/Disable.cpp b/src/client/command/impl/Disable.cpp new file mode 100644 index 0000000..b22cda0 --- /dev/null +++ b/src/client/command/impl/Disable.cpp @@ -0,0 +1,25 @@ +#include "Disable.hpp" +#include "../command_handler.hpp" +#include "../../client.hpp" + +namespace selaura::commands { + void disable(std::istringstream& iss) { + std::string module_search; + iss >> module_search; + + if (!module_search.empty()) { + auto& feature_manager = selaura::get()->get(); + feature_manager.for_each([&module_search](std::shared_ptr&f) { + std::string module_name = selaura::feature_traits::name.c_str(); + spdlog::info("Search: {}", module_name); + if (module_name == module_search) { + std::println("Disabled module {}", module_name); + f->set_enabled(false); + } + }); + } + else { + std::println("Usage: disable "); + } + } +}; \ No newline at end of file diff --git a/src/client/command/impl/Disable.hpp b/src/client/command/impl/Disable.hpp new file mode 100644 index 0000000..5bbd2c6 --- /dev/null +++ b/src/client/command/impl/Disable.hpp @@ -0,0 +1,6 @@ +#pragma once +#include + +namespace selaura::commands { + void disable(std::istringstream&); +}; \ No newline at end of file diff --git a/src/client/command/impl/Enable.cpp b/src/client/command/impl/Enable.cpp new file mode 100644 index 0000000..b350896 --- /dev/null +++ b/src/client/command/impl/Enable.cpp @@ -0,0 +1,25 @@ +#include "Enable.hpp" +#include "../command_handler.hpp" +#include "../../client.hpp" + +namespace selaura::commands { + void enable(std::istringstream& iss) { + std::string module_search; + iss >> module_search; + + if (!module_search.empty()) { + auto& feature_manager = selaura::get()->get(); + feature_manager.for_each([&module_search](std::shared_ptr&f) { + std::string module_name = selaura::feature_traits::name.c_str(); + spdlog::info("Search: {}", module_name); + if (module_name == module_search) { + std::println("Enabled module {}", module_name); + f->set_enabled(true); + } + }); + } + else { + std::println("Usage: enable "); + } + } +}; \ No newline at end of file diff --git a/src/client/command/impl/Enable.hpp b/src/client/command/impl/Enable.hpp new file mode 100644 index 0000000..f180e19 --- /dev/null +++ b/src/client/command/impl/Enable.hpp @@ -0,0 +1,6 @@ +#pragma once +#include + +namespace selaura::commands { + void enable(std::istringstream&); +}; \ No newline at end of file diff --git a/src/client/main.cpp b/src/client/main.cpp index b44b4ac..513df24 100644 --- a/src/client/main.cpp +++ b/src/client/main.cpp @@ -18,6 +18,9 @@ void init() { #endif static auto instance = std::make_shared(); instance->init(); + + auto& cmd_handler = instance->get(); + std::thread(&selaura::command_handler::init_cmd, &cmd_handler).detach(); } #ifdef SELAURA_WINDOWS @@ -27,7 +30,7 @@ BOOL APIENTRY DllMain(HMODULE hmodule, DWORD dw_reason, LPVOID lp_reserved) { if (!handle.valid()) return false; DisableThreadLibraryCalls(static_cast(handle.native_handle)); - std::thread(&init).detach(); + std::thread(&init).detach(); } return true; } From e7f5bb6008654819198e5289d4914a4cc255d35e Mon Sep 17 00:00:00 2001 From: jeanmajid Date: Fri, 25 Jul 2025 07:36:22 +0200 Subject: [PATCH 3/5] fix some things --- src/client/CMakeLists.txt | 3 --- src/client/main.cpp | 3 --- src/client/memory/signatures.hpp | 10 ++++++++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index f491e41..2c26aa0 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -14,9 +14,6 @@ add_library(selaura_client SHARED memory/sdk/core/RenderItemInHandDescription.cpp memory/sdk/client/ClientInstanceScreenModel.cpp memory/sdk/gui/GuiData.cpp - command/impl/Help.cpp - command/impl/Enable.cpp - command/impl/Disable.cpp memory/sdk/game/network/MinecraftPackets.cpp feature/impl/render/fullbright.cpp feature/impl/render/paperdoll.cpp diff --git a/src/client/main.cpp b/src/client/main.cpp index 513df24..4769058 100644 --- a/src/client/main.cpp +++ b/src/client/main.cpp @@ -18,9 +18,6 @@ void init() { #endif static auto instance = std::make_shared(); instance->init(); - - auto& cmd_handler = instance->get(); - std::thread(&selaura::command_handler::init_cmd, &cmd_handler).detach(); } #ifdef SELAURA_WINDOWS diff --git a/src/client/memory/signatures.hpp b/src/client/memory/signatures.hpp index c62e398..fcb6722 100644 --- a/src/client/memory/signatures.hpp +++ b/src/client/memory/signatures.hpp @@ -101,4 +101,14 @@ namespace selaura { struct selaura::signature<&ClientInstanceScreenModel::executeCommand_hk> { static constexpr auto value = hat::compile_signature<"48 89 5C 24 ? 55 56 57 41 54 41 55 41 56 41 57 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 4C 8B EA 48 8B F1 C7 44 24">(); }; + + template <> + struct selaura::signature<&GuiData::displayClientMessage_hk> { + static constexpr auto value = hat::compile_signature<"40 55 53 56 57 41 56 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 0F 29 B4 24 ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 49 8B F8 48 8B DA 48 8B F1 0F 57 C0">(); + }; + + template <> + struct selaura::signature<&MinecraftPackets::createPacket_hk> { + static constexpr auto value = hat::compile_signature<"48 89 5C 24 10 48 89 74 24 18 57 48 83 EC 50 48 8B 05 ? ? ? ? 48 33 C4 48 89 44 24 48 48 8B D9 48 89">(); + }; }; From 5258dc5601ec52ce0d63492d4493287d2d6e7e80 Mon Sep 17 00:00:00 2001 From: jeanmajid Date: Fri, 25 Jul 2025 07:38:29 +0200 Subject: [PATCH 4/5] remove some trash --- .vscode/settings.json | 103 ---------------------------- src/client/command/impl/Disable.cpp | 25 ------- src/client/command/impl/Disable.hpp | 6 -- src/client/command/impl/Enable.cpp | 25 ------- src/client/command/impl/Enable.hpp | 6 -- 5 files changed, 165 deletions(-) delete mode 100644 .vscode/settings.json delete mode 100644 src/client/command/impl/Disable.cpp delete mode 100644 src/client/command/impl/Disable.hpp delete mode 100644 src/client/command/impl/Enable.cpp delete mode 100644 src/client/command/impl/Enable.hpp diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 6514828..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "files.associations": { - "algorithm": "cpp", - "any": "cpp", - "array": "cpp", - "atomic": "cpp", - "bit": "cpp", - "bitset": "cpp", - "cctype": "cpp", - "cfenv": "cpp", - "charconv": "cpp", - "chrono": "cpp", - "cinttypes": "cpp", - "clocale": "cpp", - "cmath": "cpp", - "compare": "cpp", - "complex": "cpp", - "concepts": "cpp", - "condition_variable": "cpp", - "coroutine": "cpp", - "cstdarg": "cpp", - "cstddef": "cpp", - "cstdint": "cpp", - "cstdio": "cpp", - "cstdlib": "cpp", - "cstring": "cpp", - "ctime": "cpp", - "cwchar": "cpp", - "deque": "cpp", - "exception": "cpp", - "execution": "cpp", - "resumable": "cpp", - "filesystem": "cpp", - "format": "cpp", - "forward_list": "cpp", - "fstream": "cpp", - "functional": "cpp", - "future": "cpp", - "initializer_list": "cpp", - "iomanip": "cpp", - "ios": "cpp", - "iosfwd": "cpp", - "iostream": "cpp", - "istream": "cpp", - "iterator": "cpp", - "latch": "cpp", - "limits": "cpp", - "list": "cpp", - "locale": "cpp", - "map": "cpp", - "memory": "cpp", - "memory_resource": "cpp", - "mutex": "cpp", - "new": "cpp", - "numbers": "cpp", - "numeric": "cpp", - "optional": "cpp", - "ostream": "cpp", - "queue": "cpp", - "random": "cpp", - "ranges": "cpp", - "ratio": "cpp", - "regex": "cpp", - "set": "cpp", - "shared_mutex": "cpp", - "source_location": "cpp", - "span": "cpp", - "sstream": "cpp", - "stack": "cpp", - "stdexcept": "cpp", - "stop_token": "cpp", - "streambuf": "cpp", - "string": "cpp", - "system_error": "cpp", - "thread": "cpp", - "tuple": "cpp", - "type_traits": "cpp", - "typeindex": "cpp", - "typeinfo": "cpp", - "unordered_map": "cpp", - "unordered_set": "cpp", - "utility": "cpp", - "variant": "cpp", - "vector": "cpp", - "xfacet": "cpp", - "xhash": "cpp", - "xiosbase": "cpp", - "xlocale": "cpp", - "xlocbuf": "cpp", - "xlocinfo": "cpp", - "xlocmes": "cpp", - "xlocmon": "cpp", - "xlocnum": "cpp", - "xloctime": "cpp", - "xmemory": "cpp", - "xstddef": "cpp", - "xstring": "cpp", - "xtr1common": "cpp", - "xtree": "cpp", - "xutility": "cpp", - "pointers": "cpp" - } -} \ No newline at end of file diff --git a/src/client/command/impl/Disable.cpp b/src/client/command/impl/Disable.cpp deleted file mode 100644 index b22cda0..0000000 --- a/src/client/command/impl/Disable.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "Disable.hpp" -#include "../command_handler.hpp" -#include "../../client.hpp" - -namespace selaura::commands { - void disable(std::istringstream& iss) { - std::string module_search; - iss >> module_search; - - if (!module_search.empty()) { - auto& feature_manager = selaura::get()->get(); - feature_manager.for_each([&module_search](std::shared_ptr&f) { - std::string module_name = selaura::feature_traits::name.c_str(); - spdlog::info("Search: {}", module_name); - if (module_name == module_search) { - std::println("Disabled module {}", module_name); - f->set_enabled(false); - } - }); - } - else { - std::println("Usage: disable "); - } - } -}; \ No newline at end of file diff --git a/src/client/command/impl/Disable.hpp b/src/client/command/impl/Disable.hpp deleted file mode 100644 index 5bbd2c6..0000000 --- a/src/client/command/impl/Disable.hpp +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once -#include - -namespace selaura::commands { - void disable(std::istringstream&); -}; \ No newline at end of file diff --git a/src/client/command/impl/Enable.cpp b/src/client/command/impl/Enable.cpp deleted file mode 100644 index b350896..0000000 --- a/src/client/command/impl/Enable.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "Enable.hpp" -#include "../command_handler.hpp" -#include "../../client.hpp" - -namespace selaura::commands { - void enable(std::istringstream& iss) { - std::string module_search; - iss >> module_search; - - if (!module_search.empty()) { - auto& feature_manager = selaura::get()->get(); - feature_manager.for_each([&module_search](std::shared_ptr&f) { - std::string module_name = selaura::feature_traits::name.c_str(); - spdlog::info("Search: {}", module_name); - if (module_name == module_search) { - std::println("Enabled module {}", module_name); - f->set_enabled(true); - } - }); - } - else { - std::println("Usage: enable "); - } - } -}; \ No newline at end of file diff --git a/src/client/command/impl/Enable.hpp b/src/client/command/impl/Enable.hpp deleted file mode 100644 index f180e19..0000000 --- a/src/client/command/impl/Enable.hpp +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once -#include - -namespace selaura::commands { - void enable(std::istringstream&); -}; \ No newline at end of file From 77c57b02721c4ec5a096aa2274d61747ba11eaea Mon Sep 17 00:00:00 2001 From: jeanmajid Date: Fri, 25 Jul 2025 07:39:22 +0200 Subject: [PATCH 5/5] fix some formatting --- src/client/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/main.cpp b/src/client/main.cpp index 4769058..b44b4ac 100644 --- a/src/client/main.cpp +++ b/src/client/main.cpp @@ -27,7 +27,7 @@ BOOL APIENTRY DllMain(HMODULE hmodule, DWORD dw_reason, LPVOID lp_reserved) { if (!handle.valid()) return false; DisableThreadLibraryCalls(static_cast(handle.native_handle)); - std::thread(&init).detach(); + std::thread(&init).detach(); } return true; }