From ef427a968fb93492e853c5fcc8e402e5e6129b41 Mon Sep 17 00:00:00 2001 From: bookdude13 Date: Wed, 30 Aug 2023 11:49:15 -0500 Subject: [PATCH] Looser filtering on type name (#233) --- .../Utils/AsmResolver/AsmResolverAssemblyPopulator.cs | 11 ++++++++--- .../Utils/AsmResolver/AsmResolverMethodFiller.cs | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Cpp2IL.Core/Utils/AsmResolver/AsmResolverAssemblyPopulator.cs b/Cpp2IL.Core/Utils/AsmResolver/AsmResolverAssemblyPopulator.cs index 53f84191..9c6f6344 100644 --- a/Cpp2IL.Core/Utils/AsmResolver/AsmResolverAssemblyPopulator.cs +++ b/Cpp2IL.Core/Utils/AsmResolver/AsmResolverAssemblyPopulator.cs @@ -16,11 +16,16 @@ namespace Cpp2IL.Core.Utils.AsmResolver; public static class AsmResolverAssemblyPopulator { + public static bool IsTypeContextModule(TypeAnalysisContext typeCtx) + { + return typeCtx.Name.StartsWith("") || typeCtx.FullName.StartsWith(""); + } + public static void ConfigureHierarchy(AssemblyAnalysisContext asmCtx) { foreach (var typeCtx in asmCtx.Types) { - if (typeCtx.Name == "") + if (IsTypeContextModule(typeCtx)) continue; var il2CppTypeDef = typeCtx.Definition; @@ -242,7 +247,7 @@ public static void PopulateCustomAttributes(AssemblyAnalysisContext asmContext) foreach (var type in asmContext.Types) { - if (type.Name == "") + if (IsTypeContextModule(type)) continue; CopyCustomAttributes(type, type.GetExtraData("AsmResolverType")!.CustomAttributes); @@ -282,7 +287,7 @@ public static void CopyDataFromIl2CppToManaged(AssemblyAnalysisContext asmContex foreach (var typeContext in asmContext.Types) { - if (typeContext.Name == "") + if (IsTypeContextModule(typeContext)) continue; var managedType = typeContext.GetExtraData("AsmResolverType") ?? throw new($"AsmResolver type not found in type analysis context for {typeContext.Definition?.FullName}"); diff --git a/Cpp2IL.Core/Utils/AsmResolver/AsmResolverMethodFiller.cs b/Cpp2IL.Core/Utils/AsmResolver/AsmResolverMethodFiller.cs index d7382b4b..208438cf 100644 --- a/Cpp2IL.Core/Utils/AsmResolver/AsmResolverMethodFiller.cs +++ b/Cpp2IL.Core/Utils/AsmResolver/AsmResolverMethodFiller.cs @@ -14,7 +14,7 @@ public static void FillManagedMethodBodies(AssemblyAnalysisContext asmContext) { foreach (var typeContext in asmContext.Types) { - if (typeContext.Name == "") + if (AsmResolverAssemblyPopulator.IsTypeContextModule(typeContext)) continue; #if !DEBUG