Merge remote-tracking branch 'origin/master' into api14-rollup

This commit is contained in:
github-actions[bot] 2025-11-15 00:09:30 +00:00
commit a2e923b051
4 changed files with 38 additions and 10 deletions

View file

@ -162,6 +162,9 @@
<Exec Command="git -C &quot;$(ProjectDir.Replace('\','\\'))&quot; describe --tags --always --dirty" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="DalamudGitDescribeOutput" />
</Exec>
<Exec Command="git -C &quot;$(ProjectDir.Replace('\','\\'))&quot; rev-parse --abbrev-ref HEAD" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="DalamudGitBranch" />
</Exec>
<Exec Command="git -C &quot;$(ProjectDir.Replace('\','\\'))\..\lib\FFXIVClientStructs&quot; describe --long --always --dirty" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="ClientStructsGitDescribeOutput" />
</Exec>
@ -169,6 +172,7 @@
<PropertyGroup>
<CommitCount>$([System.Text.RegularExpressions.Regex]::Replace($(DalamudGitCommitCount), @"\t|\n|\r", ""))</CommitCount>
<CommitHash>$([System.Text.RegularExpressions.Regex]::Replace($(DalamudGitCommitHash), @"\t|\n|\r", ""))</CommitHash>
<Branch>$([System.Text.RegularExpressions.Regex]::Replace($(DalamudGitBranch), @"\t|\n|\r", ""))</Branch>
<SCMVersion>$([System.Text.RegularExpressions.Regex]::Replace($(DalamudGitDescribeOutput), @"\t|\n|\r", ""))</SCMVersion>
<CommitHashClientStructs>$([System.Text.RegularExpressions.Regex]::Replace($(ClientStructsGitDescribeOutput), @"\t|\n|\r", ""))</CommitHashClientStructs>
</PropertyGroup>
@ -182,6 +186,7 @@
<!-- stub out version since it takes a while. -->
<PropertyGroup>
<SCMVersion>Local build at $([System.DateTime]::Now.ToString(yyyy-MM-dd HH:mm:ss))</SCMVersion>
<Branch>???</Branch>
<CommitHashClientStructs>???</CommitHashClientStructs>
</PropertyGroup>
</Target>
@ -205,6 +210,10 @@
<_Parameter1>GitCommitCount</_Parameter1>
<_Parameter2>$(CommitCount)</_Parameter2>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyMetadata" Condition="'$(Branch)' != ''">
<_Parameter1>GitBranch</_Parameter1>
<_Parameter2>$(Branch)</_Parameter2>
</AssemblyAttributes>
<AssemblyAttributes Include="AssemblyMetadata" Condition="'$(CommitHashClientStructs)' != ''">
<_Parameter1>GitHashClientStructs</_Parameter1>
<_Parameter2>$(CommitHashClientStructs)</_Parameter2>

View file

@ -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);

View file

@ -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<Dictionary<string, VersionEntry>>(BranchInfoUrl);
Debug.Assert(this.branches != null, "this.branches != null");
var config = Service<DalamudConfiguration>.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<DalamudConfiguration>.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<DalamudConfiguration>.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))
{

View file

@ -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;
}
/// <summary>
/// Gets the Dalamud branch name this version of Dalamud was built from, or null, if this is a Debug build.
/// </summary>
/// <returns>The branch name.</returns>
public static string? GetBranch()
{
if (branchInternal != null)
return branchInternal;
var asm = typeof(Util).Assembly;
var attrs = asm.GetCustomAttributes<AssemblyMetadataAttribute>();
var gitBranch = attrs.FirstOrDefault(a => a.Key == "GitBranch")?.Value;
if (gitBranch == null)
return null;
return branchInternal = gitBranch == "master" ? "release" : gitBranch;
}
/// <inheritdoc cref="DescribeAddress(nint)"/>
public static unsafe string DescribeAddress(void* p) => DescribeAddress((nint)p);