Skip to content

Commit

Permalink
UObjectHook: Add UObject address lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Oct 19, 2024
1 parent 121086d commit d38c98a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/mods/UObjectHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1917,6 +1917,27 @@ void UObjectHook::draw_developer() {

ImGui::TreePop();
}

static std::array<char, 512> address_buffer{};
ImGui::InputText("Address Lookup", address_buffer.data(), address_buffer.size());

// Try-catch block around this because it's possible the user could enter invalid input
// also hex->int conversion can throw
try {
auto obj = (sdk::UObject*)std::stoull(address_buffer.data(), nullptr, 16);

if (obj != nullptr && this->exists(obj)) {
ImGui::PushID(obj);
if (ImGui::TreeNode(utility::narrow(obj->get_full_name()).c_str())) {
ui_handle_object(obj);
ImGui::TreePop();
}

ImGui::PopID();
}
} catch (...) {
// ignore
}
}

void UObjectHook::draw_main() {
Expand Down

0 comments on commit d38c98a

Please sign in to comment.