libER 0.1.4.2
ELDEN RING API library
Loading...
Searching...
No Matches
Reflection Examples

Print all the types with type reflection in ELDEN RING:

// Print DLRuntimeClass instances, their methods and invokers
#include "../example_base.hpp"
// For type reflection:
// For wait_for_system:
// Will be called from DllMain
void example_base() {
// Allocate console
con_allocate(false);
// It's necessary to wait for the type reflection system to be initialized.
// We can use wait_for_system with a timeout of 5000ms to ensure ELDEN RING
// has initialized it
if (!from::DLSY::wait_for_system(5'000)) {
std::cout << "wait_for_system timed out!\n";
return;
}
// Get a vector of all DLRuntimeClasses that have been
// registered so far by ELDEN RING
auto registered_classes =
if (!registered_classes) {
std::cout << "registered_classes is null!\n";
return;
}
for (const auto& class_holder : *registered_classes) {
// Print out the DLRuntimeClass address and name
std::cout << class_holder.instance << ' '
<< class_holder.name;
const auto& methods = class_holder.instance->get_methods();
if (methods.empty()) {
std::cout << '\n';
continue;
}
// Print out the DLRuntimeClass methods, if present
std::cout << " and its methods:\n";
for (const auto& method : methods) {
std::cout << " " << method.name;
const auto& invokers = method.instance->get_invokers();
if (invokers.empty())
continue;
std::cout << " and its invokers: ";
// Print out the DLRuntimeClass method invokers, if present
for (const auto& invoker : invokers) {
std::cout << &invoker << " ";
}
std::cout << '\n';
}
}
}
static const from::vector< DLRuntimeClassHolder > * get_registered_classes() noexcept
Get a vector of all globally registered DLRuntimeClasses.
Definition reflection.hpp:156
Dantelion2 type reflection.
Dantelion2 system properties.