diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 70c0b33ea..6de36a06e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,7 +36,7 @@ jobs: deploy_stg: name: Deploy dalamud-distrib staging - if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }} + if: ${{ github.event_name == 'push' }} needs: build runs-on: windows-latest steps: @@ -49,33 +49,52 @@ jobs: name: dalamud-artifact path: .\scratch + - name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch + - name: Generate dalamud-distrib version file shell: pwsh + env: + GH_BRANCH: ${{ steps.extract_branch.outputs.branch }} run: | Compress-Archive .\scratch\* .\canary.zip # Recreate the release zip + $branchName = $env:GH_BRANCH + + if ($branchName -eq "master") { + $branchName = "stg" + } + $dllBytes = [System.IO.File]::ReadAllBytes("$(Get-Location)\scratch\Dalamud.dll") $assembly = [System.Reflection.Assembly]::Load($dllBytes) $newVersion = $assembly.GetCustomAttributes([System.Reflection.AssemblyMetadataAttribute]) | Where { $_.GetType() -eq [System.Reflection.AssemblyMetadataAttribute] } | Select -First 1 | Select -ExpandProperty "Value" Remove-Item -Force -Recurse .\scratch - - $versionData = Get-Content .\stg\version | ConvertFrom-Json - $oldVersion = $versionData.AssemblyVersion - if ($oldVersion -eq $newVersion) { - Remove-Item .\canary.zip - } else { - Move-Item -Force .\canary.zip .\stg\latest.zip - $versionData.AssemblyVersion = $newVersion - $versionData | ConvertTo-Json -Compress | Out-File .\stg\version - } - echo "DVER=${newVersion}" >> $Env:GITHUB_ENV + if (Test-Path -Path $branchName) { + $versionData = Get-Content ".\${branchName}\version" | ConvertFrom-Json + $oldVersion = $versionData.AssemblyVersion + if ($oldVersion -eq $newVersion) { + Remove-Item .\canary.zip + } else { + Move-Item -Force ".\canary.zip" ".\${branchName}\latest.zip" + $versionData.AssemblyVersion = $newVersion + $versionData | ConvertTo-Json -Compress | Out-File ".\${branchName}\version" + } + + echo "DVER=${newVersion}" >> $Env:GITHUB_ENV + } else { + Write-Host "Deployment folder doesn't exist. Not doing anything." + Remove-Item .\canary.zip + } - name: Commit changes shell: bash env: DEPLOY_SSH: ${{ secrets.DEPLOY_SSH }} GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no" + GH_BRANCH: ${{ steps.extract_branch.outputs.branch }} run: | eval "$(ssh-agent -s)" ssh-add - <<< "${DEPLOY_SSH}" @@ -84,6 +103,6 @@ jobs: git config --global user.email "actions@github.com" git add . - git commit -m "[CI] Update staging for ${DVER}" || true + git commit -m "[CI] Update staging for ${DVER} on ${GH_BRANCH}" || true git push origin main || true diff --git a/Dalamud.CorePlugin/Dalamud.CorePlugin.csproj b/Dalamud.CorePlugin/Dalamud.CorePlugin.csproj index 3b7556af7..f2a3e537f 100644 --- a/Dalamud.CorePlugin/Dalamud.CorePlugin.csproj +++ b/Dalamud.CorePlugin/Dalamud.CorePlugin.csproj @@ -27,8 +27,8 @@ - - + + all diff --git a/Dalamud/Configuration/Internal/DalamudConfiguration.cs b/Dalamud/Configuration/Internal/DalamudConfiguration.cs index a5bbe6c9f..222dccab6 100644 --- a/Dalamud/Configuration/Internal/DalamudConfiguration.cs +++ b/Dalamud/Configuration/Internal/DalamudConfiguration.cs @@ -141,7 +141,7 @@ namespace Dalamud.Configuration.Internal /// * ...TTF fonts loaded with stb or FreeType are in linear space. /// * ...the game's prebaked AXIS fonts are in gamma space with gamma value of 1.4. /// - public float FontGamma { get; set; } = 1.4f; + public float FontGammaLevel { get; set; } = 1.4f; /// /// Gets or sets a value indicating the level of font resolution between 1 to 5. diff --git a/Dalamud/Dalamud.csproj b/Dalamud/Dalamud.csproj index 7000fda4a..0acb00e72 100644 --- a/Dalamud/Dalamud.csproj +++ b/Dalamud/Dalamud.csproj @@ -65,15 +65,15 @@ - - + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Dalamud/Game/ChatHandlers.cs b/Dalamud/Game/ChatHandlers.cs index 931ff8949..e1dcad965 100644 --- a/Dalamud/Game/ChatHandlers.cs +++ b/Dalamud/Game/ChatHandlers.cs @@ -243,11 +243,11 @@ namespace Dalamud.Game var assemblyVersion = Assembly.GetAssembly(typeof(ChatHandlers)).GetName().Version.ToString(); chatGui.Print(string.Format(Loc.Localize("DalamudWelcome", "Dalamud vD{0} loaded."), assemblyVersion) - + string.Format(Loc.Localize("PluginsWelcome", " {0} plugin(s) loaded."), pluginManager.InstalledPlugins.Count)); + + string.Format(Loc.Localize("PluginsWelcome", " {0} plugin(s) loaded."), pluginManager.InstalledPlugins.Count(x => x.IsLoaded))); if (configuration.PrintPluginsWelcomeMsg) { - foreach (var plugin in pluginManager.InstalledPlugins.OrderBy(plugin => plugin.Name)) + foreach (var plugin in pluginManager.InstalledPlugins.OrderBy(plugin => plugin.Name).Where(x => x.IsLoaded)) { chatGui.Print(string.Format(Loc.Localize("DalamudPluginLoaded", " 》 {0} v{1} loaded."), plugin.Name, plugin.Manifest.AssemblyVersion)); } diff --git a/Dalamud/Game/Gui/ContextMenus/ContextMenu.cs b/Dalamud/Game/Gui/ContextMenus/ContextMenu.cs index 44307b48a..3d02634ab 100644 --- a/Dalamud/Game/Gui/ContextMenus/ContextMenu.cs +++ b/Dalamud/Game/Gui/ContextMenus/ContextMenu.cs @@ -2,12 +2,13 @@ using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; - +using Dalamud.Game.Gui.ContextMenus.OldStructs; using Dalamud.Hooking; using Dalamud.IoC; using Dalamud.IoC.Internal; using Dalamud.Logging; using Dalamud.Memory; +using FFXIVClientStructs.FFXIV.Client.Game; using FFXIVClientStructs.FFXIV.Client.UI; using FFXIVClientStructs.FFXIV.Client.UI.Agent; using FFXIVClientStructs.FFXIV.Component.GUI; @@ -38,7 +39,7 @@ namespace Dalamud.Game.Gui.ContextMenus #endregion - private unsafe AgentContextInterface* currentAgentContextInterface; + private unsafe OldAgentContextInterface* currentAgentContextInterface; private IntPtr currentSubContextMenuTitle; @@ -67,15 +68,15 @@ namespace Dalamud.Game.Gui.ContextMenus #region Delegates - private unsafe delegate bool OpenSubContextMenuDelegate(AgentContext* agentContext); + private unsafe delegate bool OpenSubContextMenuDelegate(OldAgentContext* agentContext); - private unsafe delegate IntPtr ContextMenuOpeningDelegate(IntPtr a1, IntPtr a2, IntPtr a3, uint a4, IntPtr a5, AgentContextInterface* agentContextInterface, IntPtr a7, ushort a8); + private unsafe delegate IntPtr ContextMenuOpeningDelegate(IntPtr a1, IntPtr a2, IntPtr a3, uint a4, IntPtr a5, OldAgentContextInterface* agentContextInterface, IntPtr a7, ushort a8); private unsafe delegate bool ContextMenuOpenedDelegate(AddonContextMenu* addonContextMenu, int menuSize, AtkValue* atkValueArgs); private unsafe delegate bool ContextMenuItemSelectedDelegate(AddonContextMenu* addonContextMenu, int selectedIndex, byte a3); - private unsafe delegate bool SubContextMenuOpeningDelegate(AgentContext* agentContext); + private unsafe delegate bool SubContextMenuOpeningDelegate(OldAgentContext* agentContext); #endregion @@ -108,7 +109,7 @@ namespace Dalamud.Game.Gui.ContextMenus this.subContextMenuOpenedHook.Enable(); } - private static unsafe bool IsInventoryContext(AgentContextInterface* agentContextInterface) + private static unsafe bool IsInventoryContext(OldAgentContextInterface* agentContextInterface) { return agentContextInterface == AgentInventoryContext.Instance(); } @@ -121,7 +122,7 @@ namespace Dalamud.Game.Gui.ContextMenus } } - private unsafe IntPtr ContextMenuOpeningDetour(IntPtr a1, IntPtr a2, IntPtr a3, uint a4, IntPtr a5, AgentContextInterface* agentContextInterface, IntPtr a7, ushort a8) + private unsafe IntPtr ContextMenuOpeningDetour(IntPtr a1, IntPtr a2, IntPtr a3, uint a4, IntPtr a5, OldAgentContextInterface* agentContextInterface, IntPtr a7, ushort a8) { this.currentAgentContextInterface = agentContextInterface; return this.contextMenuOpeningHook!.Original(a1, a2, a3, a4, a5, agentContextInterface, a7, a8); @@ -212,12 +213,12 @@ namespace Dalamud.Game.Gui.ContextMenus } } - private unsafe bool SubContextMenuOpeningDetour(AgentContext* agentContext) + private unsafe bool SubContextMenuOpeningDetour(OldAgentContext* agentContext) { return this.SubContextMenuOpeningImplementation(agentContext) || this.subContextMenuOpeningHook.Original(agentContext); } - private unsafe bool SubContextMenuOpeningImplementation(AgentContext* agentContext) + private unsafe bool SubContextMenuOpeningImplementation(OldAgentContext* agentContext) { if (this.openSubContextMenu == null || this.selectedOpenSubContextMenuItem == null) { @@ -274,7 +275,7 @@ namespace Dalamud.Game.Gui.ContextMenus this.ContextMenuOpenedImplementation(addonContextMenu, ref atkValueCount, ref atkValues); } - private unsafe ContextMenuOpenedArgs? NotifyContextMenuOpened(AddonContextMenu* addonContextMenu, AgentContextInterface* agentContextInterface, string? title, ContextMenus.ContextMenuOpenedDelegate contextMenuOpenedDelegate, IEnumerable initialContextMenuItems) + private unsafe ContextMenuOpenedArgs? NotifyContextMenuOpened(AddonContextMenu* addonContextMenu, OldAgentContextInterface* agentContextInterface, string? title, ContextMenus.ContextMenuOpenedDelegate contextMenuOpenedDelegate, IEnumerable initialContextMenuItems) { var parentAddonName = this.GetParentAddonName(&addonContextMenu->AtkUnitBase); @@ -285,11 +286,11 @@ namespace Dalamud.Game.Gui.ContextMenus if (IsInventoryContext(agentContextInterface)) { var agentInventoryContext = (AgentInventoryContext*)agentContextInterface; - inventoryItemContext = new InventoryItemContext(agentInventoryContext->InventoryItemId, agentInventoryContext->InventoryItemCount, agentInventoryContext->InventoryItemIsHighQuality); + inventoryItemContext = new InventoryItemContext(agentInventoryContext->TargetDummyItem.ItemID, agentInventoryContext->TargetDummyItem.Quantity, agentInventoryContext->TargetDummyItem.Flags.HasFlag(InventoryItem.ItemFlags.HQ)); } else { - var agentContext = (AgentContext*)agentContextInterface; + var agentContext = (OldAgentContext*)agentContextInterface; uint? id = agentContext->GameObjectId; if (id == 0) diff --git a/Dalamud/Game/Gui/ContextMenus/ContextMenuOpenedArgs.cs b/Dalamud/Game/Gui/ContextMenus/ContextMenuOpenedArgs.cs index 05293bacd..4ecc3e4b9 100644 --- a/Dalamud/Game/Gui/ContextMenus/ContextMenuOpenedArgs.cs +++ b/Dalamud/Game/Gui/ContextMenus/ContextMenuOpenedArgs.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; - +using Dalamud.Game.Gui.ContextMenus.OldStructs; using Dalamud.Game.Text.SeStringHandling; using FFXIVClientStructs.FFXIV.Client.UI; using FFXIVClientStructs.FFXIV.Client.UI.Agent; @@ -18,7 +18,7 @@ namespace Dalamud.Game.Gui.ContextMenus /// The agent associated with the context menu. /// The the name of the parent addon associated with the context menu. /// The items in the context menu. - public ContextMenuOpenedArgs(AddonContextMenu* addon, AgentContextInterface* agent, string? parentAddonName, IEnumerable items) + public ContextMenuOpenedArgs(AddonContextMenu* addon, OldAgentContextInterface* agent, string? parentAddonName, IEnumerable items) { this.Addon = addon; this.Agent = agent; @@ -34,7 +34,7 @@ namespace Dalamud.Game.Gui.ContextMenus /// /// Gets the agent associated with the context menu. /// - public AgentContextInterface* Agent { get; } + public OldAgentContextInterface* Agent { get; } /// /// Gets the name of the parent addon associated with the context menu. diff --git a/Dalamud/Game/Gui/ContextMenus/ContextMenuReaderWriter.cs b/Dalamud/Game/Gui/ContextMenus/ContextMenuReaderWriter.cs index 82b8fb136..4a17406cb 100644 --- a/Dalamud/Game/Gui/ContextMenus/ContextMenuReaderWriter.cs +++ b/Dalamud/Game/Gui/ContextMenus/ContextMenuReaderWriter.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Numerics; using System.Runtime.InteropServices; - +using Dalamud.Game.Gui.ContextMenus.OldStructs; using Dalamud.Game.Text.SeStringHandling; using Dalamud.Logging; using Dalamud.Memory; @@ -19,7 +19,7 @@ namespace Dalamud.Game.Gui.ContextMenus /// internal unsafe class ContextMenuReaderWriter { - private readonly AgentContextInterface* agentContextInterface; + private readonly OldAgentContextInterface* agentContextInterface; private int atkValueCount; private AtkValue* atkValues; @@ -30,7 +30,7 @@ namespace Dalamud.Game.Gui.ContextMenus /// The AgentContextInterface to act upon. /// The number of ATK values to consider. /// Pointer to the array of ATK values. - public ContextMenuReaderWriter(AgentContextInterface* agentContextInterface, int atkValueCount, AtkValue* atkValues) + public ContextMenuReaderWriter(OldAgentContextInterface* agentContextInterface, int atkValueCount, AtkValue* atkValues) { PluginLog.Warning($"{(IntPtr)atkValues:X}"); @@ -306,17 +306,17 @@ namespace Dalamud.Game.Gui.ContextMenus byte action; if (this.IsInventoryContext) { - var actions = &((AgentInventoryContext*)this.agentContextInterface)->Actions; - action = *(actions + contextMenuItemAtkValueBaseIndex); + var actions = &((AgentInventoryContext*)this.agentContextInterface)->EventIdArray; + action = *actions[contextMenuItemAtkValueBaseIndex]; } else if (this.StructLayout is SubContextMenuStructLayout.Alternate) { - var redButtonActions = &((AgentContext*)this.agentContextInterface)->Items->RedButtonActions; + var redButtonActions = &((OldAgentContext*)this.agentContextInterface)->Items->RedButtonActions; action = (byte)*(redButtonActions + contextMenuItemIndex); } else { - var actions = &((AgentContext*)this.agentContextInterface)->Items->Actions; + var actions = &((OldAgentContext*)this.agentContextInterface)->Items->Actions; action = *(actions + contextMenuItemAtkValueBaseIndex); } @@ -438,28 +438,28 @@ namespace Dalamud.Game.Gui.ContextMenus if (this.IsInventoryContext) { - var actions = &((AgentInventoryContext*)this.agentContextInterface)->Actions; - *(actions + this.FirstContextMenuItemIndex + contextMenuItemIndex) = action; + var actions = &((AgentInventoryContext*)this.agentContextInterface)->EventIdArray; + *actions[this.FirstContextMenuItemIndex + contextMenuItemIndex] = action; } else if (this.StructLayout is SubContextMenuStructLayout.Alternate && this.FirstUnhandledAction != null) { // Some weird placeholder goes here - var actions = &((AgentContext*)this.agentContextInterface)->Items->Actions; + var actions = &((OldAgentContext*)this.agentContextInterface)->Items->Actions; *(actions + this.FirstContextMenuItemIndex + contextMenuItemIndex) = (byte)(this.FirstUnhandledAction.Value + contextMenuItemIndex); // Make sure there's one of these function pointers for every item. // The function needs to be the same, so we just copy the first one into every index. - var unkFunctionPointers = &((AgentContext*)this.agentContextInterface)->Items->UnkFunctionPointers; + var unkFunctionPointers = &((OldAgentContext*)this.agentContextInterface)->Items->UnkFunctionPointers; *(unkFunctionPointers + this.FirstContextMenuItemIndex + contextMenuItemIndex) = *(unkFunctionPointers + this.FirstContextMenuItemIndex); // The real action goes here - var redButtonActions = &((AgentContext*)this.agentContextInterface)->Items->RedButtonActions; + var redButtonActions = &((OldAgentContext*)this.agentContextInterface)->Items->RedButtonActions; *(redButtonActions + contextMenuItemIndex) = action; } else if (((AgentContext*)this.agentContextInterface)->Items != null) { // TODO: figure out why this branch is reached on inventory contexts and why Items is sometimes null. - var actions = &((AgentContext*)this.agentContextInterface)->Items->Actions; + var actions = &((OldAgentContext*)this.agentContextInterface)->Items->Actions; *(actions + this.FirstContextMenuItemIndex + contextMenuItemIndex) = action; } else diff --git a/Dalamud/Game/Gui/ContextMenus/OldStructs/OldAgentContext.cs b/Dalamud/Game/Gui/ContextMenus/OldStructs/OldAgentContext.cs new file mode 100644 index 000000000..d0c59b616 --- /dev/null +++ b/Dalamud/Game/Gui/ContextMenus/OldStructs/OldAgentContext.cs @@ -0,0 +1,33 @@ +using System.Runtime.InteropServices; + +using FFXIVClientStructs.FFXIV.Client.System.String; +using FFXIVClientStructs.FFXIV.Client.UI.Agent; +using FFXIVClientStructs.FFXIV.Component.GUI; + +namespace Dalamud.Game.Gui.ContextMenus.OldStructs; + +// TODO: This is transplanted from client structs before the rework. Need to take some time to sort all of this out soon. + +[StructLayout(LayoutKind.Explicit)] +public unsafe struct OldAgentContext +{ + public static OldAgentContext* Instance() => (OldAgentContext*)FFXIVClientStructs.FFXIV.Client.System.Framework.Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.Context); + + [FieldOffset(0x0)] public AgentInterface AgentInterface; + [FieldOffset(0x0)] public OldAgentContextInterface AgentContextInterface; + [FieldOffset(0xD18)] public unsafe OldAgentContextMenuItems* Items; + [FieldOffset(0xE08)] public Utf8String GameObjectName; + [FieldOffset(0xEE0)] public ulong GameObjectContentId; + [FieldOffset(0xEF0)] public uint GameObjectId; + [FieldOffset(0xF00)] public ushort GameObjectWorldId; +} + +[StructLayout(LayoutKind.Explicit)] +public struct OldAgentContextMenuItems +{ + [FieldOffset(0x0)] public ushort AtkValueCount; + [FieldOffset(0x8)] public AtkValue AtkValues; + [FieldOffset(0x428)] public byte Actions; + [FieldOffset(0x450)] public ulong UnkFunctionPointers; + [FieldOffset(0x598)] public ulong RedButtonActions; +} diff --git a/Dalamud/Game/Gui/ContextMenus/OldStructs/OldAgentContextInterface.cs b/Dalamud/Game/Gui/ContextMenus/OldStructs/OldAgentContextInterface.cs new file mode 100644 index 000000000..2dde22dfb --- /dev/null +++ b/Dalamud/Game/Gui/ContextMenus/OldStructs/OldAgentContextInterface.cs @@ -0,0 +1,17 @@ +using System.Runtime.InteropServices; + +using FFXIVClientStructs.FFXIV.Component.GUI; + +namespace Dalamud.Game.Gui.ContextMenus.OldStructs; + +// TODO: This is transplanted from client structs before the rework. Need to take some time to sort all of this out soon. + +[StructLayout(LayoutKind.Explicit)] +public unsafe struct OldAgentContextInterface +{ + [FieldOffset(0x0)] public AgentInterface AgentInterface; + [FieldOffset(0x670)] public unsafe byte SelectedIndex; + [FieldOffset(0x690)] public byte* Unk1; + [FieldOffset(0xD08)] public byte* SubContextMenuTitle; + [FieldOffset(0x1740)] public bool IsSubContextMenu; +} diff --git a/Dalamud/Game/Gui/GameGui.cs b/Dalamud/Game/Gui/GameGui.cs index 94e195ef0..10960677c 100644 --- a/Dalamud/Game/Gui/GameGui.cs +++ b/Dalamud/Game/Gui/GameGui.cs @@ -15,6 +15,7 @@ using Dalamud.IoC; using Dalamud.IoC.Internal; using Dalamud.Utility; using FFXIVClientStructs.FFXIV.Client.System.String; +using FFXIVClientStructs.FFXIV.Client.UI; using ImGuiNET; using Serilog; @@ -31,7 +32,6 @@ namespace Dalamud.Game.Gui private readonly GetMatrixSingletonDelegate getMatrixSingleton; private readonly ScreenToWorldNativeDelegate screenToWorldNative; - private readonly GetAgentModuleDelegate getAgentModule; private readonly Hook setGlobalBgmHook; private readonly Hook handleItemHoverHook; @@ -60,7 +60,6 @@ namespace Dalamud.Game.Gui Log.Verbose($"HandleItemHover address 0x{this.address.HandleItemHover.ToInt64():X}"); Log.Verbose($"HandleItemOut address 0x{this.address.HandleItemOut.ToInt64():X}"); Log.Verbose($"HandleImm address 0x{this.address.HandleImm.ToInt64():X}"); - Log.Verbose($"GetAgentModule address 0x{this.address.GetAgentModule.ToInt64():X}"); Service.Set(new ChatGui(this.address.ChatManager)); Service.Set(); @@ -85,8 +84,6 @@ namespace Dalamud.Game.Gui this.toggleUiHideHook = new Hook(this.address.ToggleUiHide, this.ToggleUiHideDetour); - this.getAgentModule = Marshal.GetDelegateForFunctionPointer(this.address.GetAgentModule); - this.utf8StringFromSequenceHook = new Hook(this.address.Utf8StringFromSequence, this.Utf8StringFromSequenceDetour); } @@ -397,14 +394,14 @@ namespace Dalamud.Game.Gui if (addon == IntPtr.Zero) return IntPtr.Zero; - var uiModule = Service.Get().GetUIModule(); - if (uiModule == IntPtr.Zero) + var uiModule = (UIModule*)Service.Get().GetUIModule(); + if (uiModule == null) { return IntPtr.Zero; } - var agentModule = this.getAgentModule(uiModule); - if (agentModule == IntPtr.Zero) + var agentModule = uiModule->GetAgentModule(); + if (agentModule == null) { return IntPtr.Zero; } @@ -412,18 +409,18 @@ namespace Dalamud.Game.Gui var unitBase = (FFXIVClientStructs.FFXIV.Component.GUI.AtkUnitBase*)addon; var id = unitBase->ParentID; if (id == 0) - id = unitBase->IDu; + id = unitBase->ID; if (id == 0) return IntPtr.Zero; - for (var i = 0; i < 380; i++) + // Patch 6.1, 398 agents + for (var i = 0; i < 398; i++) { - var agent = Marshal.ReadIntPtr(agentModule, 0x20 + (i * 8)); - if (agent == IntPtr.Zero) - continue; - if (Marshal.ReadInt32(agent, 0x20) == id) - return agent; + var agent = &agentModule->AgentArray[i]; + + if (agent->GetAddonID() == id) + return new IntPtr(agent); } return IntPtr.Zero; diff --git a/Dalamud/Game/Gui/GameGuiAddressResolver.cs b/Dalamud/Game/Gui/GameGuiAddressResolver.cs index adeaab1af..299d59ce2 100644 --- a/Dalamud/Game/Gui/GameGuiAddressResolver.cs +++ b/Dalamud/Game/Gui/GameGuiAddressResolver.cs @@ -71,11 +71,6 @@ namespace Dalamud.Game.Gui /// public IntPtr ToggleUiHide { get; private set; } - /// - /// Gets the address of the native GetAgentModule method. - /// - public IntPtr GetAgentModule { get; private set; } - /// /// Gets the address of the native Utf8StringFromSequence method. /// @@ -94,9 +89,6 @@ namespace Dalamud.Game.Gui this.ScreenToWorld = sig.ScanText("48 83 EC 48 48 8B 05 ?? ?? ?? ?? 4D 8B D1"); this.ToggleUiHide = sig.ScanText("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 0F B6 B9 ?? ?? ?? ?? B8 ?? ?? ?? ??"); this.Utf8StringFromSequence = sig.ScanText("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 8D 41 22 66 C7 41 ?? ?? ?? 48 89 01 49 8B D8"); - - var uiModuleVtableSig = sig.GetStaticAddressFromSig("48 8D 05 ?? ?? ?? ?? 4C 89 61 28"); - this.GetAgentModule = Marshal.ReadIntPtr(uiModuleVtableSig, 34 * IntPtr.Size); } /// diff --git a/Dalamud/Game/Internal/DalamudAtkTweaks.cs b/Dalamud/Game/Internal/DalamudAtkTweaks.cs index a39cbe998..111d1364c 100644 --- a/Dalamud/Game/Internal/DalamudAtkTweaks.cs +++ b/Dalamud/Game/Internal/DalamudAtkTweaks.cs @@ -138,18 +138,18 @@ namespace Dalamud.Game.Internal return; } - // the max size (hardcoded) is 0xE/15, but the system menu currently uses 0xC/12 + // the max size (hardcoded) is 0x11/17, but the system menu currently uses 0xC/12 // this is a just in case that doesnt really matter // see if we can add 2 entries - if (menuSize >= 0xD) + if (menuSize >= 0x11) { this.hookAgentHudOpenSystemMenu.Original(thisPtr, atkValueArgs, menuSize); return; } // atkValueArgs is actually an array of AtkValues used as args. all their UI code works like this. - // in this case, menu size is stored in atkValueArgs[4], and the next 15 slots are the MainCommand - // the 15 slots after that, if they exist, are the entry names, but they are otherwise pulled from MainCommand EXD + // in this case, menu size is stored in atkValueArgs[4], and the next 17 slots are the MainCommand + // the 17 slots after that, if they exist, are the entry names, but they are otherwise pulled from MainCommand EXD // reference the original function for more details :) // step 1) move all the current menu items down so we can put Dalamud at the top like it deserves @@ -173,9 +173,9 @@ namespace Dalamud.Game.Internal // step 3) create strings for them // since the game first checks for strings in the AtkValue argument before pulling them from the exd, if we create strings we dont have to worry // about hooking the exd reader, thank god - var firstStringEntry = &atkValueArgs[5 + 15]; + var firstStringEntry = &atkValueArgs[5 + 17]; this.atkValueChangeType(firstStringEntry, ValueType.String); - var secondStringEntry = &atkValueArgs[6 + 15]; + var secondStringEntry = &atkValueArgs[6 + 17]; this.atkValueChangeType(secondStringEntry, ValueType.String); const int color = 539; diff --git a/Dalamud/Interface/Internal/InterfaceManager.cs b/Dalamud/Interface/Internal/InterfaceManager.cs index 67a7027b3..21b5de793 100644 --- a/Dalamud/Interface/Internal/InterfaceManager.cs +++ b/Dalamud/Interface/Internal/InterfaceManager.cs @@ -213,7 +213,7 @@ namespace Dalamud.Interface.Internal /// /// Gets the font gamma value to use. /// - public float FontGamma => Math.Max(0.1f, this.FontGammaOverride.GetValueOrDefault(Service.Get().FontGamma)); + public float FontGamma => Math.Max(0.1f, this.FontGammaOverride.GetValueOrDefault(Service.Get().FontGammaLevel)); /// /// Gets or sets a value indicating whether to override configuration for FontResolutionLevel. diff --git a/Dalamud/Interface/Internal/Windows/SettingsWindow.cs b/Dalamud/Interface/Internal/Windows/SettingsWindow.cs index 1fc8a4586..4dffd0148 100644 --- a/Dalamud/Interface/Internal/Windows/SettingsWindow.cs +++ b/Dalamud/Interface/Internal/Windows/SettingsWindow.cs @@ -99,7 +99,7 @@ namespace Dalamud.Interface.Internal.Windows this.doMbCollect = configuration.IsMbCollect; this.globalUiScale = configuration.GlobalUiScale; - this.fontGamma = configuration.FontGamma; + this.fontGamma = configuration.FontGammaLevel; this.doUseAxisFontsFromGame = configuration.UseAxisFontsFromGame; this.fontResolutionLevel = configuration.FontResolutionLevel; this.doToggleUiHide = configuration.ToggleUiHide; @@ -197,7 +197,7 @@ namespace Dalamud.Interface.Internal.Windows var configuration = Service.Get(); var interfaceManager = Service.Get(); - var rebuildFont = interfaceManager.FontGamma != configuration.FontGamma; + var rebuildFont = interfaceManager.FontGamma != configuration.FontGammaLevel; ImGui.GetIO().FontGlobalScale = configuration.GlobalUiScale; interfaceManager.FontGammaOverride = null; @@ -930,7 +930,7 @@ namespace Dalamud.Interface.Internal.Windows configuration.UseAxisFontsFromGame = this.doUseAxisFontsFromGame; configuration.FontResolutionLevel = this.fontResolutionLevel; - configuration.FontGamma = this.fontGamma; + configuration.FontGammaLevel = this.fontGamma; // This is applied every frame in InterfaceManager::CheckViewportState() configuration.IsDisableViewport = !this.doViewport; diff --git a/Dalamud/Interface/Windowing/WindowSystem.cs b/Dalamud/Interface/Windowing/WindowSystem.cs index 0e3e2d5eb..b43194b22 100644 --- a/Dalamud/Interface/Windowing/WindowSystem.cs +++ b/Dalamud/Interface/Windowing/WindowSystem.cs @@ -106,7 +106,8 @@ namespace Dalamud.Interface.Windowing if (hasNamespace) ImGui.PushID(this.Namespace); - foreach (var window in this.windows) + // Shallow clone the list of windows so that we can edit it without modifying it while the loop is iterating + foreach (var window in this.windows.ToArray()) { #if DEBUG // Log.Verbose($"[WS{(hasNamespace ? "/" + this.Namespace : string.Empty)}] Drawing {window.WindowName}"); diff --git a/lib/FFXIVClientStructs b/lib/FFXIVClientStructs index db6e7c4a7..e2068a5fe 160000 --- a/lib/FFXIVClientStructs +++ b/lib/FFXIVClientStructs @@ -1 +1 @@ -Subproject commit db6e7c4a7b2638bedc2888c546009c7292c5de45 +Subproject commit e2068a5feda06ae596f3d69cac0e6ed370e3a533