From f7c0d65cbc2edf4cc38f40cd6bdd664cd5156b5f Mon Sep 17 00:00:00 2001 From: zznty <94796179+zznty@users.noreply.github.com> Date: Mon, 4 Nov 2024 02:36:36 +0700 Subject: [PATCH] fix harmony type by name --- CringeLauncher/Patches/IntrospectionPatches.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CringeLauncher/Patches/IntrospectionPatches.cs b/CringeLauncher/Patches/IntrospectionPatches.cs index aca54ef..20442b1 100644 --- a/CringeLauncher/Patches/IntrospectionPatches.cs +++ b/CringeLauncher/Patches/IntrospectionPatches.cs @@ -64,12 +64,25 @@ public static class IntrospectionPatches { if (AssemblyLoadContext.GetLoadContext(assembly) is ICoreLoadContext) return true; + + if (assembly.IsDynamic) + { + __result = []; + return false; + } // static classes are abstract __result = IntrospectionContext.Global.CollectAttributedTypes(assembly.GetMainModule(), true) .ToArray(); return false; } + + [HarmonyPrefix, HarmonyPatch(typeof(AccessTools), nameof(AccessTools.AllAssemblies))] + private static bool AllAssembliesHarmonyPrefix(ref IEnumerable __result) + { + __result = AssemblyLoadContext.GetLoadContext(typeof(IntrospectionPatches).Assembly)?.Assemblies ?? []; + return false; + } [HarmonyPrefix, HarmonyPatch(typeof(MySession), "PrepareBaseSession", typeof(MyObjectBuilder_Checkpoint), typeof(MyObjectBuilder_Sector))] private static void PrepareSessionPrefix()