diff --git a/Dalamud/Dalamud.csproj b/Dalamud/Dalamud.csproj index 5b796e7b0..beb14c61e 100644 --- a/Dalamud/Dalamud.csproj +++ b/Dalamud/Dalamud.csproj @@ -125,6 +125,17 @@ $(OutputPath)TEMP_gitver.txt + + + + + + + + $([System.Text.RegularExpressions.Regex]::Replace($(DalamudGitCommitCount), @"\t|\n|\r", "")) + + + @@ -171,6 +182,10 @@ <_Parameter1>GitHash <_Parameter2>$(BuildHash) + + <_Parameter1>GitCommitCount + <_Parameter2>$(CommitCount) + <_Parameter1>GitHashClientStructs <_Parameter2>$(BuildHashClientStructs) diff --git a/Dalamud/Interface/Internal/DalamudInterface.cs b/Dalamud/Interface/Internal/DalamudInterface.cs index 3c6059b77..3da633c86 100644 --- a/Dalamud/Interface/Internal/DalamudInterface.cs +++ b/Dalamud/Interface/Internal/DalamudInterface.cs @@ -706,7 +706,7 @@ internal class DalamudInterface : IDisposable, IServiceType { this.OpenProfiler(); } - + if (ImGui.MenuItem("Open Hitch Settings")) { this.OpenHitchSettings(); @@ -768,7 +768,7 @@ internal class DalamudInterface : IDisposable, IServiceType ImGui.MenuItem(Util.AssemblyVersion, false); ImGui.MenuItem(startInfo.GameVersion?.ToString() ?? "Unknown version", false); - ImGui.MenuItem($"D: {Util.GetGitHash()} CS: {Util.GetGitHashClientStructs()} [{FFXIVClientStructs.Interop.Resolver.Version}]", false); + ImGui.MenuItem($"D: {Util.GetGitHash()}[{Util.GetGitCommitCount()}] CS: {Util.GetGitHashClientStructs()}[{FFXIVClientStructs.Interop.Resolver.Version}]", false); ImGui.MenuItem($"CLR: {Environment.Version}", false); ImGui.EndMenu(); @@ -944,7 +944,7 @@ internal class DalamudInterface : IDisposable, IServiceType { ImGui.PushFont(InterfaceManager.MonoFont); - ImGui.BeginMenu(Util.GetGitHash(), false); + ImGui.BeginMenu($"{Util.GetGitHash()}({Util.GetGitCommitCount()})", false); ImGui.BeginMenu(this.FrameCount.ToString("000000"), false); ImGui.BeginMenu(ImGui.GetIO().Framerate.ToString("000"), false); ImGui.BeginMenu($"W:{Util.FormatBytes(GC.GetTotalMemory(false))}", false); diff --git a/Dalamud/Utility/Util.cs b/Dalamud/Utility/Util.cs index 6a1fa7e46..7837e1bab 100644 --- a/Dalamud/Utility/Util.cs +++ b/Dalamud/Utility/Util.cs @@ -28,6 +28,7 @@ namespace Dalamud.Utility; public static class Util { private static string? gitHashInternal; + private static int? gitCommitCountInternal; private static string? gitHashClientStructsInternal; private static ulong moduleStartAddr; @@ -114,6 +115,26 @@ public static class Util return gitHashInternal; } + /// + /// Gets the amount of commits in the current branch, or null if undetermined. + /// + /// The amount of commits in the current branch. + public static int? GetGitCommitCount() + { + if (gitCommitCountInternal != null) + return gitCommitCountInternal.Value; + + var asm = typeof(Util).Assembly; + var attrs = asm.GetCustomAttributes(); + + var value = attrs.First(a => a.Key == "GitCommitCount").Value; + if (value == null) + return null; + + gitCommitCountInternal = int.Parse(value); + return gitCommitCountInternal.Value; + } + /// /// Gets the git hash value from the assembly /// or null if it cannot be found.