diff --git a/Il2CppInspector.Common/Properties/Resources.Designer.cs b/Il2CppInspector.Common/Properties/Resources.Designer.cs index 261cc07..ffcc309 100644 --- a/Il2CppInspector.Common/Properties/Resources.Designer.cs +++ b/Il2CppInspector.Common/Properties/Resources.Designer.cs @@ -126,6 +126,8 @@ namespace Il2CppInspector.Properties { ///#include <sstream> ///#include <iomanip> /// + ///#include "il2cpp-metadata-version.h" + /// ///// Helper function to get the module base address ///uintptr_t il2cppi_get_base_address(); /// @@ -135,7 +137,7 @@ namespace Il2CppInspector.Properties { ///// Helper function to open a new console window and redirect stdout there ///void il2cppi_new_console(); /// - ///// Helper function to convert Il2CppString to st [rest of string was truncated]";. + ///// Helper [rest of string was truncated]";. /// internal static string Cpp_HelpersH { get { diff --git a/Il2CppInspector.Common/Properties/Resources.resx b/Il2CppInspector.Common/Properties/Resources.resx index 4bd51e7..dbc552f 100644 --- a/Il2CppInspector.Common/Properties/Resources.resx +++ b/Il2CppInspector.Common/Properties/Resources.resx @@ -207,6 +207,8 @@ std::string il2cppi_to_string(app::String* str) { #include <sstream> #include <iomanip> +#include "il2cpp-metadata-version.h" + // Helper function to get the module base address uintptr_t il2cppi_get_base_address(); @@ -222,6 +224,16 @@ std::string il2cppi_to_string(Il2CppString* str); // Helper function to convert System.String to std::string std::string il2cppi_to_string(app::String* str); +// Helper function to check if a metadata usage pointer is initialized +template<typename T> bool il2cppi_is_initialized(T* metadataItem) { +#if __IL2CPP_METADATA_VERISON < 270 + return *metadataItem != 0; +#else + // Metadata >=27 (Unity 2020.2) + return !((uintptr_t) *metadataItem & 1); +#endif +} + // Helper function to convert a pointer to hex template<typename T> std::string to_hex_string(T i) { std::stringstream stream;