Skip to content

Commit

Permalink
src: updated offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
Surasia committed Dec 29, 2024
1 parent 096c1c2 commit 60c5d68
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 57 deletions.
4 changes: 1 addition & 3 deletions InfExt/InfExt.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
<ClInclude Include="src\ImGuiHook\stdafx.h" />
<ClInclude Include="src\Logger\Logger.hpp" />
<ClInclude Include="src\Memory.hpp" />
<ClInclude Include="src\Misc\ChromaSDK.hpp" />
<ClInclude Include="src\TagLoader\TagLoader.hpp" />
<ClInclude Include="src\TagLoader\Types\Generated\Cmsw.hpp" />
<ClInclude Include="src\TagLoader\Types\InfiniteStructs.hpp" />
Expand All @@ -106,7 +105,6 @@
<ClCompile Include="src\HavokScript\HavokScript.cpp" />
<ClCompile Include="src\Logger\Logger.cpp" />
<ClCompile Include="src\Memory.cpp" />
<ClCompile Include="src\Misc\ChromaSDK.cpp" />
<ClCompile Include="src\TagLoader\TagLoader.cpp" />
<ClCompile Include="src\UniversalHook\Hooks\DX12Hook.cpp" />
<ClCompile Include="src\UniversalHook\Hooks\Hooks.cpp" />
Expand All @@ -120,4 +118,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
3 changes: 1 addition & 2 deletions InfExt/src/Client.cpp
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -80,7 +79,6 @@ static DWORD SetupHook()
return 1;
}

ChromaSDK::HookChroma(ModuleBase);
Hks::HookHavokScript(ModuleBase);
return 0;
}
Expand All @@ -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!");
Expand Down
30 changes: 27 additions & 3 deletions InfExt/src/HavokScript/HavokScript.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "HavokScript.hpp"
#include "../Memory.hpp"
#include <stdio.h>
#include "../Logger/Logger.hpp"
#include "../UniversalHook/Menu/Toggles.hpp"

int Hks::GetGlobalHook(uintptr_t state, char *string)
{
Expand Down Expand Up @@ -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<GetGlobal>(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<PCall>(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<LoadBuffer>(ModuleBase, LoadBufferOffset, &LoadBufferHook, &LoadBufferA);
const uintptr_t LuaPrintOffset = 0x54BF60;
LuaPrintH = hook_function<LuaPrint>(ModuleBase, LuaPrintOffset, &LuaPrintHook, &LuaPrintA);
}
4 changes: 4 additions & 0 deletions InfExt/src/HavokScript/HavokScript.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
15 changes: 0 additions & 15 deletions InfExt/src/Misc/ChromaSDK.cpp

This file was deleted.

28 changes: 0 additions & 28 deletions InfExt/src/Misc/ChromaSDK.hpp

This file was deleted.

8 changes: 4 additions & 4 deletions InfExt/src/Patches/Patches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool *>(GetModuleBase() + offset);
logger.Log(Logger::INFO, "Hide Forge Category set to: {}", *boolPtr ? "true" : "false");
*boolPtr = !(*boolPtr);
Expand All @@ -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<bool *>(GetModuleBase() + offset);
logger.Log(Logger::INFO, "HUD set to: {}", *boolPtr ? "true" : "false");
*boolPtr = !(*boolPtr);
Expand All @@ -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<bool *>(GetModuleBase() + offset);
logger.Log(Logger::INFO, "Watermark set to: {}", *boolPtr ? "true" : "false");
*boolPtr = !(*boolPtr);
Expand All @@ -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<bool *>(GetModuleBase() + offset);
logger.Log(Logger::INFO, "Kill Volume set to: {}", *boolPtr ? "true" : "false");
*boolPtr = !(*boolPtr);
Expand Down
4 changes: 2 additions & 2 deletions InfExt/src/TagLoader/TagLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<void *>(ModuleBase + tagAddressOffset), sizeof(baseAddress));
Expand Down Expand Up @@ -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);
}
5 changes: 5 additions & 0 deletions InfExt/src/UniversalHook/Menu/Toggles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,10 @@ void RenderToggles()
Patches::ToggleKillVolumes();
}

if (ImGui::Checkbox("Enable Prints", &printsEnabled))
{
printsEnabled = !printsEnabled;
}

ImGui::EndChild();
}
1 change: 1 addition & 0 deletions InfExt/src/UniversalHook/Menu/Toggles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 60c5d68

Please sign in to comment.