Skip to content

Commit

Permalink
ObjectExplorer: Add annotation for Flags enums
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Apr 1, 2024
1 parent 65cb249 commit 61de771
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/mods/tools/ObjectExplorer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4374,6 +4374,9 @@ void ObjectExplorer::populate_enums() {
std::vector<sdk::RETypeDefinition*> enum_types{};
auto tdb = sdk::RETypeDB::get();

const auto flags_attribute = tdb->find_type("System.FlagsAttribute");
const auto flags_attribute_runtime_type = flags_attribute != nullptr ? flags_attribute->get_runtime_type() : nullptr;

for (uint32_t i = 0; i < tdb->numTypes; ++i) {
auto t = tdb->get_type(i);
auto parent_t = t->get_parent_type();
Expand Down Expand Up @@ -4401,6 +4404,11 @@ void ObjectExplorer::populate_enums() {
}

out_file << "namespace " << nspace << " {" << std::endl;

if (flags_attribute_runtime_type != nullptr && t->has_attribute(flags_attribute_runtime_type, true)) {
out_file << " // [Flags]" << std::endl;
}

out_file << " enum " << name << " {" << std::endl;

spdlog::info("ENUM {}", t->get_full_name().c_str());
Expand Down

0 comments on commit 61de771

Please sign in to comment.