Preloader.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System.Diagnostics;
  2. using BepInEx.Logging;
  3. using BepInEx.Preloader.Core;
  4. using BepInEx.Preloader.Core.Logging;
  5. namespace BepInEx.IL2CPP
  6. {
  7. public static class Preloader
  8. {
  9. public static string IL2CPPUnhollowedPath { get; internal set; }
  10. private static PreloaderConsoleListener PreloaderLog { get; set; }
  11. private static ManualLogSource Log => PreloaderLogger.Log;
  12. public static IL2CPPChainloader Chainloader { get; private set; }
  13. public static void Run()
  14. {
  15. PreloaderLog = new PreloaderConsoleListener(false);
  16. Logger.Listeners.Add(PreloaderLog);
  17. BasicLogInfo.PrintLogInfo(Log);
  18. Log.LogInfo($"Running under Unity v{FileVersionInfo.GetVersionInfo(Paths.ExecutablePath).FileVersion}");
  19. //Log.LogInfo($"CLR runtime version: {Environment.Version}");
  20. //Log.LogInfo($"Supports SRE: {Utility.CLRSupportsDynamicAssemblies}");
  21. Log.LogDebug($"Game executable path: {Paths.ExecutablePath}");
  22. Log.LogDebug($"Unhollowed assembly directory: {IL2CPPUnhollowedPath}");
  23. Log.LogDebug($"BepInEx root path: {Paths.BepInExRootPath}");
  24. Logger.Listeners.Remove(PreloaderLog);
  25. Chainloader = new IL2CPPChainloader();
  26. Chainloader.Initialize();
  27. Chainloader.Execute();
  28. }
  29. }
  30. }