Merge branch 'master' into reshade-addon

This commit is contained in:
goat 2024-07-23 02:18:04 +02:00 committed by GitHub
commit a57694d7e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 49 additions and 42 deletions

View file

@ -9,7 +9,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Label="Feature"> <PropertyGroup Label="Feature">
<DalamudVersion>10.0.0.5</DalamudVersion> <DalamudVersion>10.0.0.6</DalamudVersion>
<Description>XIV Launcher addon framework</Description> <Description>XIV Launcher addon framework</Description>
<AssemblyVersion>$(DalamudVersion)</AssemblyVersion> <AssemblyVersion>$(DalamudVersion)</AssemblyVersion>
<Version>$(DalamudVersion)</Version> <Version>$(DalamudVersion)</Version>

View file

@ -18,4 +18,9 @@ public unsafe class NINGauge : JobGaugeBase<FFXIVClientStructs.FFXIV.Client.Game
/// Gets the amount of Ninki available. /// Gets the amount of Ninki available.
/// </summary> /// </summary>
public byte Ninki => this.Struct->Ninki; public byte Ninki => this.Struct->Ninki;
/// <summary>
/// Gets the current charges for Kazematoi
/// </summary>
public byte Kazematoi => this.Struct->Kazematoi;
} }

View file

@ -131,9 +131,12 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
/// </summary> /// </summary>
internal void HandleRemovedNodes() internal void HandleRemovedNodes()
{ {
foreach (var data in this.entries.Where(d => d.ShouldBeRemoved)) foreach (var data in this.entries)
{ {
this.RemoveEntry(data); if (data.ShouldBeRemoved)
{
this.RemoveEntry(data);
}
} }
this.entries.RemoveAll(d => d.ShouldBeRemoved); this.entries.RemoveAll(d => d.ShouldBeRemoved);
@ -210,7 +213,7 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
// If we have an unmodified DTR but still have entries, we need to // If we have an unmodified DTR but still have entries, we need to
// work to reset our state. // work to reset our state.
if (!this.CheckForDalamudNodes()) if (!this.CheckForDalamudNodes(dtr))
this.RecreateNodes(); this.RecreateNodes();
var collisionNode = dtr->GetNodeById(17); var collisionNode = dtr->GetNodeById(17);
@ -223,40 +226,35 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
foreach (var data in this.entries) foreach (var data in this.entries)
{ {
var isHide = data.UserHidden || !data.Shown;
if (data is { Dirty: true, Added: true, Text: not null, TextNode: not null })
{
var node = data.TextNode;
if (data.Storage == null)
{
data.Storage = Utf8String.CreateEmpty();
}
data.Storage->SetString(data.Text.EncodeWithNullTerminator());
node->SetText(data.Storage->StringPtr);
ushort w = 0, h = 0;
if (!isHide)
{
node->GetTextDrawSize(&w, &h, node->NodeText.StringPtr);
node->AtkResNode.SetWidth(w);
}
node->AtkResNode.ToggleVisibility(!isHide);
data.Dirty = false;
}
if (!data.Added) if (!data.Added)
{ {
data.Added = this.AddNode(data.TextNode); data.Added = this.AddNode(data.TextNode);
} }
var isHide = !data.Shown || data.UserHidden;
var node = data.TextNode;
var nodeHidden = !node->AtkResNode.IsVisible();
if (!isHide) if (!isHide)
{ {
if (nodeHidden)
node->AtkResNode.ToggleVisibility(true);
if (data is { Added: true, Text: not null, TextNode: not null } && (data.Dirty || nodeHidden))
{
if (data.Storage == null)
{
data.Storage = Utf8String.CreateEmpty();
}
data.Storage->SetString(data.Text.EncodeWithNullTerminator());
node->SetText(data.Storage->StringPtr);
ushort w = 0, h = 0;
node->GetTextDrawSize(&w, &h, node->NodeText.StringPtr);
node->AtkResNode.SetWidth(w);
}
var elementWidth = data.TextNode->AtkResNode.Width + this.configuration.DtrSpacing; var elementWidth = data.TextNode->AtkResNode.Width + this.configuration.DtrSpacing;
if (this.configuration.DtrSwapDirection) if (this.configuration.DtrSwapDirection)
@ -270,17 +268,20 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
data.TextNode->AtkResNode.SetPositionFloat(runningXPos, 2); data.TextNode->AtkResNode.SetPositionFloat(runningXPos, 2);
} }
} }
else else if (!nodeHidden)
{ {
// If we want the node hidden, shift it up, to prevent collision conflicts // If we want the node hidden, shift it up, to prevent collision conflicts
data.TextNode->AtkResNode.SetYFloat(-collisionNode->Height * dtr->RootNode->ScaleX); node->AtkResNode.SetYFloat(-collisionNode->Height * dtr->RootNode->ScaleX);
node->AtkResNode.ToggleVisibility(false);
} }
data.Dirty = false;
} }
} }
private void HandleAddedNodes() private void HandleAddedNodes()
{ {
if (this.newEntries.Any()) if (!this.newEntries.IsEmpty)
{ {
foreach (var newEntry in this.newEntries) foreach (var newEntry in this.newEntries)
{ {
@ -354,11 +355,8 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
/// Checks if there are any Dalamud nodes in the DTR. /// Checks if there are any Dalamud nodes in the DTR.
/// </summary> /// </summary>
/// <returns>True if there are nodes with an ID > 1000.</returns> /// <returns>True if there are nodes with an ID > 1000.</returns>
private bool CheckForDalamudNodes() private bool CheckForDalamudNodes(AtkUnitBase* dtr)
{ {
var dtr = this.GetDtr();
if (dtr == null || dtr->RootNode == null) return false;
for (var i = 0; i < dtr->UldManager.NodeListCount; i++) for (var i = 0; i < dtr->UldManager.NodeListCount; i++)
{ {
if (dtr->UldManager.NodeList[i]->NodeId > 1000) if (dtr->UldManager.NodeList[i]->NodeId > 1000)

View file

@ -137,14 +137,17 @@ public sealed unsafe class DtrBarEntry : IDisposable, IDtrBarEntry
get => this.shownBacking; get => this.shownBacking;
set set
{ {
this.shownBacking = value; if (value != this.shownBacking)
this.Dirty = true; {
this.shownBacking = value;
this.Dirty = true;
}
} }
} }
/// <inheritdoc/> /// <inheritdoc/>
[Api10ToDo("Maybe make this config scoped to internalname?")] [Api10ToDo("Maybe make this config scoped to internalname?")]
public bool UserHidden => this.configuration.DtrIgnore?.Any(x => x == this.Title) ?? false; public bool UserHidden => this.configuration.DtrIgnore?.Contains(this.Title) ?? false;
/// <summary> /// <summary>
/// Gets or sets the internal text node of this entry. /// Gets or sets the internal text node of this entry.

View file

@ -2889,6 +2889,7 @@ internal class PluginInstallerWindow : Window, IDisposable
} }
configuration.QueueSave(); configuration.QueueSave();
_ = pluginManager.ReloadPluginMastersAsync();
} }
if (repoManifest?.IsTestingExclusive == true) if (repoManifest?.IsTestingExclusive == true)

View file

@ -72,7 +72,7 @@ internal sealed class ExposedPlugin(LocalPlugin plugin) : IExposedPlugin
public bool HasMainUi => plugin.DalamudInterface?.LocalUiBuilder.HasMainUi ?? false; public bool HasMainUi => plugin.DalamudInterface?.LocalUiBuilder.HasMainUi ?? false;
/// <inheritdoc/> /// <inheritdoc/>
public bool HasConfigUi => plugin.DalamudInterface?.LocalUiBuilder.HasMainUi ?? false; public bool HasConfigUi => plugin.DalamudInterface?.LocalUiBuilder.HasConfigUi ?? false;
/// <inheritdoc/> /// <inheritdoc/>
public void OpenMainUi() public void OpenMainUi()