AppModel: Move C++ type ordering to model
This commit is contained in:
@@ -245,19 +245,16 @@ namespace Il2CppInspector.Cpp
|
||||
}
|
||||
|
||||
// "Flush" the list of visited types, generating C structures for each one
|
||||
private List<CppType> GenerateVisitedFieldStructs() {
|
||||
var structs = new List<CppType>(TodoTypeStructs.Count);
|
||||
private List<(TypeInfo ilType, CppType valueType, CppType referenceType, CppType fieldsType)> GenerateVisitedFieldStructs() {
|
||||
var structs = new List<(TypeInfo ilType, CppType valueType, CppType referenceType, CppType fieldsType)>(TodoTypeStructs.Count);
|
||||
foreach (var ti in TodoFieldStructs) {
|
||||
if (ti.IsEnum || ti.IsValueType) {
|
||||
var (valueType, boxedType) = GenerateValueFieldStruct(ti);
|
||||
structs.Add(valueType);
|
||||
structs.Add(boxedType);
|
||||
structs.Add((ti, valueType, boxedType, null));
|
||||
}
|
||||
else {
|
||||
var (objectOrArrayType, fieldsType) = GenerateRefFieldStruct(ti);
|
||||
if (fieldsType != null)
|
||||
structs.Add(fieldsType);
|
||||
structs.Add(objectOrArrayType);
|
||||
structs.Add((ti, null, objectOrArrayType, fieldsType));
|
||||
}
|
||||
}
|
||||
TodoFieldStructs.Clear();
|
||||
@@ -435,14 +432,12 @@ namespace Il2CppInspector.Cpp
|
||||
/// Type declarations that have previously been generated by this instance of CppDeclarationGenerator will not be generated again.
|
||||
/// </summary>
|
||||
/// <returns>A string containing C type declarations</returns>
|
||||
public List<CppType> GenerateRemainingTypeDeclarations() {
|
||||
var decl = GenerateVisitedFieldStructs();
|
||||
public List<(TypeInfo ilType, CppType valueType, CppType referenceType, CppType fieldsType, CppType vtableType, CppType staticsType)> GenerateRemainingTypeDeclarations() {
|
||||
var decl = GenerateVisitedFieldStructs().Select(s => (s.ilType, s.valueType, s.referenceType, s.fieldsType, (CppType) null, (CppType) null)).ToList();
|
||||
|
||||
foreach (var ti in TodoTypeStructs) {
|
||||
var (cls, statics, vtable) = GenerateTypeStruct(ti);
|
||||
decl.Add(vtable);
|
||||
decl.Add(statics);
|
||||
decl.Add(cls);
|
||||
decl.Add((ti, null, cls, null, vtable, statics));
|
||||
}
|
||||
TodoTypeStructs.Clear();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user