From 4711b12a479529f6f5153b08ece39e987245e8f0 Mon Sep 17 00:00:00 2001 From: hazre <37149950+hazre@users.noreply.github.com> Date: Wed, 17 Dec 2025 15:32:22 +0100 Subject: [PATCH] feat(Logging): add BepisLoader version logging to chainloader startup --- BepInEx.Core/Utility.cs | 18 ++++++++++++++++++ .../Logging/ChainloaderLogHelper.cs | 6 ++++++ 2 files changed, 24 insertions(+) diff --git a/BepInEx.Core/Utility.cs b/BepInEx.Core/Utility.cs index 89b12864..b1cea1f5 100644 --- a/BepInEx.Core/Utility.cs +++ b/BepInEx.Core/Utility.cs @@ -28,6 +28,24 @@ public static class Utility SemanticVersioning.Version.Parse(MetadataHelper.GetAttributes(typeof(Utility).Assembly)[0] .InformationalVersion); + /// + /// Gets the BepisLoader version if available. + /// + /// The version string, or null if BepisLoader is not found. + public static Version GetBepisLoaderVersion() + { + try + { + var bepisLoaderAsm = AppDomain.CurrentDomain.GetAssemblies() + .FirstOrDefault(a => a.GetName().Name == "BepisLoader"); + return bepisLoaderAsm?.GetName().Version; + } + catch + { + return null; + } + } + private const string TRUSTED_PLATFORM_ASSEMBLIES = "TRUSTED_PLATFORM_ASSEMBLIES"; private static bool? sreEnabled; diff --git a/BepInEx.Preloader.Core/Logging/ChainloaderLogHelper.cs b/BepInEx.Preloader.Core/Logging/ChainloaderLogHelper.cs index f82e3543..ae5c8885 100644 --- a/BepInEx.Preloader.Core/Logging/ChainloaderLogHelper.cs +++ b/BepInEx.Preloader.Core/Logging/ChainloaderLogHelper.cs @@ -50,6 +50,12 @@ public static void PrintLogInfo(ManualLogSource log) Logger.Log(LogLevel.Info, $"System platform: {GetPlatformString()}"); Logger.Log(LogLevel.Info, $"Process bitness: {(PlatformUtils.ProcessIs64Bit ? "64-bit (x64)" : "32-bit (x86)")}"); + + var bepisLoaderVersion = Utility.GetBepisLoaderVersion(); + if (bepisLoaderVersion != null) + Logger.Log(LogLevel.Info, $"Loader: BepisLoader {bepisLoaderVersion}"); + else + Logger.Log(LogLevel.Info, "Loader: BepisLoader not found, version unknown"); } private static string GetPlatformString()