Update for SDK.

This commit is contained in:
Ottermandias 2025-03-27 12:04:38 +01:00
parent 279a861582
commit 03bb07a9c0
28 changed files with 178 additions and 147 deletions

View file

@ -1,4 +1,5 @@
using Dalamud.Interface;
using Dalamud.Interface.Textures;
using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
@ -18,7 +19,6 @@ public class LaunchButton : IDisposable, IUiService
private readonly string _fileName;
private readonly ITextureProvider _textureProvider;
private IDalamudTextureWrap? _icon;
private IReadOnlyTitleScreenMenuEntry? _entry;
/// <summary>
@ -30,7 +30,6 @@ public class LaunchButton : IDisposable, IUiService
_configWindow = ui;
_textureProvider = textureProvider;
_title = title;
_icon = null;
_entry = null;
_fileName = Path.Combine(pi.AssemblyLocation.DirectoryName!, "tsmLogo.png");
@ -39,7 +38,6 @@ public class LaunchButton : IDisposable, IUiService
public void Dispose()
{
_icon?.Dispose();
if (_entry != null)
_title.RemoveEntry(_entry);
}
@ -52,9 +50,8 @@ public class LaunchButton : IDisposable, IUiService
try
{
// TODO: update when API updated.
_icon = _textureProvider.GetFromFile(_fileName).RentAsync().Result;
if (_icon != null)
_entry = _title.AddEntry("Manage Penumbra", _icon, OnTriggered);
var icon = _textureProvider.GetFromFile(_fileName);
_entry = _title.AddEntry("Manage Penumbra", icon, OnTriggered);
_uiBuilder.Draw -= CreateEntry;
}

View file

@ -164,13 +164,14 @@ public unsafe class GlobalVariablesDrawer(
_schedulerFilterMapU8 = CiByteString.FromString(_schedulerFilterMap, out var t, MetaDataComputation.All, false)
? t
: CiByteString.Empty;
ImUtf8.Text($"{_shownResourcesMap} / {scheduler.Scheduler->NumResources}");
ImUtf8.Text($"{_shownResourcesMap} / {scheduler.Scheduler->Resources.LongCount}");
using var table = ImUtf8.Table("##SchedulerMapResources"u8, 10, ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingFixedFit,
-Vector2.UnitX);
if (!table)
return;
var map = (StdMap<int, Pointer<SchedulerResource>>*)&scheduler.Scheduler->Unknown;
// TODO Remove cast when it'll have the right type in CS.
var map = (StdMap<int, Pointer<SchedulerResource>>*)&scheduler.Scheduler->Resources;
var total = 0;
_shownResourcesMap = 0;
foreach (var (key, resourcePtr) in *map)
@ -214,7 +215,7 @@ public unsafe class GlobalVariablesDrawer(
_schedulerFilterListU8 = CiByteString.FromString(_schedulerFilterList, out var t, MetaDataComputation.All, false)
? t
: CiByteString.Empty;
ImUtf8.Text($"{_shownResourcesList} / {scheduler.Scheduler->NumResources}");
ImUtf8.Text($"{_shownResourcesList} / {scheduler.Scheduler->Resources.LongCount}");
using var table = ImUtf8.Table("##SchedulerListResources"u8, 10, ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingFixedFit,
-Vector2.UnitX);
if (!table)
@ -223,7 +224,7 @@ public unsafe class GlobalVariablesDrawer(
var resource = scheduler.Scheduler->Begin;
var total = 0;
_shownResourcesList = 0;
while (resource != null && total < (int)scheduler.Scheduler->NumResources)
while (resource != null && total < scheduler.Scheduler->Resources.Count)
{
if (_schedulerFilterList.Length is 0 || resource->Name.Buffer.IndexOf(_schedulerFilterListU8.Span) >= 0)
{