Initial commit: AetherBags + KamiToolKit for FC Gitea
Debug Build and Test / Build against Latest Dalamud (push) Has been cancelled
Debug Build and Test / Build against Staging Dalamud (push) Has been cancelled

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-02-08 14:46:31 -05:00
commit 8db4ce6094
375 changed files with 34124 additions and 0 deletions
@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using KamiToolKit.Classes;
namespace KamiToolKit;
public abstract partial class NativeAddon : IDisposable {
private static readonly List<NativeAddon> CreatedAddons = [];
private bool isDisposed;
public virtual void Dispose() {
if (IsOverlayAddon) {
// Intentionally leak OverlayAddons,
// until Dalamud can implement OverlayAddons globally.
CreatedAddons.Remove(this);
GC.SuppressFinalize(this);
return;
}
if (!isDisposed) {
Log.Debug($"Disposing addon {GetType()}");
Close();
// Close will remove this node automatically on AtkUnitBase.Finalize,
// However, this is after the plugin unloads,
// and will trigger a warning in auto-dispose if we don't remove this now.
CreatedAddons.Remove(this);
GC.SuppressFinalize(this);
}
isDisposed = true;
DisposeCloseCallback();
}
~NativeAddon() => Dispose();
internal static void DisposeAddons() {
foreach (var addon in CreatedAddons.ToArray()) {
if (addon.IsOverlayAddon) continue;
Log.Warning($"Addon {addon.GetType()} was not disposed properly please ensure you call dispose at an appropriate time.");
Log.Debug($"Automatically disposing addon {addon.GetType()} as a safety measure.");
addon.Dispose();
}
CreatedAddons.Clear();
DisposeCloseCallback();
}
}