From 53e45fab3103100f3f7701139dd00cd73332be0c Mon Sep 17 00:00:00 2001 From: praydog Date: Thu, 6 Jul 2023 19:33:01 -0700 Subject: [PATCH] SDK: Fix UObject/FName stuff on modular builds --- shared/sdk/FName.cpp | 2 +- shared/sdk/UClass.cpp | 8 ++++---- shared/sdk/UClass.hpp | 2 +- shared/sdk/UObjectArray.cpp | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/shared/sdk/FName.cpp b/shared/sdk/FName.cpp index a4fec3ce..fa4215d6 100644 --- a/shared/sdk/FName.cpp +++ b/shared/sdk/FName.cpp @@ -169,7 +169,7 @@ namespace detail { std::optional inlined_find_to_string() { SPDLOG_INFO("FName::get_to_string: inlined_find_to_string"); - const auto module = sdk::get_ue_module(L"Engine"); + const auto module = sdk::get_ue_module(L"AnimGraphRuntime"); if (module == nullptr) { SPDLOG_ERROR("FName::get_to_string: Failed to get module"); diff --git a/shared/sdk/UClass.cpp b/shared/sdk/UClass.cpp index ce749d82..1fcd50f3 100644 --- a/shared/sdk/UClass.cpp +++ b/shared/sdk/UClass.cpp @@ -32,10 +32,10 @@ void UStruct::update_offsets() { const auto struct_class = sdk::UStruct::static_class(); const auto class_class = sdk::UClass::static_class(); - SPDLOG_INFO("[FUObjectArray::get] UObject: 0x{:x}", (uintptr_t)object_class); - SPDLOG_INFO("[FUObjectArray::get] UField: 0x{:x}", (uintptr_t)field_class); - SPDLOG_INFO("[FUObjectArray::get] UStruct: 0x{:x}", (uintptr_t)struct_class); - SPDLOG_INFO("[FUObjectArray::get] UClass: 0x{:x}", (uintptr_t)class_class); + SPDLOG_INFO("[UStruct] UObject: 0x{:x}", (uintptr_t)object_class); + SPDLOG_INFO("[UStruct] UField: 0x{:x}", (uintptr_t)field_class); + SPDLOG_INFO("[UStruct] UStruct: 0x{:x}", (uintptr_t)struct_class); + SPDLOG_INFO("[UStruct] UClass: 0x{:x}", (uintptr_t)class_class); if (class_class != nullptr && struct_class != nullptr && field_class != nullptr) { for (auto i = sdk::UObjectBase::get_class_size(); i < 0x100; i += sizeof(void*)) try { diff --git a/shared/sdk/UClass.hpp b/shared/sdk/UClass.hpp index 465b17a1..51086a70 100644 --- a/shared/sdk/UClass.hpp +++ b/shared/sdk/UClass.hpp @@ -35,6 +35,6 @@ class UClass : public UStruct { private: static inline bool s_attempted_update_offsets{false}; - static inline uint32_t s_default_object_offset{0x40}; // not correct always, we bruteforce it later + static inline uint32_t s_default_object_offset{0x118}; // not correct always, we bruteforce it later }; } \ No newline at end of file diff --git a/shared/sdk/UObjectArray.cpp b/shared/sdk/UObjectArray.cpp index 36820290..4613ed12 100644 --- a/shared/sdk/UObjectArray.cpp +++ b/shared/sdk/UObjectArray.cpp @@ -58,14 +58,14 @@ FUObjectArray* FUObjectArray::get() { static auto result = []() -> FUObjectArray* { SPDLOG_INFO("[FUObjectArray::get] Searching for FUObjectArray..."); - const auto engine = sdk::get_ue_module(L"Engine"); + const auto core_uobject = sdk::get_ue_module(L"CoreUObject"); - if (engine == nullptr) { + if (core_uobject == nullptr) { return nullptr; } - const auto object_base_init_fn = utility::find_function_with_string_refs(engine, L"gc.MaxObjectsNotConsideredByGC", - L"/Script/Engine.GarbageCollectionSettings"); + const auto object_base_init_fn = utility::find_function_with_string_refs(core_uobject, L"gc.MaxObjectsNotConsideredByGC", + L"/Script/Engine.GarbageCollectionSettings"); if (!object_base_init_fn) { SPDLOG_ERROR("[FUObjectArray::get] Failed to find object base init function");