From 61de771c8f25454cc34c24428b44da670cfa201e Mon Sep 17 00:00:00 2001 From: praydog Date: Sun, 31 Mar 2024 22:17:17 -0700 Subject: [PATCH] ObjectExplorer: Add annotation for Flags enums --- src/mods/tools/ObjectExplorer.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/mods/tools/ObjectExplorer.cpp b/src/mods/tools/ObjectExplorer.cpp index 7f76c5834..5a726fc46 100644 --- a/src/mods/tools/ObjectExplorer.cpp +++ b/src/mods/tools/ObjectExplorer.cpp @@ -4374,6 +4374,9 @@ void ObjectExplorer::populate_enums() { std::vector 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(); @@ -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());