AppModel/C++: Fix regression in handling of C# primitive pointer types
This commit is contained in:
@@ -102,7 +102,7 @@ namespace Il2CppInspector.Cpp
|
|||||||
private void VisitFieldStructs(TypeInfo ti) {
|
private void VisitFieldStructs(TypeInfo ti) {
|
||||||
if (VisitedFieldStructs.Contains(ti))
|
if (VisitedFieldStructs.Contains(ti))
|
||||||
return;
|
return;
|
||||||
if (ti.IsByRef || ti.IsPointer || ti.ContainsGenericParameters)
|
if (ti.IsByRef || ti.ContainsGenericParameters)
|
||||||
return;
|
return;
|
||||||
VisitedFieldStructs.Add(ti);
|
VisitedFieldStructs.Add(ti);
|
||||||
|
|
||||||
|
|||||||
@@ -178,20 +178,6 @@ namespace Il2CppInspector.Model
|
|||||||
AddTypes(declarationGenerator.GenerateRemainingTypeDeclarations());
|
AddTypes(declarationGenerator.GenerateRemainingTypeDeclarations());
|
||||||
|
|
||||||
if (usage.Type == MetadataUsageType.TypeInfo)
|
if (usage.Type == MetadataUsageType.TypeInfo)
|
||||||
// .NET unsafe pointer type that has not been mapped by IL2CPP to a C type
|
|
||||||
// (often void* or byte* in metadata v23 and v24.0)
|
|
||||||
if (!Types.ContainsKey(type)) {
|
|
||||||
Debug.Assert(type.IsPointer);
|
|
||||||
|
|
||||||
// TODO: This should really be handled by CppDeclarationGenerator, and doesn't generate the full definition
|
|
||||||
var cppType = CppTypeCollection.Struct(declarationGenerator.TypeNamer.GetName(type));
|
|
||||||
var cppObjectType = (CppComplexType) CppTypeCollection["Il2CppObject"];
|
|
||||||
cppType.Fields = new SortedDictionary<int, List<CppField>>(cppObjectType.Fields);
|
|
||||||
|
|
||||||
DependencyOrderedCppTypes.Add(cppType);
|
|
||||||
Types.Add(type, cppType, new AppType(type, cppType, cppClassPtr: address) {Group = Group});
|
|
||||||
}
|
|
||||||
else
|
|
||||||
// Regular type definition
|
// Regular type definition
|
||||||
Types[type].TypeClassAddress = address;
|
Types[type].TypeClassAddress = address;
|
||||||
|
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ namespace Il2CppInspector.Reflection
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static string ToCIdentifier(this string str) {
|
public static string ToCIdentifier(this string str) {
|
||||||
|
// replace * with Ptr
|
||||||
|
str = str.Replace("*", "Ptr");
|
||||||
// replace illegal characters
|
// replace illegal characters
|
||||||
str = Regex.Replace(str, "[^a-zA-Z0-9_]", "_");
|
str = Regex.Replace(str, "[^a-zA-Z0-9_]", "_");
|
||||||
// ensure identifier starts with a letter or _ (and is non-empty)
|
// ensure identifier starts with a letter or _ (and is non-empty)
|
||||||
|
|||||||
Reference in New Issue
Block a user