From a0583fa31bb28fbef9053bff7c064c04b84255b5 Mon Sep 17 00:00:00 2001 From: Ryan Fredlund Date: Fri, 25 Aug 2023 14:57:20 -0500 Subject: [PATCH] Looser filtering on type name. I ran across a game using '.' --- .../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