diff --git a/InfExt/InfExt.vcxproj b/InfExt/InfExt.vcxproj index 8a9b411..dbfb7fa 100644 --- a/InfExt/InfExt.vcxproj +++ b/InfExt/InfExt.vcxproj @@ -86,7 +86,6 @@ - @@ -106,7 +105,6 @@ - @@ -120,4 +118,4 @@ - \ No newline at end of file + diff --git a/InfExt/src/Client.cpp b/InfExt/src/Client.cpp index 15466ad..dab24dd 100644 --- a/InfExt/src/Client.cpp +++ b/InfExt/src/Client.cpp @@ -1,7 +1,6 @@ #include "Client.hpp" #include "./HavokScript/HavokScript.hpp" #include "./Logger/Logger.hpp" -#include "./Misc/ChromaSDK.hpp" #include "./UniversalHook/hooks/hooks.hpp" #include "Exports.hpp" #include "Globals.hpp" @@ -80,7 +79,6 @@ static DWORD SetupHook() return 1; } - ChromaSDK::HookChroma(ModuleBase); Hks::HookHavokScript(ModuleBase); return 0; } @@ -89,6 +87,7 @@ static DWORD WINAPI MainThread(LPVOID lpParameter) { Logger &logger = Logger::GetInstance(false); CreateConsole(); + Sleep(10000); SetupHook(); Hooks::Init(); logger.Log(Logger::INFO, "ImGui Initialized!"); diff --git a/InfExt/src/HavokScript/HavokScript.cpp b/InfExt/src/HavokScript/HavokScript.cpp index a9353af..f42089f 100644 --- a/InfExt/src/HavokScript/HavokScript.cpp +++ b/InfExt/src/HavokScript/HavokScript.cpp @@ -1,5 +1,8 @@ #include "HavokScript.hpp" #include "../Memory.hpp" +#include +#include "../Logger/Logger.hpp" +#include "../UniversalHook/Menu/Toggles.hpp" int Hks::GetGlobalHook(uintptr_t state, char *string) { @@ -37,15 +40,36 @@ uint64_t Hks::DoString(const char *string) return call_result; } +int Hks::LuaPrintHook(char *Buffer, size_t BufferCount, char *Format, va_list ArgList) +{ + + int result; // eax + + result = __stdio_common_vsnprintf_s(0x24, Buffer, BufferCount, BufferCount - 1, Format, 0LL, ArgList); + Logger &logger = Logger::GetInstance(false); + if (printsEnabled) + { + logger.Log(Logger::INFO, "{}", Buffer); + } + logger.Log(Logger::INFO, "{}", Buffer); + Buffer[BufferCount - 1] = 0; + if (result < 0) + return -1; + return result; +} + + void Hks::HookHavokScript(uintptr_t ModuleBase) { // Search for "_OBJECT_META", follow the ref, and find this function directly below. - const uintptr_t GetGlobalOffset = 0x786B7C; + const uintptr_t GetGlobalOffset = 0x78A57C; GetGlobalH = hook_function(ModuleBase, GetGlobalOffset, &GetGlobalHook, &GetGlobalA); // Search for "GetDescription",and you'll find it below in the second if block. - const uintptr_t PCallOffset = 0x6567B8; + const uintptr_t PCallOffset = 0x6C939C; PCallH = hook_function(ModuleBase, PCallOffset, &PCallHook, &PCallA); // Search for "loadstring", follow the second ref, and check the function inside the if block. - const uintptr_t LoadBufferOffset = 0xA2BDD0; + const uintptr_t LoadBufferOffset = 0xA4AEE0; LoadBufferH = hook_function(ModuleBase, LoadBufferOffset, &LoadBufferHook, &LoadBufferA); + const uintptr_t LuaPrintOffset = 0x54BF60; + LuaPrintH = hook_function(ModuleBase, LuaPrintOffset, &LuaPrintHook, &LuaPrintA); } diff --git a/InfExt/src/HavokScript/HavokScript.hpp b/InfExt/src/HavokScript/HavokScript.hpp index fae5b5f..383ad56 100644 --- a/InfExt/src/HavokScript/HavokScript.hpp +++ b/InfExt/src/HavokScript/HavokScript.hpp @@ -40,10 +40,14 @@ struct Hks using LoadBuffer = uint64_t(__fastcall *)(uintptr_t state, const struct Hks::CompilerSettings *settings, const char *buffer, uint64_t length, const char *unknown1); static inline LoadBuffer LoadBufferH = nullptr; static inline LoadBuffer LoadBufferA = nullptr; + using LuaPrint = int(__fastcall *)(char *Buffer, size_t BufferCount, char *Format, va_list ArgList); + static inline LuaPrint LuaPrintH = nullptr; + static inline LuaPrint LuaPrintA = nullptr; /* Private Functions */ static int GetGlobalHook(uintptr_t state, char *string); static uint64_t PCallHook(uintptr_t state, int function, uint32_t i, int u); static uint64_t LoadBufferHook(uintptr_t state, const struct Hks::CompilerSettings *settings, const char *buffer, __int64 length, const char *unknown1); + static int LuaPrintHook(char *Buffer, size_t BufferCount, char *Format, va_list ArgList); /* Private Variables */ static inline uintptr_t LuaState = 0; }; diff --git a/InfExt/src/Misc/ChromaSDK.cpp b/InfExt/src/Misc/ChromaSDK.cpp deleted file mode 100644 index 65a6c9e..0000000 --- a/InfExt/src/Misc/ChromaSDK.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "ChromaSDK.hpp" -#include "../Memory.hpp" -#include - -/* Nulls out the print message for "ChromaSDK failed to load!" which can cause issues with stdin. */ -int64_t ChromaSDK::NullChromaSDKHook(char *Format) -{ - return 0; -} - -void ChromaSDK::HookChroma(uintptr_t ModuleBase) -{ - uintptr_t address = 0xD869C4; - NullChromaSDKH = hook_function(ModuleBase, address, &NullChromaSDKHook, &NullChromaSDKA); -} \ No newline at end of file diff --git a/InfExt/src/Misc/ChromaSDK.hpp b/InfExt/src/Misc/ChromaSDK.hpp deleted file mode 100644 index 97c8e9b..0000000 --- a/InfExt/src/Misc/ChromaSDK.hpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef CHROMASDK_HPP -#define CHROMASDK_HPP -#include - -struct ChromaSDK -{ -public: - /* Operators */ - ChromaSDK() = default; - ChromaSDK(const ChromaSDK &) = default; - ChromaSDK(ChromaSDK &&) = delete; - ChromaSDK &operator=(const ChromaSDK &) = default; - ChromaSDK &operator=(ChromaSDK &&) = delete; - ~ChromaSDK() = default; - /* Hook */ - static void HookChroma(uintptr_t ModuleBase); - -private: - /* Function Type Definitions */ - using NullChromaSDK = int64_t(__fastcall *)(char *Format); - static inline NullChromaSDK NullChromaSDKH = nullptr; - static inline NullChromaSDK NullChromaSDKA = nullptr; - - /* Private Functions */ - static int64_t NullChromaSDKHook(char *Format); -}; - -#endif diff --git a/InfExt/src/Patches/Patches.cpp b/InfExt/src/Patches/Patches.cpp index 7ffbbae..c8493d7 100644 --- a/InfExt/src/Patches/Patches.cpp +++ b/InfExt/src/Patches/Patches.cpp @@ -6,7 +6,7 @@ void Patches::ToggleForgeHiddenCategories() { Logger &logger = Logger::GetInstance(false); - constexpr uintptr_t offset = 0x50E1840; + constexpr uintptr_t offset = 0x50E4940; bool *boolPtr = reinterpret_cast(GetModuleBase() + offset); logger.Log(Logger::INFO, "Hide Forge Category set to: {}", *boolPtr ? "true" : "false"); *boolPtr = !(*boolPtr); @@ -16,7 +16,7 @@ void Patches::ToggleForgeHiddenCategories() void Patches::ToggleHUD() { Logger &logger = Logger::GetInstance(false); - constexpr uintptr_t offset = 0x484B060; + constexpr uintptr_t offset = 0x484E160; bool *boolPtr = reinterpret_cast(GetModuleBase() + offset); logger.Log(Logger::INFO, "HUD set to: {}", *boolPtr ? "true" : "false"); *boolPtr = !(*boolPtr); @@ -26,7 +26,7 @@ void Patches::ToggleHUD() void Patches::ToggleWatermark() { Logger &logger = Logger::GetInstance(false); - constexpr uintptr_t offset = 0x48BB520; + constexpr uintptr_t offset = 0x48BE620; bool *boolPtr = reinterpret_cast(GetModuleBase() + offset); logger.Log(Logger::INFO, "Watermark set to: {}", *boolPtr ? "true" : "false"); *boolPtr = !(*boolPtr); @@ -36,7 +36,7 @@ void Patches::ToggleWatermark() void Patches::ToggleKillVolumes() { Logger &logger = Logger::GetInstance(false); - constexpr uintptr_t offset = 0x4EF3434; + constexpr uintptr_t offset = 0x4EF6534; bool *boolPtr = reinterpret_cast(GetModuleBase() + offset); logger.Log(Logger::INFO, "Kill Volume set to: {}", *boolPtr ? "true" : "false"); *boolPtr = !(*boolPtr); diff --git a/InfExt/src/TagLoader/TagLoader.cpp b/InfExt/src/TagLoader/TagLoader.cpp index fa1cc12..7b34e89 100644 --- a/InfExt/src/TagLoader/TagLoader.cpp +++ b/InfExt/src/TagLoader/TagLoader.cpp @@ -24,7 +24,7 @@ void TagLoader::PrintTagInfo() void TagLoader::TagAddressPrinter(uintptr_t ModuleBase) { - constexpr uintptr_t tagAddressOffset = 0x48BE488; + constexpr uintptr_t tagAddressOffset = 0x48C1598; while (baseAddress.load() == 0) { std::memcpy(&baseAddress, reinterpret_cast(ModuleBase + tagAddressOffset), sizeof(baseAddress)); @@ -87,7 +87,7 @@ void TagLoader::ReadTags(uintptr_t ModuleBase) Logger &logger = Logger::GetInstance(false); // basically in IDA search for "tag instances" and then you'll see a function called with "tag instances" as a parameter for it. // the return value (v0) is the address you want. - constexpr uintptr_t tagInstanceOffset = 0x48BE488; + constexpr uintptr_t tagInstanceOffset = 0x48C1598; logger.Log(Logger::INFO, "Tag Instances Address: {:x}", ModuleBase + tagInstanceOffset); TagAddressPrinter(ModuleBase); } diff --git a/InfExt/src/UniversalHook/Menu/Toggles.cpp b/InfExt/src/UniversalHook/Menu/Toggles.cpp index a44baa7..4d6bad8 100644 --- a/InfExt/src/UniversalHook/Menu/Toggles.cpp +++ b/InfExt/src/UniversalHook/Menu/Toggles.cpp @@ -26,5 +26,10 @@ void RenderToggles() Patches::ToggleKillVolumes(); } + if (ImGui::Checkbox("Enable Prints", &printsEnabled)) + { + printsEnabled = !printsEnabled; + } + ImGui::EndChild(); } diff --git a/InfExt/src/UniversalHook/Menu/Toggles.hpp b/InfExt/src/UniversalHook/Menu/Toggles.hpp index 59cba62..b34e6d3 100644 --- a/InfExt/src/UniversalHook/Menu/Toggles.hpp +++ b/InfExt/src/UniversalHook/Menu/Toggles.hpp @@ -7,5 +7,6 @@ inline static bool forgeHiddenCategory = false; inline static bool watermarkEnabled = false; inline static bool hudEnabled = false; inline static bool killVolumesEnabled = false; +inline static bool printsEnabled = false; #endif