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:
@@ -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");
|
||||
@@ -346,7 +346,7 @@ namespace Il2CppInspector.Outputs
|
||||
} else if (ti.HasElementType) {
|
||||
VisitType(ti.ElementType);
|
||||
return;
|
||||
} else if(ti.IsEnum) {
|
||||
} else if (ti.IsEnum) {
|
||||
VisitFieldStructs(ti);
|
||||
VisitType(ti.GetEnumUnderlyingType());
|
||||
return;
|
||||
@@ -574,7 +574,7 @@ namespace Il2CppInspector.Outputs
|
||||
ns.ReserveName(keyword);
|
||||
}
|
||||
/* 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);
|
||||
}
|
||||
return ns;
|
||||
@@ -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.
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user