Skip to content

Commit

Permalink
SDK: Fix UObject/FName stuff on modular builds
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Jul 7, 2023
1 parent d79b481 commit 53e45fa
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion shared/sdk/FName.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ namespace detail {
std::optional<FName::ToStringFn> 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");
Expand Down
8 changes: 4 additions & 4 deletions shared/sdk/UClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion shared/sdk/UClass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}
8 changes: 4 additions & 4 deletions shared/sdk/UObjectArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 53e45fa

Please sign in to comment.