diff --git a/Il2CppInspector.CLI/Program.cs b/Il2CppInspector.CLI/Program.cs index b218c3a..75dee63 100644 --- a/Il2CppInspector.CLI/Program.cs +++ b/Il2CppInspector.CLI/Program.cs @@ -9,7 +9,7 @@ using System.Linq; using CommandLine; using Il2CppInspector.Reflection; using Il2CppInspector.Outputs; -using Il2CppInspector.CppUtils.UnityHeaders; +using Il2CppInspector.Cpp.UnityHeaders; namespace Il2CppInspector.CLI { diff --git a/Il2CppInspector.Common/CppUtils/CppDeclarationGenerator.cs b/Il2CppInspector.Common/Cpp/CppDeclarationGenerator.cs old mode 100755 new mode 100644 similarity index 97% rename from Il2CppInspector.Common/CppUtils/CppDeclarationGenerator.cs rename to Il2CppInspector.Common/Cpp/CppDeclarationGenerator.cs index bac703d..cf16361 --- a/Il2CppInspector.Common/CppUtils/CppDeclarationGenerator.cs +++ b/Il2CppInspector.Common/Cpp/CppDeclarationGenerator.cs @@ -5,15 +5,15 @@ All rights reserved. */ -using Il2CppInspector.CppUtils.UnityHeaders; -using Il2CppInspector.Reflection; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; +using Il2CppInspector.Cpp.UnityHeaders; +using Il2CppInspector.Reflection; -namespace Il2CppInspector.CppUtils +namespace Il2CppInspector.Cpp { // Class for generating C header declarations from Reflection objects (TypeInfo, etc.) public class CppDeclarationGenerator @@ -149,7 +149,7 @@ namespace Il2CppInspector.CppUtils } // Generate structure fields for each field of a given type - private void GenerateFieldList(StringBuilder csrc, Namespace ns, TypeInfo ti) { + private void GenerateFieldList(StringBuilder csrc, CppNamespace ns, TypeInfo ti) { var namer = ns.MakeNamer((field) => field.Name.ToCIdentifier()); foreach (var field in ti.DeclaredFields) { if (field.IsLiteral || field.IsStatic) @@ -222,7 +222,7 @@ namespace Il2CppInspector.CppUtils * This causes all classes to be aligned to the alignment of their base class. */ TypeInfo firstNonEmpty = null; foreach (var bti in baseClasses) { - if (bti.DeclaredFields.Where((field) => !field.IsStatic && !field.IsLiteral).Any()) { + if (bti.DeclaredFields.Any(field => !field.IsStatic && !field.IsLiteral)) { firstNonEmpty = bti; break; } @@ -577,8 +577,8 @@ namespace Il2CppInspector.CppUtils } // Reserve C/C++ keywords and built-in names - private static Namespace CreateNamespace() { - var ns = new Namespace(); + private static CppNamespace CreateNamespace() { + var ns = new CppNamespace(); /* Reserve C/C++ keywords */ foreach (var keyword in new string[] { "_Alignas", "_Alignof", "_Atomic", "_Bool", "_Complex", "_Generic", "_Imaginary", "_Noreturn", "_Static_assert", "_Thread_local", "alignas", "alignof", "and", "and_eq", "asm", "auto", "bitand", "bitor", "bool", "break", "case", "catch", "char", "char16_t", "char32_t", "char8_t", "class", "co_await", "co_return", "co_yield", "compl", "concept", "const", "const_cast", "consteval", "constexpr", "constinit", "continue", "decltype", "default", "delete", "do", "double", "dynamic_cast", "else", "enum", "explicit", "export", "extern", "false", "float", "for", "friend", "goto", "if", "inline", "int", "long", "mutable", "namespace", "new", "noexcept", "not", "not_eq", "nullptr", "operator", "or", "or_eq", "private", "protected", "public", "reflexpr", "register", "reinterpret_cast", "requires", "restrict", "return", "short", "signed", "sizeof", "static", "static_assert", "static_cast", "struct", "switch", "synchronized", "template", "this", "thread_local", "throw", "true", "try", "typedef", "typeid", "typename", "union", "unsigned", "using", "virtual", "void", "volatile", "wchar_t", "while", "xor", "xor_eq" }) { ns.ReserveName(keyword); @@ -593,16 +593,16 @@ namespace Il2CppInspector.CppUtils /// /// Namespace for all types and typedefs /// - public Namespace TypeNamespace { get; private set; } + public CppNamespace TypeNamespace { get; private set; } - public Namespace.Namer TypeNamer { get; private set; } + public CppNamespace.Namer TypeNamer { get; private set; } /// /// Namespace for global variables, enum values and methods /// - public Namespace GlobalsNamespace { get; private set; } - public Namespace.Namer GlobalNamer { get; private set; } - public Namespace.Namer EnumNamer { get; private set; } + public CppNamespace GlobalsNamespace { get; private set; } + public CppNamespace.Namer GlobalNamer { get; private set; } + public CppNamespace.Namer EnumNamer { get; private set; } #endregion } } diff --git a/Il2CppInspector.Common/CppUtils/Namespace.cs b/Il2CppInspector.Common/Cpp/CppNamespace.cs similarity index 95% rename from Il2CppInspector.Common/CppUtils/Namespace.cs rename to Il2CppInspector.Common/Cpp/CppNamespace.cs index 0c363fd..436cb92 100644 --- a/Il2CppInspector.Common/CppUtils/Namespace.cs +++ b/Il2CppInspector.Common/Cpp/CppNamespace.cs @@ -9,12 +9,12 @@ using System; using System.Collections.Generic; using System.Text; -namespace Il2CppInspector.CppUtils +namespace Il2CppInspector.Cpp { /// /// A utility class for managing names in a common namespace. /// - public class Namespace + public class CppNamespace { // The central data structure that keeps track of which names have been generated // The value for any given key K is the number of unique objects originally named K, minus 1. @@ -43,7 +43,7 @@ namespace Il2CppInspector.CppUtils public class Namer { // Parent namespace - private Namespace ns; + private CppNamespace ns; // Names given out by this Namer. private readonly Dictionary names = new Dictionary(); @@ -53,7 +53,7 @@ namespace Il2CppInspector.CppUtils public delegate string KeyFunc(T t); private readonly KeyFunc keyFunc; - public Namer(Namespace ns, KeyFunc keyFunc) { + public Namer(CppNamespace ns, KeyFunc keyFunc) { this.ns = ns; this.keyFunc = keyFunc; } diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/16-5.3.0-5.3.1.h b/Il2CppInspector.Common/Cpp/UnityHeaders/16-5.3.0-5.3.1.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/16-5.3.0-5.3.1.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/16-5.3.0-5.3.1.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/19-5.3.2.h b/Il2CppInspector.Common/Cpp/UnityHeaders/19-5.3.2.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/19-5.3.2.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/19-5.3.2.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/20-5.3.3-5.3.4.h b/Il2CppInspector.Common/Cpp/UnityHeaders/20-5.3.3-5.3.4.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/20-5.3.3-5.3.4.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/20-5.3.3-5.3.4.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/21-5.3.5.h b/Il2CppInspector.Common/Cpp/UnityHeaders/21-5.3.5.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/21-5.3.5.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/21-5.3.5.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/21-5.3.6.h b/Il2CppInspector.Common/Cpp/UnityHeaders/21-5.3.6.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/21-5.3.6.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/21-5.3.6.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/21-5.3.7-5.3.8.h b/Il2CppInspector.Common/Cpp/UnityHeaders/21-5.3.7-5.3.8.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/21-5.3.7-5.3.8.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/21-5.3.7-5.3.8.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/21-5.4.0.h b/Il2CppInspector.Common/Cpp/UnityHeaders/21-5.4.0.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/21-5.4.0.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/21-5.4.0.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/21-5.4.1-5.4.3.h b/Il2CppInspector.Common/Cpp/UnityHeaders/21-5.4.1-5.4.3.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/21-5.4.1-5.4.3.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/21-5.4.1-5.4.3.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/21-5.4.4-5.4.6.h b/Il2CppInspector.Common/Cpp/UnityHeaders/21-5.4.4-5.4.6.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/21-5.4.4-5.4.6.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/21-5.4.4-5.4.6.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/22-5.5.0.h b/Il2CppInspector.Common/Cpp/UnityHeaders/22-5.5.0.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/22-5.5.0.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/22-5.5.0.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/22-5.5.1-5.5.2.h b/Il2CppInspector.Common/Cpp/UnityHeaders/22-5.5.1-5.5.2.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/22-5.5.1-5.5.2.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/22-5.5.1-5.5.2.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/22-5.5.3-5.5.6.h b/Il2CppInspector.Common/Cpp/UnityHeaders/22-5.5.3-5.5.6.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/22-5.5.3-5.5.6.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/22-5.5.3-5.5.6.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/23-5.6.0-5.6.7.h b/Il2CppInspector.Common/Cpp/UnityHeaders/23-5.6.0-5.6.7.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/23-5.6.0-5.6.7.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/23-5.6.0-5.6.7.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/24-2017.1.0-2017.1.2.h b/Il2CppInspector.Common/Cpp/UnityHeaders/24-2017.1.0-2017.1.2.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/24-2017.1.0-2017.1.2.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/24-2017.1.0-2017.1.2.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/24-2017.1.3-2017.1.5.h b/Il2CppInspector.Common/Cpp/UnityHeaders/24-2017.1.3-2017.1.5.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/24-2017.1.3-2017.1.5.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/24-2017.1.3-2017.1.5.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/24-2017.2.0.h b/Il2CppInspector.Common/Cpp/UnityHeaders/24-2017.2.0.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/24-2017.2.0.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/24-2017.2.0.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/24-2017.2.1-2017.4.38.h b/Il2CppInspector.Common/Cpp/UnityHeaders/24-2017.2.1-2017.4.38.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/24-2017.2.1-2017.4.38.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/24-2017.2.1-2017.4.38.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/24-2018.1.0-2018.1.9.h b/Il2CppInspector.Common/Cpp/UnityHeaders/24-2018.1.0-2018.1.9.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/24-2018.1.0-2018.1.9.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/24-2018.1.0-2018.1.9.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/24-2018.2.0-2018.2.21.h b/Il2CppInspector.Common/Cpp/UnityHeaders/24-2018.2.0-2018.2.21.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/24-2018.2.0-2018.2.21.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/24-2018.2.0-2018.2.21.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/24.1-2018.3.0-2018.3.7.h b/Il2CppInspector.Common/Cpp/UnityHeaders/24.1-2018.3.0-2018.3.7.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/24.1-2018.3.0-2018.3.7.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/24.1-2018.3.0-2018.3.7.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/24.1-2018.3.8-2018.4.20.h b/Il2CppInspector.Common/Cpp/UnityHeaders/24.1-2018.3.8-2018.4.20.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/24.1-2018.3.8-2018.4.20.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/24.1-2018.3.8-2018.4.20.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/24.2-2019.1.0-2019.2.21.h b/Il2CppInspector.Common/Cpp/UnityHeaders/24.2-2019.1.0-2019.2.21.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/24.2-2019.1.0-2019.2.21.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/24.2-2019.1.0-2019.2.21.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/24.2-2019.3.0-2019.3.6.h b/Il2CppInspector.Common/Cpp/UnityHeaders/24.2-2019.3.0-2019.3.6.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/24.2-2019.3.0-2019.3.6.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/24.2-2019.3.0-2019.3.6.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/24.3-2019.3.7-.h b/Il2CppInspector.Common/Cpp/UnityHeaders/24.3-2019.3.7-.h similarity index 100% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/24.3-2019.3.7-.h rename to Il2CppInspector.Common/Cpp/UnityHeaders/24.3-2019.3.7-.h diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/UnityHeader.cs b/Il2CppInspector.Common/Cpp/UnityHeaders/UnityHeader.cs similarity index 98% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/UnityHeader.cs rename to Il2CppInspector.Common/Cpp/UnityHeaders/UnityHeader.cs index ea4c2cd..58da0c4 100644 --- a/Il2CppInspector.Common/CppUtils/UnityHeaders/UnityHeader.cs +++ b/Il2CppInspector.Common/Cpp/UnityHeaders/UnityHeader.cs @@ -10,7 +10,7 @@ using System.IO; using System.Linq; using System.Collections.Generic; -namespace Il2CppInspector.CppUtils.UnityHeaders +namespace Il2CppInspector.Cpp.UnityHeaders { // Each instance of UnityHeader represents one header file which potentially covers multiple versions of Unity. public class UnityHeader diff --git a/Il2CppInspector.Common/CppUtils/UnityHeaders/UnityVersion.cs b/Il2CppInspector.Common/Cpp/UnityHeaders/UnityVersion.cs similarity index 98% rename from Il2CppInspector.Common/CppUtils/UnityHeaders/UnityVersion.cs rename to Il2CppInspector.Common/Cpp/UnityHeaders/UnityVersion.cs index ce52732..19ca8f3 100644 --- a/Il2CppInspector.Common/CppUtils/UnityHeaders/UnityVersion.cs +++ b/Il2CppInspector.Common/Cpp/UnityHeaders/UnityVersion.cs @@ -8,7 +8,7 @@ using System; using System.Text.RegularExpressions; -namespace Il2CppInspector.CppUtils.UnityHeaders +namespace Il2CppInspector.Cpp.UnityHeaders { // Parsed representation of a Unity version number, such as 5.3.0f1 or 2019.3.7. public class UnityVersion : IComparable, IEquatable diff --git a/Il2CppInspector.Common/Il2CppInspector.csproj b/Il2CppInspector.Common/Il2CppInspector.csproj index c838280..ddaa472 100644 --- a/Il2CppInspector.Common/Il2CppInspector.csproj +++ b/Il2CppInspector.Common/Il2CppInspector.csproj @@ -10,11 +10,11 @@ - + - + diff --git a/Il2CppInspector.Common/Outputs/IDAPythonScript.cs b/Il2CppInspector.Common/Outputs/IDAPythonScript.cs index 074f0a9..bd8e011 100755 --- a/Il2CppInspector.Common/Outputs/IDAPythonScript.cs +++ b/Il2CppInspector.Common/Outputs/IDAPythonScript.cs @@ -9,8 +9,8 @@ using System.Linq; using System.IO; using System.Text; using Il2CppInspector.Reflection; -using Il2CppInspector.CppUtils; -using Il2CppInspector.CppUtils.UnityHeaders; +using Il2CppInspector.Cpp; +using Il2CppInspector.Cpp.UnityHeaders; namespace Il2CppInspector.Outputs { @@ -113,7 +113,7 @@ typedef __int64 int64_t; declGenerator.IncludeMethod(method); writeDecls(declGenerator.GenerateRemainingTypeDeclarations()); var address = method.VirtualAddress.Value.Start; - writeTypedName(address, declGenerator.GenerateMethodDeclaration(method), declGenerator.MethodNamer.GetName(method)); + writeTypedName(address, declGenerator.GenerateMethodDeclaration(method), declGenerator.GlobalNamer.GetName(method)); writeComment(address, method); } } @@ -171,7 +171,7 @@ typedef __int64 int64_t; declGenerator.IncludeMethod(method); writeDecls(declGenerator.GenerateRemainingTypeDeclarations()); - name = declGenerator.MethodNamer.GetName(method); + name = declGenerator.GlobalNamer.GetName(method); writeTypedName(address, "struct MethodInfo *", $"{name}__MethodInfo"); writeComment(address, method); break; diff --git a/Il2CppInspector.GUI/MainWindow.xaml.cs b/Il2CppInspector.GUI/MainWindow.xaml.cs index d245749..27e4a54 100644 --- a/Il2CppInspector.GUI/MainWindow.xaml.cs +++ b/Il2CppInspector.GUI/MainWindow.xaml.cs @@ -28,7 +28,7 @@ using Il2CppInspector.Outputs; using Il2CppInspector.Reflection; using Ookii.Dialogs.Wpf; using Path = System.IO.Path; -using Il2CppInspector.CppUtils.UnityHeaders; +using Il2CppInspector.Cpp.UnityHeaders; namespace Il2CppInspectorGUI { diff --git a/Il2CppTests/TestIDAOutput.cs b/Il2CppTests/TestIDAOutput.cs index a91dabf..61239fc 100644 --- a/Il2CppTests/TestIDAOutput.cs +++ b/Il2CppTests/TestIDAOutput.cs @@ -6,7 +6,7 @@ */ using System.IO; -using Il2CppInspector.CppUtils.UnityHeaders; +using Il2CppInspector.Cpp.UnityHeaders; using Il2CppInspector.Reflection; using NUnit.Framework;