From a9af3e77da9567ee207666e0ef36542370f1baeb Mon Sep 17 00:00:00 2001 From: Zeffuro Date: Fri, 20 Feb 2026 23:53:47 +0100 Subject: [PATCH] Revert "Improves inventory window management." This reverts commit 58df62161196564fd6d2ba2929240232e6b73d62. Reverted because this hard crashes if you close Doman Donation box after closing inventory --- AetherBags/Monitoring/InventoryMonitor.cs | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/AetherBags/Monitoring/InventoryMonitor.cs b/AetherBags/Monitoring/InventoryMonitor.cs index 39de8ca..aaf0d68 100644 --- a/AetherBags/Monitoring/InventoryMonitor.cs +++ b/AetherBags/Monitoring/InventoryMonitor.cs @@ -28,6 +28,7 @@ public static unsafe class DragDropState public class InventoryMonitor : IDisposable { + public InventoryMonitor() { var bags = new[] { "Inventory", "InventoryLarge", "InventoryExpansion" }; @@ -41,8 +42,6 @@ public class InventoryMonitor : IDisposable Services.AddonLifecycle.RegisterListener(AddonEvent.PreFinalize, retainer, OnPreFinalize); Services.AddonLifecycle.RegisterListener(AddonEvent.PreFinalize, bags, OnInventoryPreFinalize); - Services.AddonLifecycle.RegisterListener(AddonEvent.PreHide, bags, OnInventoryPreHide); - // PreRefresh Handlers Services.AddonLifecycle.RegisterListener(AddonEvent.PreRefresh, bags, InventoryPreRefreshHandler); @@ -72,14 +71,6 @@ public class InventoryMonitor : IDisposable System.AddonInventoryWindow.Close(); } - private void OnInventoryPreHide(AddonEvent type, AddonArgs args) - { - if (System.Config.General.OpenWithGameInventory) - { - System.AddonInventoryWindow.Close(); - } - } - private unsafe void OpenInventories(string name) { GeneralSettings config = System.Config.General; @@ -201,10 +192,14 @@ public class InventoryMonitor : IDisposable if (config.OpenWithGameInventory) { - var addon = RaptureAtkUnitManager.Instance()->GetAddonByName(args.AddonName); - bool isCurrentlyVisible = addon != null && addon->IsVisible; + AtkValue* value1 = (AtkValue*)atkValues[1].Address; + int openTitleId = value1->Int; - if (!isCurrentlyVisible) + if (openTitleId == 0) + { + System.AddonInventoryWindow.Toggle(); + } + else { System.AddonInventoryWindow.Open(); } @@ -250,6 +245,6 @@ public class InventoryMonitor : IDisposable public void Dispose() { Services.GameInventory.InventoryChangedRaw -= OnInventoryChangedRaw; - Services.AddonLifecycle.UnregisterListener(OnPostSetup, OnPreFinalize, OnInventoryUpdate, OnSaddleBagUpdate, OnRetainerInventoryUpdate, OnInventoryPreFinalize, OnInventoryPreHide, InventoryPreRefreshHandler); + Services.AddonLifecycle.UnregisterListener(OnPostSetup, OnPreFinalize, OnInventoryUpdate, OnSaddleBagUpdate, OnRetainerInventoryUpdate, OnInventoryPreFinalize, InventoryPreRefreshHandler); } } \ No newline at end of file