Skip to content

Commit

Permalink
UObjectHook: Allow copying of StructProperty addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Oct 9, 2024
1 parent c0e6552 commit 378cbfd
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/mods/UObjectHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3381,7 +3381,27 @@ void UObjectHook::ui_handle_properties(void* object, sdk::UStruct* uclass) {
{
void* addr = (void*)((uintptr_t)object + ((sdk::FProperty*)prop)->get_offset());

if (ImGui::TreeNode(utility::narrow(prop->get_field_name().to_string()).data())) {
const auto made = ImGui::TreeNode(utility::narrow(prop->get_field_name().to_string()).data());

if (ImGui::BeginPopupContextItem()) {
if (ImGui::Button("Copy Address")) {
const auto hex = (std::stringstream{} << std::hex << (uintptr_t)addr).str();

if (OpenClipboard(NULL)) {
EmptyClipboard();
HGLOBAL hcd = GlobalAlloc(GMEM_DDESHARE, hex.size() + 1);
char* data = (char*)GlobalLock(hcd);
strcpy(data, hex.c_str());
GlobalUnlock(hcd);
SetClipboardData(CF_TEXT, hcd);
CloseClipboard();
}
}

ImGui::EndPopup();
}

if (made) {
auto scope2 = m_path.enter(utility::narrow(prop->get_field_name().to_string()));
ui_handle_struct(addr, ((sdk::FStructProperty*)prop)->get_struct());
ImGui::TreePop();
Expand Down

0 comments on commit 378cbfd

Please sign in to comment.