feat: show client structs hash in Game submenu

This commit is contained in:
goaaats 2021-12-05 02:08:43 +01:00
parent 9588e12619
commit 6a977fb59e
No known key found for this signature in database
GPG key ID: F18F057873895461
4 changed files with 33 additions and 3 deletions

View file

@ -105,16 +105,22 @@
<PropertyGroup> <PropertyGroup>
<!-- temp file for the git version (lives in "obj" folder)--> <!-- temp file for the git version (lives in "obj" folder)-->
<VerFile>$(IntermediateOutputPath)gitver</VerFile> <VerFile>$(IntermediateOutputPath)gitver</VerFile>
<VerFileClientStructs>$(IntermediateOutputPath)csver</VerFileClientStructs>
</PropertyGroup> </PropertyGroup>
<!-- write the hash to the temp file.--> <!-- write the hash to the temp file.-->
<Exec Command="git -C &quot;$(ProjectDir.Replace('\','\\'))&quot; describe --long --always --dirty &gt; $(VerFile)" /> <Exec Command="git -C &quot;$(ProjectDir.Replace('\','\\'))&quot; describe --long --always --dirty &gt; $(VerFile)" />
<Exec Command="git -C &quot;$(ProjectDir.Replace('\','\\'))\..\lib\FFXIVClientStructs&quot; describe --long --always --dirty &gt; $(VerFileClientStructs)" />
<!-- read the version into the GitVersion itemGroup--> <!-- read the version into the GitVersion itemGroup-->
<ReadLinesFromFile File="$(VerFile)"> <ReadLinesFromFile File="$(VerFile)">
<Output TaskParameter="Lines" ItemName="GitVersion" /> <Output TaskParameter="Lines" ItemName="GitVersion" />
</ReadLinesFromFile> </ReadLinesFromFile>
<ReadLinesFromFile File="$(VerFileClientStructs)">
<Output TaskParameter="Lines" ItemName="GitVersionClientStructs" />
</ReadLinesFromFile>
<!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.--> <!-- Set the BuildHash property to contain the GitVersion, if it wasn't already set.-->
<PropertyGroup> <PropertyGroup>
<BuildHash>@(GitVersion)</BuildHash> <BuildHash>@(GitVersion)</BuildHash>
<BuildHashClientStructs>@(GitVersionClientStructs)</BuildHashClientStructs>
</PropertyGroup> </PropertyGroup>
</Target> </Target>
<Target Name="WriteGitHash" BeforeTargets="CoreCompile"> <Target Name="WriteGitHash" BeforeTargets="CoreCompile">
@ -132,6 +138,10 @@
<_Parameter1>GitHash</_Parameter1> <_Parameter1>GitHash</_Parameter1>
<_Parameter2>$(BuildHash)</_Parameter2> <_Parameter2>$(BuildHash)</_Parameter2>
</AssemblyAttributes> </AssemblyAttributes>
<AssemblyAttributes Include="AssemblyMetadata">
<_Parameter1>GitHashClientStructs</_Parameter1>
<_Parameter2>$(BuildHashClientStructs)</_Parameter2>
</AssemblyAttributes>
</ItemGroup> </ItemGroup>
<!-- writes the attribute to the customAssemblyInfo file --> <!-- writes the attribute to the customAssemblyInfo file -->
<WriteCodeFragment Language="C#" OutputFile="$(CustomAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" /> <WriteCodeFragment Language="C#" OutputFile="$(CustomAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />

View file

@ -14,7 +14,7 @@ namespace Dalamud.Game.Network.Structures
} }
/// <summary> /// <summary>
/// Category of this ResultDialog packet. /// Gets the category of this ResultDialog packet.
/// </summary> /// </summary>
public uint Category { get; private set; } public uint Category { get; private set; }

View file

@ -507,6 +507,7 @@ namespace Dalamud.Interface.Internal
var startInfo = Service<DalamudStartInfo>.Get(); var startInfo = Service<DalamudStartInfo>.Get();
ImGui.MenuItem(Util.AssemblyVersion, false); ImGui.MenuItem(Util.AssemblyVersion, false);
ImGui.MenuItem(startInfo.GameVersion.ToString(), false); ImGui.MenuItem(startInfo.GameVersion.ToString(), false);
ImGui.MenuItem($"CS: {Util.GetGitHashClientStructs()}", false);
ImGui.EndMenu(); ImGui.EndMenu();
} }

View file

@ -22,7 +22,8 @@ namespace Dalamud.Utility
/// </summary> /// </summary>
public static class Util public static class Util
{ {
private static string gitHashInternal; private static string? gitHashInternal;
private static string? gitHashClientStructsInternal;
/// <summary> /// <summary>
/// Gets an httpclient for usage. /// Gets an httpclient for usage.
@ -48,11 +49,29 @@ namespace Dalamud.Utility
var asm = typeof(Util).Assembly; var asm = typeof(Util).Assembly;
var attrs = asm.GetCustomAttributes<AssemblyMetadataAttribute>(); var attrs = asm.GetCustomAttributes<AssemblyMetadataAttribute>();
gitHashInternal = attrs.FirstOrDefault(a => a.Key == "GitHash")?.Value; gitHashInternal = attrs.First(a => a.Key == "GitHash").Value;
return gitHashInternal; return gitHashInternal;
} }
/// <summary>
/// Gets the git hash value from the assembly
/// or null if it cannot be found.
/// </summary>
/// <returns>The git hash of the assembly.</returns>
public static string GetGitHashClientStructs()
{
if (gitHashClientStructsInternal != null)
return gitHashClientStructsInternal;
var asm = typeof(Util).Assembly;
var attrs = asm.GetCustomAttributes<AssemblyMetadataAttribute>();
gitHashClientStructsInternal = attrs.First(a => a.Key == "GitHashClientStructs").Value;
return gitHashClientStructsInternal;
}
/// <summary> /// <summary>
/// Read memory from an offset and hexdump them via Serilog. /// Read memory from an offset and hexdump them via Serilog.
/// </summary> /// </summary>