diff --git a/Dalamud/Dalamud.csproj b/Dalamud/Dalamud.csproj
index 1166c24c0..1e5f9f586 100644
--- a/Dalamud/Dalamud.csproj
+++ b/Dalamud/Dalamud.csproj
@@ -162,6 +162,9 @@
+
+
+
@@ -169,6 +172,7 @@
$([System.Text.RegularExpressions.Regex]::Replace($(DalamudGitCommitCount), @"\t|\n|\r", ""))
$([System.Text.RegularExpressions.Regex]::Replace($(DalamudGitCommitHash), @"\t|\n|\r", ""))
+ $([System.Text.RegularExpressions.Regex]::Replace($(DalamudGitBranch), @"\t|\n|\r", ""))
$([System.Text.RegularExpressions.Regex]::Replace($(DalamudGitDescribeOutput), @"\t|\n|\r", ""))
$([System.Text.RegularExpressions.Regex]::Replace($(ClientStructsGitDescribeOutput), @"\t|\n|\r", ""))
@@ -182,6 +186,7 @@
Local build at $([System.DateTime]::Now.ToString(yyyy-MM-dd HH:mm:ss))
+ ???
???
@@ -205,6 +210,10 @@
<_Parameter1>GitCommitCount
<_Parameter2>$(CommitCount)
+
+ <_Parameter1>GitBranch
+ <_Parameter2>$(Branch)
+
<_Parameter1>GitHashClientStructs
<_Parameter2>$(CommitHashClientStructs)
diff --git a/Dalamud/Interface/Internal/DalamudInterface.cs b/Dalamud/Interface/Internal/DalamudInterface.cs
index 05ecff8d9..f2ffc7a4c 100644
--- a/Dalamud/Interface/Internal/DalamudInterface.cs
+++ b/Dalamud/Interface/Internal/DalamudInterface.cs
@@ -1060,7 +1060,8 @@ internal class DalamudInterface : IInternalDisposableService
{
ImGui.PushFont(InterfaceManager.MonoFont);
- ImGui.BeginMenu(Util.GetScmVersion(), false);
+ ImGui.BeginMenu(Util.GetBranch() ?? "???", false);
+ ImGui.BeginMenu($"{Util.GetScmVersion()}", 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/Interface/Internal/Windows/BranchSwitcherWindow.cs b/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs
index f7250e528..da6217aca 100644
--- a/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs
+++ b/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs
@@ -11,6 +11,8 @@ using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Windowing;
using Dalamud.Networking.Http;
+using Dalamud.Utility;
+
using Newtonsoft.Json;
namespace Dalamud.Interface.Internal.Windows;
@@ -44,13 +46,10 @@ public class BranchSwitcherWindow : Window
this.branches = await client.GetFromJsonAsync>(BranchInfoUrl);
Debug.Assert(this.branches != null, "this.branches != null");
- var config = Service.Get();
- this.selectedBranchIndex = this.branches!.Any(x => x.Key == config.DalamudBetaKind) ?
- this.branches.TakeWhile(x => x.Key != config.DalamudBetaKind).Count()
+ var branch = Util.GetBranch();
+ this.selectedBranchIndex = this.branches!.Any(x => x.Value.Track == branch) ?
+ this.branches.TakeWhile(x => x.Value.Track != branch).Count()
: 0;
-
- if (this.branches.ElementAt(this.selectedBranchIndex).Value.Key != config.DalamudBetaKey)
- this.selectedBranchIndex = 0;
});
base.OnOpen();
@@ -88,13 +87,12 @@ public class BranchSwitcherWindow : Window
var config = Service.Get();
config.DalamudBetaKind = pickedBranch.Key;
config.DalamudBetaKey = pickedBranch.Value.Key;
- config.QueueSave();
// If we exit immediately, we need to write out the new config now
- Service.Get().ForceSave();
+ config.ForceSave();
var appData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
- var xlPath = Path.Combine(appData, "XIVLauncher", "XIVLauncher.exe");
+ var xlPath = Path.Combine(appData, "XIVLauncher", "current", "XIVLauncher.exe");
if (File.Exists(xlPath))
{
diff --git a/Dalamud/Utility/Util.cs b/Dalamud/Utility/Util.cs
index 4d578db40..50006a023 100644
--- a/Dalamud/Utility/Util.cs
+++ b/Dalamud/Utility/Util.cs
@@ -67,6 +67,7 @@ public static partial class Util
private static string? scmVersionInternal;
private static string? gitHashInternal;
private static string? gitHashClientStructsInternal;
+ private static string? branchInternal;
private static ulong moduleStartAddr;
private static ulong moduleEndAddr;
@@ -134,6 +135,25 @@ public static partial class Util
return gitHashClientStructsInternal;
}
+ ///
+ /// Gets the Dalamud branch name this version of Dalamud was built from, or null, if this is a Debug build.
+ ///
+ /// The branch name.
+ public static string? GetBranch()
+ {
+ if (branchInternal != null)
+ return branchInternal;
+
+ var asm = typeof(Util).Assembly;
+ var attrs = asm.GetCustomAttributes();
+
+ var gitBranch = attrs.FirstOrDefault(a => a.Key == "GitBranch")?.Value;
+ if (gitBranch == null)
+ return null;
+
+ return branchInternal = gitBranch == "master" ? "release" : gitBranch;
+ }
+
///
public static unsafe string DescribeAddress(void* p) => DescribeAddress((nint)p);