diff --git a/BDTHPlugin/BDTHPlugin.csproj b/BDTHPlugin/BDTHPlugin.csproj index bb94125..d5c6758 100644 --- a/BDTHPlugin/BDTHPlugin.csproj +++ b/BDTHPlugin/BDTHPlugin.csproj @@ -1,4 +1,4 @@ - + 1.6.9 net9.0-windows diff --git a/BDTHPlugin/BDTHPlugin.json b/BDTHPlugin/BDTHPlugin.json index 0d9a209..11d64f2 100644 --- a/BDTHPlugin/BDTHPlugin.json +++ b/BDTHPlugin/BDTHPlugin.json @@ -8,6 +8,6 @@ "RepoUrl": "https://github.com/LeonBlade/BDTHPlugin", "ApplicableVersion": "any", "Tags": ["bdth", "housing", "float", "place", "glitch", "furnishing", "LeonBlade"], - "DalamudApiLevel": 12, + "DalamudApiLevel": 13, "IconUrl": "https://github.com/LeonBlade/BDTHPlugin/raw/main/icon.png" } diff --git a/BDTHPlugin/Interface/Components/ItemControls.cs b/BDTHPlugin/Interface/Components/ItemControls.cs index 1b0c84c..12c7a4f 100644 --- a/BDTHPlugin/Interface/Components/ItemControls.cs +++ b/BDTHPlugin/Interface/Components/ItemControls.cs @@ -3,7 +3,7 @@ using Dalamud.Interface; using Dalamud.Interface.Components; -using ImGuiNET; +using Dalamud.Bindings.ImGui; namespace BDTHPlugin.Interface.Components { diff --git a/BDTHPlugin/Interface/Gizmo.cs b/BDTHPlugin/Interface/Gizmo.cs index 401bed2..76f2dd6 100644 --- a/BDTHPlugin/Interface/Gizmo.cs +++ b/BDTHPlugin/Interface/Gizmo.cs @@ -1,8 +1,8 @@ using System.Net.WebSockets; using System.Numerics; using Dalamud.Interface.Utility; -using ImGuiNET; -using ImGuizmoNET; +using Dalamud.Bindings.ImGui; +using Dalamud.Bindings.ImGuizmo; namespace BDTHPlugin.Interface { @@ -13,7 +13,7 @@ public class Gizmo private static unsafe bool CanEdit => Configuration.UseGizmo && Memory.CanEditItem() && Memory.HousingStructure->ActiveItem != null; - public MODE Mode = MODE.LOCAL; + public ImGuizmoMode Mode = ImGuizmoMode.Local; private Vector3 translate; private Vector3 rotation; @@ -82,7 +82,7 @@ private unsafe void DrawGizmo(Vector2 pos, Vector2 size) var snap = Configuration.DoSnap ? new(Configuration.Drag, Configuration.Drag, Configuration.Drag) : Vector3.Zero; - if (Manipulate(ref view.M11, ref proj.M11, OPERATION.TRANSLATE, Mode, ref matrix.M11, ref snap.X)) + if (Manipulate(ref view.M11, ref proj.M11, ImGuizmoOperation.Translate, Mode, ref matrix.M11, ref snap.X)) WriteMatrix(); ImGuizmo.SetID(-1); @@ -107,7 +107,7 @@ private void WriteMatrix() Memory.WritePosition(translate); } - private unsafe bool Manipulate(ref float view, ref float proj, OPERATION op, MODE mode, ref float matrix, ref float snap) + private unsafe bool Manipulate(ref float view, ref float proj, ImGuizmoOperation op, ImGuizmoMode mode, ref float matrix, ref float snap) { fixed (float* native_view = &view) { @@ -117,7 +117,7 @@ private unsafe bool Manipulate(ref float view, ref float proj, OPERATION op, MOD { fixed (float* native_snap = &snap) { - return ImGuizmoNative.ImGuizmo_Manipulate( + return ImGuizmo.Manipulate( native_view, native_proj, op, @@ -127,7 +127,7 @@ private unsafe bool Manipulate(ref float view, ref float proj, OPERATION op, MOD native_snap, null, null - ) != 0; + ) != false; } } } diff --git a/BDTHPlugin/Interface/Windows/DebugWindow.cs b/BDTHPlugin/Interface/Windows/DebugWindow.cs index e87dcce..cd386a4 100644 --- a/BDTHPlugin/Interface/Windows/DebugWindow.cs +++ b/BDTHPlugin/Interface/Windows/DebugWindow.cs @@ -1,6 +1,6 @@ using Dalamud.Interface.Windowing; -using ImGuiNET; +using Dalamud.Bindings.ImGui; namespace BDTHPlugin.Interface.Windows { diff --git a/BDTHPlugin/Interface/Windows/FurnitureList.cs b/BDTHPlugin/Interface/Windows/FurnitureList.cs index c5ab017..3b302af 100644 --- a/BDTHPlugin/Interface/Windows/FurnitureList.cs +++ b/BDTHPlugin/Interface/Windows/FurnitureList.cs @@ -3,7 +3,7 @@ using Dalamud.Interface.Windowing; -using ImGuiNET; +using Dalamud.Bindings.ImGui; namespace BDTHPlugin.Interface.Windows { diff --git a/BDTHPlugin/Interface/Windows/MainWindow.cs b/BDTHPlugin/Interface/Windows/MainWindow.cs index aa814ac..acbbef4 100644 --- a/BDTHPlugin/Interface/Windows/MainWindow.cs +++ b/BDTHPlugin/Interface/Windows/MainWindow.cs @@ -4,8 +4,8 @@ using Dalamud.Interface.Components; using Dalamud.Interface.Windowing; -using ImGuiNET; -using ImGuizmoNET; +using Dalamud.Bindings.ImGui; +using Dalamud.Bindings.ImGuizmo; using BDTHPlugin.Interface.Components; @@ -78,12 +78,12 @@ public unsafe override void Draw() DrawTooltip("Enables snapping of gizmo movement based on the drag value set below."); ImGui.SameLine(); - if (ImGuiComponents.IconButton(1, Gizmo.Mode == MODE.LOCAL ? Dalamud.Interface.FontAwesomeIcon.ArrowsAlt : Dalamud.Interface.FontAwesomeIcon.Globe)) - Gizmo.Mode = Gizmo.Mode == MODE.LOCAL ? MODE.WORLD : MODE.LOCAL; + if (ImGuiComponents.IconButton(1, Gizmo.Mode == ImGuizmoMode.Local ? Dalamud.Interface.FontAwesomeIcon.ArrowsAlt : Dalamud.Interface.FontAwesomeIcon.Globe)) + Gizmo.Mode = Gizmo.Mode == ImGuizmoMode.Local ? ImGuizmoMode.World : ImGuizmoMode.Local; DrawTooltip( [ - $"Mode: {(Gizmo.Mode == MODE.LOCAL ? "Local" : "World")}", + $"Mode: {(Gizmo.Mode == ImGuizmoMode.Local ? "Local" : "World")}", "Changes gizmo mode between local and world movement." ]); @@ -113,7 +113,7 @@ public unsafe override void Draw() } DrawTooltip("Sets the amount to change when dragging the controls, also influences the gizmo snap feature."); - var dummyHousingGoods = PluginMemory.HousingGoods != null && PluginMemory.HousingGoods->IsVisible; + var dummyHousingGoods = PluginMemory.HousingGoods != null && PluginMemory.HousingGoods.IsVisible; var dummyInventory = Memory.InventoryVisible; if (ImGui.Checkbox("Display in-game list", ref dummyHousingGoods)) diff --git a/BDTHPlugin/Plugin.cs b/BDTHPlugin/Plugin.cs index 33467bb..530861b 100644 --- a/BDTHPlugin/Plugin.cs +++ b/BDTHPlugin/Plugin.cs @@ -4,8 +4,8 @@ using Dalamud.IoC; using Dalamud.Plugin; using Dalamud.Plugin.Services; -using ImGuiNET; -using ImGuizmoNET; +using Dalamud.Bindings.ImGui; +using Dalamud.Bindings.ImGuizmo; using Lumina.Excel.Sheets; using System; using System.Collections.Generic; @@ -122,7 +122,7 @@ public static void DrawIcon(ushort icon, Vector2 size) if (icon < 65000) { var iconTexture = TextureProvider.GetFromGameIcon(new GameIconLookup(icon)); - ImGui.Image(iconTexture.GetWrapOrEmpty().ImGuiHandle, size); + ImGui.Image(iconTexture.GetWrapOrEmpty().Handle, size); } } diff --git a/BDTHPlugin/PluginMemory.cs b/BDTHPlugin/PluginMemory.cs index b9da888..1a1a64b 100644 --- a/BDTHPlugin/PluginMemory.cs +++ b/BDTHPlugin/PluginMemory.cs @@ -1,4 +1,5 @@ using FFXIVClientStructs.FFXIV.Component.GUI; +using Dalamud.Game.NativeWrapper; using System; using System.Collections.Generic; using System.Linq; @@ -34,35 +35,35 @@ public class PluginMemory public unsafe HousingObjectManager* CurrentManager => HousingModule->GetCurrentManager(); public unsafe Camera* Camera => &CameraManager.Instance()->GetActiveCamera()->CameraBase.SceneCamera; - public static unsafe AtkUnitBase* HousingLayout => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("HousingLayout", 1); - public static unsafe bool GamepadMode => !(HousingLayout != null && HousingLayout->IsVisible); - - public static unsafe AtkUnitBase* HousingGoods => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("HousingGoods", 1); - public static unsafe AtkUnitBase* InventoryExpansion => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryExpansion", 1); - public static unsafe AtkUnitBase* InventoryGrid0E => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryGrid0E", 1); - public static unsafe AtkUnitBase* InventoryGrid1E => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryGrid1E", 1); - public static unsafe AtkUnitBase* InventoryGrid2E => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryGrid2E", 1); - public static unsafe AtkUnitBase* InventoryGrid3E => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryGrid3E", 1); - public static unsafe AtkUnitBase* InventoryLarge => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryLarge", 1); - public static unsafe AtkUnitBase* Inventory => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("Inventory", 1); - public static unsafe AtkUnitBase* InventoryGrid0 => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryGrid0", 1); - public static unsafe AtkUnitBase* InventoryGrid1 => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryGrid1", 1); - public static unsafe AtkUnitBase* InventoryEventGrid0 => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryEventGrid0", 1); - public static unsafe AtkUnitBase* InventoryEventGrid1 => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryEventGrid1", 1); - public static unsafe AtkUnitBase* InventoryEventGrid2 => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryEventGrid2", 1); - public static unsafe AtkUnitBase* InventoryGrid => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryGrid", 1); - public static unsafe AtkUnitBase* InventoryEventGrid0E => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryEventGrid0E", 1); - public static unsafe AtkUnitBase* InventoryEventGrid1E => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryEventGrid1E", 1); - public static unsafe AtkUnitBase* InventoryEventGrid2E => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryEventGrid2E", 1); - public static unsafe AtkUnitBase* InventoryGridCrystal => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryGridCrystal", 1); - public static unsafe AtkUnitBase* InventoryCrystalGrid => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryCrystalGrid", 1); - public static unsafe AtkUnitBase* InventoryCrystalGrid2 => (AtkUnitBase*)Plugin.GameGui.GetAddonByName("InventoryCrystalGrid", 2); + public static unsafe AtkUnitBasePtr HousingLayout => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("HousingLayout", 1); + public static unsafe bool GamepadMode => !(HousingLayout != null && HousingLayout.IsVisible); + + public static unsafe AtkUnitBasePtr HousingGoods => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("HousingGoods", 1); + public static unsafe AtkUnitBasePtr InventoryExpansion => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryExpansion", 1); + public static unsafe AtkUnitBasePtr InventoryGrid0E => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryGrid0E", 1); + public static unsafe AtkUnitBasePtr InventoryGrid1E => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryGrid1E", 1); + public static unsafe AtkUnitBasePtr InventoryGrid2E => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryGrid2E", 1); + public static unsafe AtkUnitBasePtr InventoryGrid3E => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryGrid3E", 1); + public static unsafe AtkUnitBasePtr InventoryLarge => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryLarge", 1); + public static unsafe AtkUnitBasePtr Inventory => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("Inventory", 1); + public static unsafe AtkUnitBasePtr InventoryGrid0 => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryGrid0", 1); + public static unsafe AtkUnitBasePtr InventoryGrid1 => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryGrid1", 1); + public static unsafe AtkUnitBasePtr InventoryEventGrid0 => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryEventGrid0", 1); + public static unsafe AtkUnitBasePtr InventoryEventGrid1 => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryEventGrid1", 1); + public static unsafe AtkUnitBasePtr InventoryEventGrid2 => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryEventGrid2", 1); + public static unsafe AtkUnitBasePtr InventoryGrid => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryGrid", 1); + public static unsafe AtkUnitBasePtr InventoryEventGrid0E => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryEventGrid0E", 1); + public static unsafe AtkUnitBasePtr InventoryEventGrid1E => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryEventGrid1E", 1); + public static unsafe AtkUnitBasePtr InventoryEventGrid2E => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryEventGrid2E", 1); + public static unsafe AtkUnitBasePtr InventoryGridCrystal => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryGridCrystal", 1); + public static unsafe AtkUnitBasePtr InventoryCrystalGrid => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryCrystalGrid", 1); + public static unsafe AtkUnitBasePtr InventoryCrystalGrid2 => (AtkUnitBasePtr)Plugin.GameGui.GetAddonByName("InventoryCrystalGrid", 2); public unsafe bool InventoryVisible { - get => InventoryExpansion != null && InventoryExpansion->IsVisible || - InventoryLarge != null && InventoryLarge->IsVisible || - Inventory != null && Inventory->IsVisible; + get => InventoryExpansion != null && InventoryExpansion.IsVisible || + InventoryLarge != null && InventoryLarge.IsVisible || + Inventory != null && Inventory.IsVisible; set { @@ -70,19 +71,20 @@ public unsafe bool InventoryVisible return; // Determine which inventory is open assuming it's visible - if (InventoryExpansion->IsVisible || InventoryLarge->IsVisible || Inventory->IsVisible) + if (InventoryExpansion.IsVisible || InventoryLarge.IsVisible || Inventory.IsVisible) { - if (InventoryExpansion->IsVisible) inventoryType = 1; - else if (InventoryLarge->IsVisible) inventoryType = 2; - else if (Inventory->IsVisible) inventoryType = 3; + if (InventoryExpansion.IsVisible) inventoryType = 1; + else if (InventoryLarge.IsVisible) inventoryType = 2; + else if (Inventory.IsVisible) inventoryType = 3; } try { - switch (inventoryType) + switch (inventoryType) // these values are read only with the Dalamud 13 implementation of AtkUnitBasePtr { case 1: - InventoryExpansion->IsVisible = value; + /* + InventoryExpansion.Address.ToPointer->IsVisible = value; InventoryGrid0E->IsVisible = value; InventoryGrid1E->IsVisible = value; InventoryGrid2E->IsVisible = value; @@ -91,8 +93,10 @@ public unsafe bool InventoryVisible InventoryEventGrid1E->IsVisible = value; InventoryEventGrid2E->IsVisible = value; InventoryCrystalGrid2->IsVisible = value; + */ break; case 2: + /* InventoryLarge->IsVisible = value; InventoryGrid0->IsVisible = value; InventoryGrid1->IsVisible = value; @@ -100,11 +104,14 @@ public unsafe bool InventoryVisible InventoryEventGrid1->IsVisible = value; InventoryEventGrid2->IsVisible = value; InventoryCrystalGrid->IsVisible = value; + */ break; case 3: + /* Inventory->IsVisible = value; InventoryGrid->IsVisible = value; InventoryGridCrystal->IsVisible = value; + */ break; default: break; @@ -180,8 +187,8 @@ public PluginMemory() public unsafe void ShowFurnishingList(bool state) { - if (HousingGoods != null) - HousingGoods->IsVisible = state; + if (HousingGoods != null) + ;//HousingGoods->IsVisible = state;//same as above, this value is read only with dalamud 13 } public void ShowInventory(bool state) => InventoryVisible = state; @@ -196,8 +203,8 @@ public unsafe void Dispose() // Disable the place anywhere in case it's on. SetPlaceAnywhere(false); - // Enable the housing goods menu again. - if (HousingGoods != null) HousingGoods->IsVisible = true; + // Enable the housing goods menu again. + if (HousingGoods != null) ;// HousingGoods->IsVisible = true;//same as above, this value is read only with dalamud 13 } catch (Exception ex) { diff --git a/BDTHPlugin/Structs.cs b/BDTHPlugin/Structs.cs index 929a486..c5b43d6 100644 --- a/BDTHPlugin/Structs.cs +++ b/BDTHPlugin/Structs.cs @@ -55,11 +55,11 @@ public unsafe struct HousingModule public unsafe struct HousingGameObject { [FieldOffset(0x30)] public fixed byte Name[64]; - [FieldOffset(0x80)] public uint HousingRowId; - [FieldOffset(0xA0)] public float X; - [FieldOffset(0xA4)] public float Y; - [FieldOffset(0xA8)] public float Z; - [FieldOffset(0xF8)] public HousingItem* Item; + [FieldOffset(0x84)] public uint HousingRowId; + [FieldOffset(0xB0)] public float X; + [FieldOffset(0xB4)] public float Y; + [FieldOffset(0xB8)] public float Z; + [FieldOffset(0x108)] public HousingItem* Item; } [StructLayout(LayoutKind.Explicit)]