mirror of
https://github.com/LukeFZ/Il2CppInspectorRedux.git
synced 2026-01-31 15:09:40 +05:00
Merge branch 'master' of https://github.com/LukeFZ/Il2CppInspectorRedux
This commit is contained in:
@@ -435,30 +435,22 @@ public class CppDeclarationGenerator
|
||||
/// <returns>A string containing C type declarations</returns>
|
||||
public List<(TypeInfo ilType, CppComplexType valueType, CppComplexType referenceType, CppComplexType fieldsType,
|
||||
CppComplexType vtableType, CppComplexType staticsType)> GenerateRemainingTypeDeclarations() {
|
||||
try
|
||||
{
|
||||
var decl = GenerateVisitedFieldStructs().Select(s =>
|
||||
(s.ilType, s.valueType, s.referenceType, s.fieldsType, (CppComplexType)null,
|
||||
(CppComplexType)null))
|
||||
.ToList();
|
||||
|
||||
foreach (var ti in _todoTypeStructs)
|
||||
{
|
||||
var (cls, statics, vtable) = GenerateTypeStruct(ti);
|
||||
decl.Add((ti, null, cls, null, vtable, statics));
|
||||
}
|
||||
var decl = GenerateVisitedFieldStructs().Select(s =>
|
||||
(s.ilType, s.valueType, s.referenceType, s.fieldsType, (CppComplexType)null,
|
||||
(CppComplexType)null))
|
||||
.ToList();
|
||||
|
||||
return decl;
|
||||
}
|
||||
catch (Exception)
|
||||
foreach (var ti in _todoTypeStructs)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_todoTypeStructs.Clear();
|
||||
_todoFieldStructs.Clear();
|
||||
var (cls, statics, vtable) = GenerateTypeStruct(ti);
|
||||
decl.Add((ti, null, cls, null, vtable, statics));
|
||||
}
|
||||
|
||||
_todoTypeStructs.Clear();
|
||||
_todoFieldStructs.Clear();
|
||||
|
||||
return decl;
|
||||
}
|
||||
|
||||
public List<CppType> GenerateRequiredForwardDefinitions()
|
||||
|
||||
@@ -497,6 +497,7 @@ namespace Il2CppInspector.Cpp
|
||||
// Allow auto-generation of forward declarations
|
||||
// This will break type generation unless the ultimate wanted type is a pointer
|
||||
// Note this can still be the case with indirectionCount == 0 if .AsPointer() is called afterwards
|
||||
|
||||
if (!Types.ContainsKey(baseName))
|
||||
Struct(baseName);
|
||||
|
||||
|
||||
@@ -82,7 +82,24 @@ public class CppTypeDependencyGraph
|
||||
// finally, process all instance fields.
|
||||
// the reference type depends on the type of the field
|
||||
foreach (var field in typeInfo.DeclaredFields.Where(f => f.IsInstanceField))
|
||||
AddReference(typeNode, GetNode(field.FieldType), field.FieldType.IsPassedByReference);
|
||||
{
|
||||
// if the field type is a pointer and the element type an enum, we have to add a reference to the enum.
|
||||
// this is a workaround for type emitting only being able to generate forward definitions for *struct* types, and not enum types
|
||||
if (field.FieldType.IsPointer)
|
||||
{
|
||||
// support multiple pointer levels
|
||||
var type = field.FieldType;
|
||||
while (type.IsPointer)
|
||||
type = type.ElementType;
|
||||
|
||||
if (type.IsEnum)
|
||||
AddReference(typeNode, GetNode(type), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddReference(typeNode, GetNode(field.FieldType), field.FieldType.IsPassedByReference);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<TypeInfo> DeriveDependencyOrderedTypes(TypeInfo typeInfo)
|
||||
|
||||
Reference in New Issue
Block a user