diff --git a/Dalamud/Dalamud.csproj b/Dalamud/Dalamud.csproj index 869faf2da..30b5aafdf 100644 --- a/Dalamud/Dalamud.csproj +++ b/Dalamud/Dalamud.csproj @@ -6,7 +6,7 @@ XIV Launcher addon framework - 13.0.0.16 + 13.0.0.13 $(DalamudVersion) $(DalamudVersion) $(DalamudVersion) diff --git a/Dalamud/Data/DataManager.cs b/Dalamud/Data/DataManager.cs index f53195a2d..559bd84dc 100644 --- a/Dalamud/Data/DataManager.cs +++ b/Dalamud/Data/DataManager.cs @@ -84,11 +84,8 @@ internal sealed class DataManager : IInternalDisposableService, IDataManager dalamud.StartInfo.TroubleshootingPackData); // Don't fail for IndexIntegrityResult.Exception, since the check during launch has a very small timeout - // this.HasModifiedGameDataFiles = - // tsInfo?.IndexIntegrity is LauncherTroubleshootingInfo.IndexIntegrityResult.Failed; - - // TODO: Put above back when check in XL is fixed - this.HasModifiedGameDataFiles = false; + this.HasModifiedGameDataFiles = + tsInfo?.IndexIntegrity is LauncherTroubleshootingInfo.IndexIntegrityResult.Failed; if (this.HasModifiedGameDataFiles) Log.Verbose("Game data integrity check failed!\n{TsData}", dalamud.StartInfo.TroubleshootingPackData); diff --git a/Dalamud/Game/Inventory/GameInventory.cs b/Dalamud/Game/Inventory/GameInventory.cs index 5390c2707..535b84372 100644 --- a/Dalamud/Game/Inventory/GameInventory.cs +++ b/Dalamud/Game/Inventory/GameInventory.cs @@ -305,8 +305,7 @@ internal class GameInventory : IInternalDisposableService private GameInventoryItem[] CreateItemsArray(int length) { var items = new GameInventoryItem[length]; - foreach (ref var item in items.AsSpan()) - item = new(); + items.Initialize(); return items; } diff --git a/Dalamud/Interface/ImGuiBackend/InputHandler/Win32InputHandler.cs b/Dalamud/Interface/ImGuiBackend/InputHandler/Win32InputHandler.cs index ea60be98d..a9e9b5a0f 100644 --- a/Dalamud/Interface/ImGuiBackend/InputHandler/Win32InputHandler.cs +++ b/Dalamud/Interface/ImGuiBackend/InputHandler/Win32InputHandler.cs @@ -7,7 +7,6 @@ using System.Runtime.InteropServices; using System.Text; using Dalamud.Bindings.ImGui; -using Dalamud.Console; using Dalamud.Memory; using Dalamud.Utility; @@ -38,8 +37,6 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler private readonly WndProcDelegate wndProcDelegate; private readonly nint platformNamePtr; - private readonly IConsoleVariable cvLogMouseEvents; - private ViewportHandler viewportHandler; private int mouseButtonsDown; @@ -90,11 +87,6 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler this.cursors[(int)ImGuiMouseCursor.ResizeNwse] = LoadCursorW(default, IDC.IDC_SIZENWSE); this.cursors[(int)ImGuiMouseCursor.Hand] = LoadCursorW(default, IDC.IDC_HAND); this.cursors[(int)ImGuiMouseCursor.NotAllowed] = LoadCursorW(default, IDC.IDC_NO); - - this.cvLogMouseEvents = Service.Get().AddVariable( - "imgui.log_mouse_events", - "Log mouse events to console for debugging", - false); } /// @@ -275,23 +267,11 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler case WM.WM_XBUTTONDOWN: case WM.WM_XBUTTONDBLCLK: { - if (this.cvLogMouseEvents.Value) - { - Log.Verbose( - "Handle MouseDown {Btn} WantCaptureMouse: {Want} mouseButtonsDown: {Down}", - GetButton(msg, wParam), - io.WantCaptureMouse, - this.mouseButtonsDown); - } - var button = GetButton(msg, wParam); if (io.WantCaptureMouse) { if (this.mouseButtonsDown == 0 && GetCapture() == nint.Zero) - { SetCapture(hWndCurrent); - } - this.mouseButtonsDown |= 1 << button; io.AddMouseButtonEvent(button, true); return default(LRESULT); @@ -308,28 +288,12 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler case WM.WM_MBUTTONUP: case WM.WM_XBUTTONUP: { - if (this.cvLogMouseEvents.Value) - { - Log.Verbose( - "Handle MouseUp {Btn} WantCaptureMouse: {Want} mouseButtonsDown: {Down}", - GetButton(msg, wParam), - io.WantCaptureMouse, - this.mouseButtonsDown); - } - var button = GetButton(msg, wParam); - - // Need to check if we captured the button event away from the game here, otherwise the game might get - // a down event but no up event, causing the cursor to get stuck. - // Can happen if WantCaptureMouse becomes true in between down and up - if (io.WantCaptureMouse && (this.mouseButtonsDown & (1 << button)) != 0) + if (io.WantCaptureMouse) { this.mouseButtonsDown &= ~(1 << button); if (this.mouseButtonsDown == 0 && GetCapture() == hWndCurrent) - { ReleaseCapture(); - } - io.AddMouseButtonEvent(button, false); return default(LRESULT); } @@ -494,12 +458,7 @@ internal sealed unsafe partial class Win32InputHandler : IImGuiInputHandler // (This is the position you can get with ::GetCursorPos() or WM_MOUSEMOVE + ::ClientToScreen(). In theory adding viewport->Pos to a client position would also be the same.) var mousePos = mouseScreenPos; if ((io.ConfigFlags & ImGuiConfigFlags.ViewportsEnable) == 0) - { - // Use game window, otherwise, positions are calculated based on the focused window which might not be the game. - // Leads to offsets. - ClientToScreen(this.hWnd, &mousePos); - } - + ClientToScreen(focusedWindow, &mousePos); io.AddMousePosEvent(mousePos.x, mousePos.y); } diff --git a/Dalamud/Interface/ImGuiSeStringRenderer/Internal/SeStringRenderer.cs b/Dalamud/Interface/ImGuiSeStringRenderer/Internal/SeStringRenderer.cs index 4a8e6517e..397502b30 100644 --- a/Dalamud/Interface/ImGuiSeStringRenderer/Internal/SeStringRenderer.cs +++ b/Dalamud/Interface/ImGuiSeStringRenderer/Internal/SeStringRenderer.cs @@ -170,7 +170,7 @@ internal class SeStringRenderer : IServiceType // This also does argument validation for drawParams. Do it here. // `using var` makes a struct read-only, but we do want to modify it. - using var stateStorage = new SeStringDrawState( + var stateStorage = new SeStringDrawState( sss, drawParams, ThreadSafety.IsMainThread ? this.colorStackSetMainThread : new(this.colorStackSetMainThread.ColorTypes), diff --git a/Dalamud/Interface/ImGuiSeStringRenderer/SeStringDrawState.cs b/Dalamud/Interface/ImGuiSeStringRenderer/SeStringDrawState.cs index 5edf60e9d..c5aba26c1 100644 --- a/Dalamud/Interface/ImGuiSeStringRenderer/SeStringDrawState.cs +++ b/Dalamud/Interface/ImGuiSeStringRenderer/SeStringDrawState.cs @@ -10,7 +10,6 @@ using Dalamud.Interface.Utility; using Dalamud.Utility; using FFXIVClientStructs.FFXIV.Component.GUI; - using Lumina.Text.Payloads; using Lumina.Text.ReadOnly; @@ -18,7 +17,7 @@ namespace Dalamud.Interface.ImGuiSeStringRenderer; /// Calculated values from using ImGui styles. [StructLayout(LayoutKind.Sequential)] -public unsafe ref struct SeStringDrawState : IDisposable +public unsafe ref struct SeStringDrawState { private static readonly int ChannelCount = Enum.GetValues().Length; @@ -195,9 +194,6 @@ public unsafe ref struct SeStringDrawState : IDisposable /// Gets the text fragments. internal List Fragments { get; } - /// - public void Dispose() => this.splitter.ClearFreeMemory(); - /// Sets the current channel in the ImGui draw list splitter. /// Channel to switch to. [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/Dalamud/Interface/Internal/DalamudInterface.cs b/Dalamud/Interface/Internal/DalamudInterface.cs index b0fbeb6c5..bf55a5486 100644 --- a/Dalamud/Interface/Internal/DalamudInterface.cs +++ b/Dalamud/Interface/Internal/DalamudInterface.cs @@ -669,8 +669,6 @@ internal class DalamudInterface : IInternalDisposableService { using var barColor = ImRaii.PushColor(ImGuiCol.WindowBg, new Vector4(0.060f, 0.060f, 0.060f, 0.773f)); barColor.Push(ImGuiCol.MenuBarBg, Vector4.Zero); - barColor.Push(ImGuiCol.Border, Vector4.Zero); - barColor.Push(ImGuiCol.BorderShadow, Vector4.Zero); if (ImGui.BeginMainMenuBar()) { var pluginManager = Service.Get(); diff --git a/Dalamud/Interface/Windowing/Persistence/PresetModel.cs b/Dalamud/Interface/Windowing/Persistence/PresetModel.cs index 4ddf55e51..f7910e0b2 100644 --- a/Dalamud/Interface/Windowing/Persistence/PresetModel.cs +++ b/Dalamud/Interface/Windowing/Persistence/PresetModel.cs @@ -53,7 +53,6 @@ internal class PresetModel /// /// Gets a value indicating whether this preset is in the default state. /// - [JsonIgnore] public bool IsDefault => !this.IsPinned && !this.IsClickThrough && diff --git a/Dalamud/Interface/Windowing/Window.cs b/Dalamud/Interface/Windowing/Window.cs index 5a79a017a..48352daa2 100644 --- a/Dalamud/Interface/Windowing/Window.cs +++ b/Dalamud/Interface/Windowing/Window.cs @@ -84,7 +84,7 @@ public abstract class Window Click = _ => { this.internalIsClickthrough = false; - this.presetDirty = true; + this.presetDirty = false; ImGui.OpenPopup(AdditionsPopupName); }, Priority = int.MinValue, @@ -672,13 +672,16 @@ public abstract class Window Task.FromResult(tex)); } - if (isErrorStylePushed) + if (!this.hasError) { - Style.StyleModelV1.DalamudStandard.Pop(); + this.PostDraw(); } else { - this.PostDraw(); + if (isErrorStylePushed) + { + Style.StyleModelV1.DalamudStandard.Pop(); + } } this.PostHandlePreset(persistence); @@ -861,7 +864,7 @@ public abstract class Window foreach (var button in this.allButtons) { if (this.internalIsClickthrough && !button.AvailableClickthrough) - continue; + return; Vector2 position = new(titleBarRect.Max.X - padR - buttonSize, titleBarRect.Min.Y + style.FramePadding.Y); padR += buttonSize + style.ItemInnerSpacing.X;