Browse Source

Show currently executing preloader patch

Bepis 5 years ago
parent
commit
b4362c908e
2 changed files with 11 additions and 4 deletions
  1. 3 1
      BepInEx.Preloader/Patching/AssemblyPatcher.cs
  2. 8 3
      BepInEx.Preloader/Preloader.cs

+ 3 - 1
BepInEx.Preloader/Patching/AssemblyPatcher.cs

@@ -50,7 +50,7 @@ namespace BepInEx.Preloader.Patching
 
 			var sortedPatchers = new SortedDictionary<string, PatcherPlugin>();
 
-			foreach (string assemblyPath in Directory.GetFiles(directory, "*.dll"))
+			foreach (string assemblyPath in Directory.GetFiles(directory, "*.dll", SearchOption.AllDirectories))
 				try
 				{
 					var assembly = Assembly.LoadFrom(assemblyPath);
@@ -129,6 +129,8 @@ namespace BepInEx.Preloader.Patching
 				foreach (string targetDll in assemblyPatcher.TargetDLLs)
 					if (assemblies.TryGetValue(targetDll, out var assembly))
 					{
+						Logger.LogInfo($"Patching [{assembly.Name.Name}] with [{assemblyPatcher.Name}]");
+
 						assemblyPatcher.Patcher?.Invoke(ref assembly);
 						assemblies[targetDll] = assembly;
 						patchedAssemblies.Add(targetDll);

+ 8 - 3
BepInEx.Preloader/Preloader.cs

@@ -68,7 +68,11 @@ namespace BepInEx.Preloader
 				string entrypointAssembly = Config.GetEntry("entrypoint-assembly", "UnityEngine.dll", "Preloader");
 
 				AssemblyPatcher.AddPatcher(new PatcherPlugin
-					{ TargetDLLs = new[] { entrypointAssembly }, Patcher = PatchEntrypoint });
+					{ TargetDLLs = new[] { entrypointAssembly },
+						Patcher = PatchEntrypoint,
+						Name = "BepInEx.Chainloader"
+					});
+
 				AssemblyPatcher.AddPatchersFromDirectory(Paths.PatcherPluginPath, GetPatcherMethods);
 
 				Logger.LogInfo($"{AssemblyPatcher.PatcherPlugins.Count} patcher plugin(s) loaded");
@@ -158,7 +162,7 @@ namespace BepInEx.Preloader
 
 					var assemblyPatcher = new PatcherPlugin();
 
-					assemblyPatcher.Name = $"{assembly.GetName().Name}{type.FullName}";
+					assemblyPatcher.Name = $"{assembly.GetName().Name}/{type.FullName}";
 					assemblyPatcher.Patcher = (ref AssemblyDefinition ass) =>
 					{
 						//we do the array fuckery here to get the ref result out
@@ -199,7 +203,8 @@ namespace BepInEx.Preloader
 					Logger.LogWarning(ex);
 				}
 
-			Logger.LogInfo($"Loaded {patcherMethods.Count} patcher methods from {assembly.GetName().Name}");
+			Logger.Log(patcherMethods.Count > 0 ? LogLevel.Info : LogLevel.Debug,
+				$"Loaded {patcherMethods.Count} patcher methods from {assembly.GetName().Name}");
 
 			return patcherMethods;
 		}