diff --git a/IPA.Loader/Loader/PluginComponent.cs b/IPA.Loader/Loader/PluginComponent.cs index ec02f6de..5ab3c2cb 100644 --- a/IPA.Loader/Loader/PluginComponent.cs +++ b/IPA.Loader/Loader/PluginComponent.cs @@ -27,7 +27,8 @@ namespace IPA.Loader ipaPlugins = new CompositeIPAPlugin(PluginManager.Plugins); #pragma warning restore 618 - gameObject.AddComponent(); + /* kill this for now, until theres a new system */ + //gameObject.AddComponent(); bsPlugins.OnApplicationStart(); ipaPlugins.OnApplicationStart(); diff --git a/IPA/Program.cs b/IPA/Program.cs index 120ad5f8..05c6abb7 100644 --- a/IPA/Program.cs +++ b/IPA/Program.cs @@ -283,10 +283,13 @@ namespace IPA public static void ClearLine() { - Console.SetCursorPosition(0, Console.CursorTop); - int tpos = Console.CursorTop; - Console.Write(new string(' ', Console.WindowWidth)); - Console.SetCursorPosition(0, tpos); + if (IsConsole) + { + Console.SetCursorPosition(0, Console.CursorTop); + int tpos = Console.CursorTop; + Console.Write(new string(' ', Console.WindowWidth)); + Console.SetCursorPosition(0, tpos); + } } private static IEnumerable PassThroughInterceptor(FileInfo from, FileInfo to) @@ -313,7 +316,7 @@ namespace IPA Debug.Assert(targetFile.Directory != null, "targetFile.Directory != null"); targetFile.Directory?.Create(); - Console.CursorTop--; + LineBack(); ClearLine(); Console.WriteLine(@"Copying {0}", targetFile.FullName); backup.Add(targetFile); @@ -387,6 +390,36 @@ namespace IPA } } + public static void ResetLine() + { + if (IsConsole) + Console.CursorLeft = 0; + else + Console.Write("\r"); + } + + public static void LineBack() + { + if (IsConsole) + Console.CursorTop--; + else + Console.Write("\x1b[1A"); + } + + [DllImport("kernel32.dll")] + private static extern IntPtr GetConsoleWindow(); + + private static bool? isConsole; + public static bool IsConsole + { + get + { + if (isConsole == null) + isConsole = GetConsoleWindow() != IntPtr.Zero; + return isConsole.Value; + } + } + public abstract class Keyboard { [Flags] diff --git a/Refs/UnityEngine.CoreModule.dll b/Refs/UnityEngine.CoreModule.dll index 51fc9d87..2f7c7acf 100644 Binary files a/Refs/UnityEngine.CoreModule.dll and b/Refs/UnityEngine.CoreModule.dll differ