mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-25 22:21:49 +01:00
Apply ImRaii to leftover widgets
This commit is contained in:
parent
17a054fa1b
commit
31d19b76ee
5 changed files with 85 additions and 88 deletions
|
|
@ -8,7 +8,7 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Widget for displaying Addon Data.
|
/// Widget for displaying Addon Data.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal unsafe class AddonWidget : IDataWindowWidget
|
internal class AddonWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
private string inputAddonName = string.Empty;
|
private string inputAddonName = string.Empty;
|
||||||
private int inputAddonIndex;
|
private int inputAddonIndex;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
using Dalamud.Bindings.ImGui;
|
using Dalamud.Bindings.ImGui;
|
||||||
using Dalamud.Game;
|
using Dalamud.Game;
|
||||||
|
using Dalamud.Interface.Utility.Raii;
|
||||||
using Dalamud.Utility;
|
using Dalamud.Utility;
|
||||||
|
|
||||||
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
|
|
@ -15,7 +16,7 @@ internal class AddressesWidget : IDataWindowWidget
|
||||||
private nint sigResult = nint.Zero;
|
private nint sigResult = nint.Zero;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "address" };
|
public string[]? CommandShortcuts { get; init; } = ["address"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "Addresses";
|
public string DisplayName { get; init; } = "Addresses";
|
||||||
|
|
@ -46,22 +47,24 @@ internal class AddressesWidget : IDataWindowWidget
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.Text($"Result: {this.sigResult.ToInt64():X}");
|
ImGui.AlignTextToFramePadding();
|
||||||
|
ImGui.Text($"Result: {this.sigResult:X}");
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
if (ImGui.Button($"C##{this.sigResult.ToInt64():X}"))
|
if (ImGui.Button($"C##{this.sigResult:X}"))
|
||||||
ImGui.SetClipboardText(this.sigResult.ToInt64().ToString("X"));
|
ImGui.SetClipboardText($"{this.sigResult:X}");
|
||||||
|
|
||||||
foreach (var debugScannedValue in BaseAddressResolver.DebugScannedValues)
|
foreach (var debugScannedValue in BaseAddressResolver.DebugScannedValues)
|
||||||
{
|
{
|
||||||
ImGui.Text($"{debugScannedValue.Key}");
|
ImGui.Text($"{debugScannedValue.Key}");
|
||||||
foreach (var valueTuple in debugScannedValue.Value)
|
foreach (var valueTuple in debugScannedValue.Value)
|
||||||
{
|
{
|
||||||
ImGui.Text(
|
using var indent = ImRaii.PushIndent(10.0f);
|
||||||
$" {valueTuple.ClassName} - {Util.DescribeAddress(valueTuple.Address)}");
|
ImGui.AlignTextToFramePadding();
|
||||||
|
ImGui.Text($"{valueTuple.ClassName} - {Util.DescribeAddress(valueTuple.Address)}");
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
if (ImGui.Button($"C##{valueTuple.Address.ToInt64():X}"))
|
if (ImGui.Button($"C##{valueTuple.Address:X}"))
|
||||||
ImGui.SetClipboardText(valueTuple.Address.ToInt64().ToString("X"));
|
ImGui.SetClipboardText($"{valueTuple.Address:X}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using Dalamud.Bindings.ImGui;
|
using Dalamud.Bindings.ImGui;
|
||||||
using Dalamud.Game.ClientState.Aetherytes;
|
using Dalamud.Game.ClientState.Aetherytes;
|
||||||
|
using Dalamud.Interface.Utility.Raii;
|
||||||
|
|
||||||
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
|
|
||||||
|
|
@ -8,11 +9,13 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class AetherytesWidget : IDataWindowWidget
|
internal class AetherytesWidget : IDataWindowWidget
|
||||||
{
|
{
|
||||||
|
private const ImGuiTableFlags TableFlags = ImGuiTableFlags.ScrollY | ImGuiTableFlags.RowBg | ImGuiTableFlags.Borders;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public bool Ready { get; set; }
|
public bool Ready { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "aetherytes" };
|
public string[]? CommandShortcuts { get; init; } = ["aetherytes"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "Aetherytes";
|
public string DisplayName { get; init; } = "Aetherytes";
|
||||||
|
|
@ -26,7 +29,8 @@ internal class AetherytesWidget : IDataWindowWidget
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public void Draw()
|
public void Draw()
|
||||||
{
|
{
|
||||||
if (!ImGui.BeginTable("##aetheryteTable"u8, 11, ImGuiTableFlags.ScrollY | ImGuiTableFlags.RowBg | ImGuiTableFlags.Borders))
|
using var table = ImRaii.Table("##aetheryteTable"u8, 11, TableFlags);
|
||||||
|
if (!table.Success)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ImGui.TableSetupScrollFreeze(0, 1);
|
ImGui.TableSetupScrollFreeze(0, 1);
|
||||||
|
|
@ -84,7 +88,5 @@ internal class AetherytesWidget : IDataWindowWidget
|
||||||
ImGui.TableNextColumn(); // Apartment
|
ImGui.TableNextColumn(); // Apartment
|
||||||
ImGui.Text($"{info.IsApartment}");
|
ImGui.Text($"{info.IsApartment}");
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndTable();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,16 +23,16 @@ internal unsafe class AtkArrayDataBrowserWidget : IDataWindowWidget
|
||||||
private int selectedExtendArray;
|
private int selectedExtendArray;
|
||||||
|
|
||||||
private string searchTerm = string.Empty;
|
private string searchTerm = string.Empty;
|
||||||
private bool hideUnsetStringArrayEntries = false;
|
private bool hideUnsetStringArrayEntries;
|
||||||
private bool hideUnsetExtendArrayEntries = false;
|
private bool hideUnsetExtendArrayEntries;
|
||||||
private bool showTextAddress = false;
|
private bool showTextAddress;
|
||||||
private bool showMacroString = false;
|
private bool showMacroString;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public bool Ready { get; set; }
|
public bool Ready { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "atkarray" };
|
public string[]? CommandShortcuts { get; init; } = ["atkarray"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "Atk Array Data";
|
public string DisplayName { get; init; } = "Atk Array Data";
|
||||||
|
|
@ -153,17 +153,14 @@ internal unsafe class AtkArrayDataBrowserWidget : IDataWindowWidget
|
||||||
if (ImGui.IsItemHovered())
|
if (ImGui.IsItemHovered())
|
||||||
{
|
{
|
||||||
using var tooltip = ImRaii.Tooltip();
|
using var tooltip = ImRaii.Tooltip();
|
||||||
if (tooltip)
|
|
||||||
|
var raptureAtkUnitManager = RaptureAtkUnitManager.Instance();
|
||||||
|
for (var j = 0; j < array->SubscribedAddonsCount; j++)
|
||||||
{
|
{
|
||||||
var raptureAtkUnitManager = RaptureAtkUnitManager.Instance();
|
if (array->SubscribedAddons[j] == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
for (var j = 0; j < array->SubscribedAddonsCount; j++)
|
ImGui.Text(raptureAtkUnitManager->GetAddonById(array->SubscribedAddons[j])->NameString);
|
||||||
{
|
|
||||||
if (array->SubscribedAddons[j] == 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
ImGui.Text(raptureAtkUnitManager->GetAddonById(array->SubscribedAddons[j])->NameString);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -242,9 +239,9 @@ internal unsafe class AtkArrayDataBrowserWidget : IDataWindowWidget
|
||||||
|
|
||||||
var atkArrayDataHolder = RaptureAtkModule.Instance()->AtkArrayDataHolder;
|
var atkArrayDataHolder = RaptureAtkModule.Instance()->AtkArrayDataHolder;
|
||||||
|
|
||||||
using (var sidebarchild = ImRaii.Child("StringArraySidebar"u8, new Vector2(300, -1), false, ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoSavedSettings))
|
using (var sidebarChild = ImRaii.Child("StringArraySidebar"u8, new Vector2(300, -1), false, ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoSavedSettings))
|
||||||
{
|
{
|
||||||
if (sidebarchild)
|
if (sidebarChild)
|
||||||
{
|
{
|
||||||
ImGui.SetNextItemWidth(-1);
|
ImGui.SetNextItemWidth(-1);
|
||||||
ImGui.InputTextWithHint("##TextSearch"u8, "Search..."u8, ref this.searchTerm, 256, ImGuiInputTextFlags.AutoSelectAll);
|
ImGui.InputTextWithHint("##TextSearch"u8, "Search..."u8, ref this.searchTerm, 256, ImGuiInputTextFlags.AutoSelectAll);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ internal class BuddyListWidget : IDataWindowWidget
|
||||||
public bool Ready { get; set; }
|
public bool Ready { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string[]? CommandShortcuts { get; init; } = { "buddy", "buddylist" };
|
public string[]? CommandShortcuts { get; init; } = ["buddy", "buddylist"];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string DisplayName { get; init; } = "Buddy List";
|
public string DisplayName { get; init; } = "Buddy List";
|
||||||
|
|
@ -32,18 +32,65 @@ internal class BuddyListWidget : IDataWindowWidget
|
||||||
var buddyList = Service<BuddyList>.Get();
|
var buddyList = Service<BuddyList>.Get();
|
||||||
|
|
||||||
ImGui.Checkbox("Resolve GameData"u8, ref this.resolveGameData);
|
ImGui.Checkbox("Resolve GameData"u8, ref this.resolveGameData);
|
||||||
|
|
||||||
|
var companionBuddy = buddyList.CompanionBuddy;
|
||||||
|
if (companionBuddy == null)
|
||||||
{
|
{
|
||||||
var member = buddyList.CompanionBuddy;
|
ImGui.Text("[Companion] null"u8);
|
||||||
if (member == null)
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui.Text($"[Companion] {companionBuddy.Address:X} - {companionBuddy.EntityId} - {companionBuddy.DataID}");
|
||||||
|
if (this.resolveGameData)
|
||||||
{
|
{
|
||||||
ImGui.Text("[Companion] null"u8);
|
var gameObject = companionBuddy.GameObject;
|
||||||
|
if (gameObject == null)
|
||||||
|
{
|
||||||
|
ImGui.Text("GameObject was null"u8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Util.PrintGameObject(gameObject, "-", this.resolveGameData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
|
||||||
|
var petBuddy = buddyList.PetBuddy;
|
||||||
|
if (petBuddy == null)
|
||||||
|
{
|
||||||
|
ImGui.Text("[Pet] null"u8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui.Text($"[Pet] {petBuddy.Address:X} - {petBuddy.EntityId} - {petBuddy.DataID}");
|
||||||
|
if (this.resolveGameData)
|
||||||
{
|
{
|
||||||
ImGui.Text($"[Companion] {member.Address.ToInt64():X} - {member.EntityId} - {member.DataID}");
|
var gameObject = petBuddy.GameObject;
|
||||||
|
if (gameObject == null)
|
||||||
|
{
|
||||||
|
ImGui.Text("GameObject was null"u8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Util.PrintGameObject(gameObject, "-", this.resolveGameData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var count = buddyList.Length;
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
ImGui.Text("[BattleBuddy] None present"u8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (var i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
var member = buddyList[i];
|
||||||
|
ImGui.Text($"[BattleBuddy] [{i}] {member?.Address ?? 0:X} - {member?.EntityId ?? 0} - {member?.DataID ?? 0}");
|
||||||
if (this.resolveGameData)
|
if (this.resolveGameData)
|
||||||
{
|
{
|
||||||
var gameObject = member.GameObject;
|
var gameObject = member?.GameObject;
|
||||||
if (gameObject == null)
|
if (gameObject == null)
|
||||||
{
|
{
|
||||||
ImGui.Text("GameObject was null"u8);
|
ImGui.Text("GameObject was null"u8);
|
||||||
|
|
@ -55,57 +102,5 @@ internal class BuddyListWidget : IDataWindowWidget
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
var member = buddyList.PetBuddy;
|
|
||||||
if (member == null)
|
|
||||||
{
|
|
||||||
ImGui.Text("[Pet] null"u8);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ImGui.Text($"[Pet] {member.Address.ToInt64():X} - {member.EntityId} - {member.DataID}");
|
|
||||||
if (this.resolveGameData)
|
|
||||||
{
|
|
||||||
var gameObject = member.GameObject;
|
|
||||||
if (gameObject == null)
|
|
||||||
{
|
|
||||||
ImGui.Text("GameObject was null"u8);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Util.PrintGameObject(gameObject, "-", this.resolveGameData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
var count = buddyList.Length;
|
|
||||||
if (count == 0)
|
|
||||||
{
|
|
||||||
ImGui.Text("[BattleBuddy] None present"u8);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (var i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
var member = buddyList[i];
|
|
||||||
ImGui.Text($"[BattleBuddy] [{i}] {member?.Address.ToInt64():X} - {member?.EntityId} - {member?.DataID}");
|
|
||||||
if (this.resolveGameData)
|
|
||||||
{
|
|
||||||
var gameObject = member?.GameObject;
|
|
||||||
if (gameObject == null)
|
|
||||||
{
|
|
||||||
ImGui.Text("GameObject was null"u8);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Util.PrintGameObject(gameObject, "-", this.resolveGameData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue