Move non-output to new CppUtils namespace
We prefer to have the Outputs directory contain just one file or namespace per output module, so we'll move all C++-related stuff to a new CppUtils namespace instead.
This commit is contained in:
@@ -9,7 +9,7 @@ using System.Linq;
|
|||||||
using CommandLine;
|
using CommandLine;
|
||||||
using Il2CppInspector.Reflection;
|
using Il2CppInspector.Reflection;
|
||||||
using Il2CppInspector.Outputs;
|
using Il2CppInspector.Outputs;
|
||||||
using Il2CppInspector.Outputs.UnityHeaders;
|
using Il2CppInspector.CppUtils.UnityHeaders;
|
||||||
|
|
||||||
namespace Il2CppInspector.CLI
|
namespace Il2CppInspector.CLI
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
All rights reserved.
|
All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using Il2CppInspector.Outputs.UnityHeaders;
|
using Il2CppInspector.CppUtils.UnityHeaders;
|
||||||
using Il2CppInspector.Reflection;
|
using Il2CppInspector.Reflection;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -13,7 +13,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Il2CppInspector.Outputs
|
namespace Il2CppInspector.CppUtils
|
||||||
{
|
{
|
||||||
// Class for generating C header declarations from Reflection objects (TypeInfo, etc.)
|
// Class for generating C header declarations from Reflection objects (TypeInfo, etc.)
|
||||||
public class CppDeclarations
|
public class CppDeclarations
|
||||||
@@ -231,7 +231,7 @@ namespace Il2CppInspector.Outputs
|
|||||||
* We have to be a little careful: the rootmost class needs to have its alignment
|
* We have to be a little careful: the rootmost class needs to have its alignment
|
||||||
* set to that of Il2CppObject, but we can't explicitly include Il2CppObject
|
* set to that of Il2CppObject, but we can't explicitly include Il2CppObject
|
||||||
* in the hierarchy because we want to customize the type of the klass parameter. */
|
* in the hierarchy because we want to customize the type of the klass parameter. */
|
||||||
var align = (model.Package.BinaryImage.Bits == 32) ? 4 : 8;
|
var align = model.Package.BinaryImage.Bits == 32 ? 4 : 8;
|
||||||
csrc.Append($"struct __declspec(align({align})) {name}__Fields {{\n");
|
csrc.Append($"struct __declspec(align({align})) {name}__Fields {{\n");
|
||||||
GenerateFieldList(csrc, ns, ti);
|
GenerateFieldList(csrc, ns, ti);
|
||||||
csrc.Append($"}};\n");
|
csrc.Append($"}};\n");
|
||||||
@@ -346,7 +346,7 @@ namespace Il2CppInspector.Outputs
|
|||||||
} else if (ti.HasElementType) {
|
} else if (ti.HasElementType) {
|
||||||
VisitType(ti.ElementType);
|
VisitType(ti.ElementType);
|
||||||
return;
|
return;
|
||||||
} else if(ti.IsEnum) {
|
} else if (ti.IsEnum) {
|
||||||
VisitFieldStructs(ti);
|
VisitFieldStructs(ti);
|
||||||
VisitType(ti.GetEnumUnderlyingType());
|
VisitType(ti.GetEnumUnderlyingType());
|
||||||
return;
|
return;
|
||||||
@@ -574,7 +574,7 @@ namespace Il2CppInspector.Outputs
|
|||||||
ns.ReserveName(keyword);
|
ns.ReserveName(keyword);
|
||||||
}
|
}
|
||||||
/* Reserve builtin keywords in IDA */
|
/* Reserve builtin keywords in IDA */
|
||||||
foreach(var keyword in new string[] { "_BYTE", "_DWORD", "_OWORD", "_QWORD", "_UNKNOWN", "_WORD", "__cdecl", "__declspec", "__export", "__far", "__fastcall", "__huge", "__import", "__int128", "__int16", "__int32", "__int64", "__int8", "__interrupt", "__near", "__pascal", "__spoils", "__stdcall", "__thiscall", "__thread", "__unaligned", "__usercall", "__userpurge", "_cs", "_ds", "_es", "_ss", "flat" }) {
|
foreach (var keyword in new string[] { "_BYTE", "_DWORD", "_OWORD", "_QWORD", "_UNKNOWN", "_WORD", "__cdecl", "__declspec", "__export", "__far", "__fastcall", "__huge", "__import", "__int128", "__int16", "__int32", "__int64", "__int8", "__interrupt", "__near", "__pascal", "__spoils", "__stdcall", "__thiscall", "__thread", "__unaligned", "__usercall", "__userpurge", "_cs", "_ds", "_es", "_ss", "flat" }) {
|
||||||
ns.ReserveName(keyword);
|
ns.ReserveName(keyword);
|
||||||
}
|
}
|
||||||
return ns;
|
return ns;
|
||||||
@@ -9,7 +9,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Il2CppInspector.Outputs
|
namespace Il2CppInspector.CppUtils
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A utility class for managing names in a common namespace.
|
/// A utility class for managing names in a common namespace.
|
||||||
@@ -10,7 +10,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Il2CppInspector.Outputs.UnityHeaders
|
namespace Il2CppInspector.CppUtils.UnityHeaders
|
||||||
{
|
{
|
||||||
// Each instance of UnityHeader represents one header file which potentially covers multiple versions of Unity.
|
// Each instance of UnityHeader represents one header file which potentially covers multiple versions of Unity.
|
||||||
public class UnityHeader
|
public class UnityHeader
|
||||||
@@ -84,8 +84,8 @@ namespace Il2CppInspector.Outputs.UnityHeaders
|
|||||||
continue;
|
continue;
|
||||||
if (v.MetadataVersion == 21) {
|
if (v.MetadataVersion == 21) {
|
||||||
/* Special version logic for metadata version 21 based on the Il2CppMetadataRegistration.fieldOffsets field */
|
/* Special version logic for metadata version 21 based on the Il2CppMetadataRegistration.fieldOffsets field */
|
||||||
var headerFieldOffsetsArePointers = (v.MinVersion.CompareTo("5.3.7") >= 0 && v.MinVersion.CompareTo("5.4.0") != 0);
|
var headerFieldOffsetsArePointers = v.MinVersion.CompareTo("5.3.7") >= 0 && v.MinVersion.CompareTo("5.4.0") != 0;
|
||||||
var binaryFieldOffsetsArePointers = (model.Package.Binary.FieldOffsets == null);
|
var binaryFieldOffsetsArePointers = model.Package.Binary.FieldOffsets == null;
|
||||||
if (headerFieldOffsetsArePointers != binaryFieldOffsetsArePointers)
|
if (headerFieldOffsetsArePointers != binaryFieldOffsetsArePointers)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Il2CppInspector.Outputs.UnityHeaders
|
namespace Il2CppInspector.CppUtils.UnityHeaders
|
||||||
{
|
{
|
||||||
// Parsed representation of a Unity version number, such as 5.3.0f1 or 2019.3.7.
|
// Parsed representation of a Unity version number, such as 5.3.0f1 or 2019.3.7.
|
||||||
public class UnityVersion : IComparable<UnityVersion>, IEquatable<UnityVersion>
|
public class UnityVersion : IComparable<UnityVersion>, IEquatable<UnityVersion>
|
||||||
@@ -10,11 +10,11 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="Outputs\UnityHeaders\**" />
|
<None Remove="CppUtils\UnityHeaders\**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Outputs\UnityHeaders\**" />
|
<EmbeddedResource Include="CppUtils\UnityHeaders\**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ using System.Linq;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Il2CppInspector.Reflection;
|
using Il2CppInspector.Reflection;
|
||||||
using Il2CppInspector.Outputs.UnityHeaders;
|
using Il2CppInspector.CppUtils;
|
||||||
|
using Il2CppInspector.CppUtils.UnityHeaders;
|
||||||
|
|
||||||
namespace Il2CppInspector.Outputs
|
namespace Il2CppInspector.Outputs
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ using Il2CppInspector.Outputs;
|
|||||||
using Il2CppInspector.Reflection;
|
using Il2CppInspector.Reflection;
|
||||||
using Ookii.Dialogs.Wpf;
|
using Ookii.Dialogs.Wpf;
|
||||||
using Path = System.IO.Path;
|
using Path = System.IO.Path;
|
||||||
using Il2CppInspector.Outputs.UnityHeaders;
|
using Il2CppInspector.CppUtils.UnityHeaders;
|
||||||
|
|
||||||
namespace Il2CppInspectorGUI
|
namespace Il2CppInspectorGUI
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Il2CppInspector.Outputs.UnityHeaders;
|
using Il2CppInspector.CppUtils.UnityHeaders;
|
||||||
using Il2CppInspector.Reflection;
|
using Il2CppInspector.Reflection;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user