diff --git a/src/main.cpp b/src/main.cpp index bbceb27..cf91a13 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,39 +1,3 @@ -namespace stl -{ - namespace detail - { - struct asm_patch : - Xbyak::CodeGenerator - { - asm_patch(std::uintptr_t a_dst) - { - Xbyak::Label dst; - - jmp(ptr[rip + dst]); - - L(dst); - dq(a_dst); - } - }; - - static void asm_jump(std::uintptr_t a_from, [[maybe_unused]] std::size_t a_size, std::uintptr_t a_to) - { - asm_patch p{ a_to }; - p.ready(); - assert(p.getSize() <= a_size); - REL::safe_write( - a_from, - std::span{ p.getCode(), p.getSize() }); - } - } - - static void asm_replace(std::uintptr_t a_from, std::size_t a_size, std::uintptr_t a_to) - { - REL::safe_fill(a_from, REL::INT3, a_size); - detail::asm_jump(a_from, a_size, a_to); - } -} - namespace Config { namespace General @@ -55,8 +19,8 @@ class ScrapHeap public: static void Install() { - static REL::Relocation target{ REL::ID(2228361) }; - stl::asm_replace(target.address(), 0x10, reinterpret_cast(QMaxMemory)); + static REL::Relocation target{ REL::ID(2228361) }; + target.write_func(0x10, QMaxMemory); auto iScrapHeapMult = Config::General::iScrapHeapMult.GetValue(); switch (iScrapHeapMult)