Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions BepInEx.Core/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,24 @@ public static class Utility
SemanticVersioning.Version.Parse(MetadataHelper.GetAttributes<AssemblyInformationalVersionAttribute>(typeof(Utility).Assembly)[0]
.InformationalVersion);

/// <summary>
/// Gets the BepisLoader version if available.
/// </summary>
/// <returns>The version string, or null if BepisLoader is not found.</returns>
public static Version GetBepisLoaderVersion()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't there a Utils.BepisLoaderVersion or whatever

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wait I see its bepisloader not bepinex version. I mean I don't like this function in this place. I don't think we should be modifying bepinex core unless we have to

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the logger is in bepinex core and all the sys/env info is printed at the top. So this would be the appropriate place to do it. Alternative would be to put it in the Shim but it would get buried under other logs.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean shim already prints it if you have the option to change window title technically. and yeah I think it makes more sense to do it there.

{
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;

Expand Down
6 changes: 6 additions & 0 deletions BepInEx.Preloader.Core/Logging/ChainloaderLogHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading