diff --git a/Doorstop b/Doorstop index 310ab026..6b6de3b8 160000 --- a/Doorstop +++ b/Doorstop @@ -1 +1 @@ -Subproject commit 310ab026a8905588dab29f250a2385ed2cb7c41f +Subproject commit 6b6de3b81cf142c73a8ef845f705fb1e51a7670d diff --git a/IPA.Injector/ConsoleWindow.cs b/IPA.Injector/ConsoleWindow.cs index a44e8d24..cc01c543 100644 --- a/IPA.Injector/ConsoleWindow.cs +++ b/IPA.Injector/ConsoleWindow.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Runtime.InteropServices; +using IPA.Logging; using Microsoft.Win32.SafeHandles; namespace IPA.Injector diff --git a/IPA.Loader/Loader/Features/PrintFeature.cs b/IPA.Loader/Loader/Features/PrintFeature.cs index 401a8e6f..236aeb23 100644 --- a/IPA.Loader/Loader/Features/PrintFeature.cs +++ b/IPA.Loader/Loader/Features/PrintFeature.cs @@ -25,7 +25,7 @@ namespace IPA.Loader.Features { public override bool Initialize(PluginLoader.PluginMetadata meta, string[] parameters) { - Logger.features.Debug($"{meta.Name}: {string.Join(" ", parameters)}"); + Logger.features.Warn($"{meta.Name}: {string.Join(" ", parameters)}"); return true; } } diff --git a/IPA.Loader/Loader/LibLoader.cs b/IPA.Loader/Loader/LibLoader.cs index effc6bf8..3e2d3157 100644 --- a/IPA.Loader/Loader/LibLoader.cs +++ b/IPA.Loader/Loader/LibLoader.cs @@ -15,7 +15,7 @@ namespace IPA.Loader var testFile = $"{name.Name}.{name.Version}.dll"; - if (LibLoader.filenameLocations.TryGetValue(testFile, out string path)) + if (LibLoader.FilenameLocations.TryGetValue(testFile, out string path)) { if (File.Exists(path)) { @@ -31,18 +31,18 @@ namespace IPA.Loader { internal static string LibraryPath => Path.Combine(Environment.CurrentDirectory, "Libs"); internal static string NativeLibraryPath => Path.Combine(LibraryPath, "Native"); - internal static Dictionary filenameLocations; + internal static Dictionary FilenameLocations; internal static void SetupAssemblyFilenames() { - if (filenameLocations == null) + if (FilenameLocations == null) { - filenameLocations = new Dictionary(); + FilenameLocations = new Dictionary(); foreach (var fn in TraverseTree(LibraryPath, s => s != NativeLibraryPath)) - if (filenameLocations.ContainsKey(fn.Name)) + if (FilenameLocations.ContainsKey(fn.Name)) Log(Logger.Level.Critical, $"Multiple instances of {fn.Name} exist in Libs! Ignoring {fn.FullName}"); - else filenameLocations.Add(fn.Name, fn.FullName); + else FilenameLocations.Add(fn.Name, fn.FullName); } } @@ -56,7 +56,7 @@ namespace IPA.Loader var testFile = $"{asmName.Name}.{asmName.Version}.dll"; Log(Logger.Level.Debug, $"Looking for file {testFile}"); - if (filenameLocations.TryGetValue(testFile, out string path)) + if (FilenameLocations.TryGetValue(testFile, out string path)) { Log(Logger.Level.Debug, $"Found file {testFile} as {path}"); if (File.Exists(path)) diff --git a/IPA.Loader/Loader/PluginManager.cs b/IPA.Loader/Loader/PluginManager.cs index 4d76a875..5387a706 100644 --- a/IPA.Loader/Loader/PluginManager.cs +++ b/IPA.Loader/Loader/PluginManager.cs @@ -117,11 +117,14 @@ namespace IPA.Loader } } + // initialize BSIPA plugins first + _bsPlugins.AddRange(PluginLoader.LoadPlugins()); + //Copy plugins to .cache string[] originalPlugins = Directory.GetFiles(pluginDirectory, "*.dll"); foreach (string s in originalPlugins) { - if (PluginsMetadata.Select(m => m.File.Name).Contains(s)) continue; + if (PluginsMetadata.Select(m => m.File.FullName).Contains(s)) continue; string pluginCopy = Path.Combine(cacheDir, Path.GetFileName(s)); #region Fix assemblies for refactor @@ -190,7 +193,6 @@ namespace IPA.Loader var result = LoadPluginsFromFile(s); _ipaPlugins.AddRange(result.Item2); } - _bsPlugins.AddRange(PluginLoader.LoadPlugins()); Logger.log.Info(exeName); Logger.log.Info($"Running on Unity {Application.unityVersion}"); diff --git a/IPA.Loader/Logging/StandardLogger.cs b/IPA.Loader/Logging/StandardLogger.cs index b141d7fe..d3213456 100644 --- a/IPA.Loader/Logging/StandardLogger.cs +++ b/IPA.Loader/Logging/StandardLogger.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; +using System.IO; using System.Linq; using System.Threading; @@ -51,6 +52,11 @@ namespace IPA.Logging new GlobalLogFilePrinter() }; + /// + /// The for writing directly to the console window, or stdout if no window open. + /// + public static TextWriter ConsoleWriter { get; internal set; } = Console.Out; + /// /// Adds to the default printer pool that all printers inherit from. Printers added this way will be passed every message from every logger. /// diff --git a/Refs/UnityEngine.CoreModule.dll b/Refs/UnityEngine.CoreModule.dll index 860de28d..2c38c0c4 100644 Binary files a/Refs/UnityEngine.CoreModule.dll and b/Refs/UnityEngine.CoreModule.dll differ