Skip to content

Commit

Permalink
SDK: Fix AddObject scan on modular/debug builds
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Oct 21, 2023
1 parent ded64f6 commit 7f2184f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion shared/sdk/UObjectBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,21 @@ void UObjectBase::update_offsets_post_uobjectarray() {

// Locate the first call after the reference
const auto post_instruction = ref + 4;
const auto callsite = utility::scan_mnemonic(post_instruction, 100, "CALL");
auto callsite = utility::scan_mnemonic(post_instruction, 100, "CALL");

if (!callsite) {
SPDLOG_ERROR("[UObjectBase] Failed to find AddObject, unable to find callsite");
return;
}

const auto potential_add_object = utility::calculate_absolute(*callsite + 1);

// Happens on debug/modular builds, it's some function that checks validity
if (utility::find_string_reference_in_path(potential_add_object, "ClassPrivate", false) || utility::find_string_reference_in_path(potential_add_object, L"ClassPrivate", false)) {
SPDLOG_INFO("[UObjectBase] Skipping first callsite because it references ClassPrivate");
callsite = utility::scan_mnemonic(*callsite + utility::decode_one((uint8_t*)*callsite)->Length, 100, "CALL");
}

SPDLOG_INFO("[UObjectBase] Callsite: 0x{:x}", *callsite);

s_add_object = utility::calculate_absolute(*callsite + 1);
Expand Down

0 comments on commit 7f2184f

Please sign in to comment.