Skip to content

Commit

Permalink
SDKDumper: Add FUObjectArray::find_uobject
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Dec 25, 2023
1 parent 4f2994b commit 4c52d43
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/mods/uobjecthook/SDKDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,23 @@ void SDKDumper::initialize_uobject_array() {
);
}

// ::find_uobject
auto uobject_sdkgenny = get_or_generate_struct(uobject);
auto find_uobject = uobject_array->function("find_uobject");
find_uobject->returns(uobject_sdkgenny->ptr());
find_uobject->param("name")->type(g->type("std::wstring_view"));

find_uobject->procedure(
R"(for (int32_t i = 0; i < get_object_count(); ++i) {
const auto item = get_object(i); // FUObjectItem*
if (item == nullptr) { continue; }
const auto object = item->object; // UObject*
if (object == nullptr) { continue; }
if (object->get_full_name() == name) { return object; }
}
return nullptr;)"
);

m_sdk->include("Windows.h");
}

Expand Down

0 comments on commit 4c52d43

Please sign in to comment.