Skip to content

Commit

Permalink
SDK: Partial fix for GUObjectArray in UnrealEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Nov 30, 2023
1 parent 5cc7976 commit 1634fc5
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions shared/sdk/UObjectArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,29 @@ FUObjectArray* FUObjectArray::get() try {
}
}

FUObjectArray* export_result = nullptr;

// See if it's an export and just return it (we might be in the editor)
if (!object_base_init_fn.has_value()) {
if (GetProcAddress(core_uobject, "?GUObjectArray@@3VFUObjectArray@@A") != nullptr) {
export_result = (FUObjectArray*)GetProcAddress(core_uobject, "?GUObjectArray@@3VFUObjectArray@@A");
SPDLOG_INFO("[FUObjectArray::get] Found GUObjectArray export at 0x{:x}", (uintptr_t)export_result);
} else if (GetProcAddress(core_uobject, "GUObjectArray") != nullptr) {
export_result = (FUObjectArray*)GetProcAddress(core_uobject, "GUObjectArray");
SPDLOG_INFO("[FUObjectArray::get] Found GUObjectArray export at 0x{:x}", (uintptr_t)export_result);
}
}

// At this point we are just choosing a random function that at least references the GUObjectArray
// because if we had to find an export, we're probably in the editor
if (export_result != nullptr) {
const auto ref = utility::scan_displacement_reference(core_uobject, (uintptr_t)export_result);

if (ref) {
object_base_init_fn = utility::find_function_start(*ref);
}
}

if (!object_base_init_fn) {
SPDLOG_ERROR("[FUObjectArray::get] Failed to find object base init function");
return nullptr;
Expand Down

0 comments on commit 1634fc5

Please sign in to comment.