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:
Robert Xiao
2020-06-26 18:03:04 -07:00
committed by Katy
parent de6d9e2230
commit 393d26b2a3
33 changed files with 17 additions and 16 deletions

View File

@@ -9,7 +9,7 @@ using System.Linq;
using CommandLine;
using Il2CppInspector.Reflection;
using Il2CppInspector.Outputs;
using Il2CppInspector.Outputs.UnityHeaders;
using Il2CppInspector.CppUtils.UnityHeaders;
namespace Il2CppInspector.CLI
{

View File

@@ -5,7 +5,7 @@
All rights reserved.
*/
using Il2CppInspector.Outputs.UnityHeaders;
using Il2CppInspector.CppUtils.UnityHeaders;
using Il2CppInspector.Reflection;
using System;
using System.Collections.Generic;
@@ -13,7 +13,7 @@ using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace Il2CppInspector.Outputs
namespace Il2CppInspector.CppUtils
{
// Class for generating C header declarations from Reflection objects (TypeInfo, etc.)
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
* 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. */
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");
GenerateFieldList(csrc, ns, ti);
csrc.Append($"}};\n");

View File

@@ -9,7 +9,7 @@ using System;
using System.Collections.Generic;
using System.Text;
namespace Il2CppInspector.Outputs
namespace Il2CppInspector.CppUtils
{
/// <summary>
/// A utility class for managing names in a common namespace.

View File

@@ -10,7 +10,7 @@ using System.IO;
using System.Linq;
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.
public class UnityHeader
@@ -84,8 +84,8 @@ namespace Il2CppInspector.Outputs.UnityHeaders
continue;
if (v.MetadataVersion == 21) {
/* 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 binaryFieldOffsetsArePointers = (model.Package.Binary.FieldOffsets == null);
var headerFieldOffsetsArePointers = v.MinVersion.CompareTo("5.3.7") >= 0 && v.MinVersion.CompareTo("5.4.0") != 0;
var binaryFieldOffsetsArePointers = model.Package.Binary.FieldOffsets == null;
if (headerFieldOffsetsArePointers != binaryFieldOffsetsArePointers)
continue;
}

View File

@@ -8,7 +8,7 @@
using System;
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.
public class UnityVersion : IComparable<UnityVersion>, IEquatable<UnityVersion>

View File

@@ -10,11 +10,11 @@
</PropertyGroup>
<ItemGroup>
<None Remove="Outputs\UnityHeaders\**" />
<None Remove="CppUtils\UnityHeaders\**" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Outputs\UnityHeaders\**" />
<EmbeddedResource Include="CppUtils\UnityHeaders\**" />
</ItemGroup>
<ItemGroup>

View File

@@ -9,7 +9,8 @@ using System.Linq;
using System.IO;
using System.Text;
using Il2CppInspector.Reflection;
using Il2CppInspector.Outputs.UnityHeaders;
using Il2CppInspector.CppUtils;
using Il2CppInspector.CppUtils.UnityHeaders;
namespace Il2CppInspector.Outputs
{

View File

@@ -28,7 +28,7 @@ using Il2CppInspector.Outputs;
using Il2CppInspector.Reflection;
using Ookii.Dialogs.Wpf;
using Path = System.IO.Path;
using Il2CppInspector.Outputs.UnityHeaders;
using Il2CppInspector.CppUtils.UnityHeaders;
namespace Il2CppInspectorGUI
{

View File

@@ -6,7 +6,7 @@
*/
using System.IO;
using Il2CppInspector.Outputs.UnityHeaders;
using Il2CppInspector.CppUtils.UnityHeaders;
using Il2CppInspector.Reflection;
using NUnit.Framework;