From 45d326e603f87a345143bb3905439b8be556e627 Mon Sep 17 00:00:00 2001 From: Flafy Date: Thu, 16 Sep 2021 20:48:26 +0300 Subject: [PATCH 1/2] Name types with their namespaces. Changed type names from only their names to "namespace.type_name". This is to minimize the chances of two types with the same name. Adding _1 to the type name is ugly. --- Il2CppInspector.Common/Cpp/CppDeclarationGenerator.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Il2CppInspector.Common/Cpp/CppDeclarationGenerator.cs b/Il2CppInspector.Common/Cpp/CppDeclarationGenerator.cs index 4c7808de..c821af47 100644 --- a/Il2CppInspector.Common/Cpp/CppDeclarationGenerator.cs +++ b/Il2CppInspector.Common/Cpp/CppDeclarationGenerator.cs @@ -520,7 +520,8 @@ private void InitializeNaming() { TypeNamer = TypeNamespace.MakeNamer((ti) => { if (ti.IsArray) return TypeNamer.GetName(ti.ElementType) + "__Array"; - var name = ti.Name.ToCIdentifier(); + var name = ti.Namespace + (String.IsNullOrEmpty(ti.Namespace) ? "" : ".") + ti.Name; + name = name.ToCIdentifier(); name = Regex.Replace(name, "__+", "_"); // Work around a dumb IDA bug: enums can't be named the same as certain "built-in" types // like KeyCode, Position, ErrorType. This only applies to enums, not structs. From 9a02c2d30c3b0a4cf38f58cd3cf2686977445661 Mon Sep 17 00:00:00 2001 From: Flafy Date: Thu, 16 Sep 2021 22:58:16 +0300 Subject: [PATCH 2/2] Changed app::String* to app::System_String* --- Il2CppInspector.Common/Properties/Resources.resx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Il2CppInspector.Common/Properties/Resources.resx b/Il2CppInspector.Common/Properties/Resources.resx index 9a123101..9789bf95 100644 --- a/Il2CppInspector.Common/Properties/Resources.resx +++ b/Il2CppInspector.Common/Properties/Resources.resx @@ -193,7 +193,7 @@ std::string il2cppi_to_string(Il2CppString* str) { } // Helper function to convert System.String to std::string -std::string il2cppi_to_string(app::String* str) { +std::string il2cppi_to_string(app::System_String* str) { return il2cppi_to_string(reinterpret_cast<Il2CppString*>(str)); } #endif @@ -224,7 +224,7 @@ void il2cppi_new_console(); std::string il2cppi_to_string(Il2CppString* str); // Helper function to convert System.String to std::string -std::string il2cppi_to_string(app::String* str); +std::string il2cppi_to_string(app::System_String* str); #endif // Helper function to check if a metadata usage pointer is initialized @@ -1363,4 +1363,4 @@ void Run(); </ItemGroup> </Project> - \ No newline at end of file +