Merge branch 'net5' into ContextNullCheck

This commit is contained in:
goaaats 2022-04-14 02:01:34 +02:00 committed by GitHub
commit 5741b23819
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 144 additions and 84 deletions

View file

@ -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

View file

@ -27,8 +27,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Lumina" Version="3.5.1" />
<PackageReference Include="Lumina.Excel" Version="6.0.2" />
<PackageReference Include="Lumina" Version="3.5.2" />
<PackageReference Include="Lumina.Excel" Version="6.1.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.333">
<PrivateAssets>all</PrivateAssets>

View file

@ -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.
/// </summary>
public float FontGamma { get; set; } = 1.4f;
public float FontGammaLevel { get; set; } = 1.4f;
/// <summary>
/// Gets or sets a value indicating the level of font resolution between 1 to 5.

View file

@ -65,15 +65,15 @@
<ItemGroup>
<PackageReference Include="CheapLoc" Version="1.1.6" />
<PackageReference Include="JetBrains.Annotations" Version="2021.2.0" />
<PackageReference Include="Lumina" Version="3.5.1" />
<PackageReference Include="Lumina.Excel" Version="6.0.2" />
<PackageReference Include="Lumina" Version="3.5.2" />
<PackageReference Include="Lumina.Excel" Version="6.1.1" />
<PackageReference Include="MinSharp" Version="1.0.4" />
<PackageReference Include="MonoMod.RuntimeDetour" Version="21.10.10.01" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Reloaded.Hooks" Version="3.2.3" />
<PackageReference Include="Reloaded.Hooks" Version="3.5.2" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.333">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

View file

@ -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));
}

View file

@ -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<ContextMenuItem> initialContextMenuItems)
private unsafe ContextMenuOpenedArgs? NotifyContextMenuOpened(AddonContextMenu* addonContextMenu, OldAgentContextInterface* agentContextInterface, string? title, ContextMenus.ContextMenuOpenedDelegate contextMenuOpenedDelegate, IEnumerable<ContextMenuItem> 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)

View file

@ -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
/// <param name="agent">The agent associated with the context menu.</param>
/// <param name="parentAddonName">The the name of the parent addon associated with the context menu.</param>
/// <param name="items">The items in the context menu.</param>
public ContextMenuOpenedArgs(AddonContextMenu* addon, AgentContextInterface* agent, string? parentAddonName, IEnumerable<ContextMenuItem> items)
public ContextMenuOpenedArgs(AddonContextMenu* addon, OldAgentContextInterface* agent, string? parentAddonName, IEnumerable<ContextMenuItem> items)
{
this.Addon = addon;
this.Agent = agent;
@ -34,7 +34,7 @@ namespace Dalamud.Game.Gui.ContextMenus
/// <summary>
/// Gets the agent associated with the context menu.
/// </summary>
public AgentContextInterface* Agent { get; }
public OldAgentContextInterface* Agent { get; }
/// <summary>
/// Gets the name of the parent addon associated with the context menu.

View file

@ -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
/// </summary>
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
/// <param name="agentContextInterface">The AgentContextInterface to act upon.</param>
/// <param name="atkValueCount">The number of ATK values to consider.</param>
/// <param name="atkValues">Pointer to the array of ATK values.</param>
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

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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<SetGlobalBgmDelegate> setGlobalBgmHook;
private readonly Hook<HandleItemHoverDelegate> 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<ChatGui>.Set(new ChatGui(this.address.ChatManager));
Service<PartyFinderGui>.Set();
@ -85,8 +84,6 @@ namespace Dalamud.Game.Gui
this.toggleUiHideHook = new Hook<ToggleUiHideDelegate>(this.address.ToggleUiHide, this.ToggleUiHideDetour);
this.getAgentModule = Marshal.GetDelegateForFunctionPointer<GetAgentModuleDelegate>(this.address.GetAgentModule);
this.utf8StringFromSequenceHook = new Hook<Utf8StringFromSequenceDelegate>(this.address.Utf8StringFromSequence, this.Utf8StringFromSequenceDetour);
}
@ -397,14 +394,14 @@ namespace Dalamud.Game.Gui
if (addon == IntPtr.Zero)
return IntPtr.Zero;
var uiModule = Service<GameGui>.Get().GetUIModule();
if (uiModule == IntPtr.Zero)
var uiModule = (UIModule*)Service<GameGui>.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;

View file

@ -71,11 +71,6 @@ namespace Dalamud.Game.Gui
/// </summary>
public IntPtr ToggleUiHide { get; private set; }
/// <summary>
/// Gets the address of the native GetAgentModule method.
/// </summary>
public IntPtr GetAgentModule { get; private set; }
/// <summary>
/// Gets the address of the native Utf8StringFromSequence method.
/// </summary>
@ -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);
}
/// <inheritdoc/>

View file

@ -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;

View file

@ -213,7 +213,7 @@ namespace Dalamud.Interface.Internal
/// <summary>
/// Gets the font gamma value to use.
/// </summary>
public float FontGamma => Math.Max(0.1f, this.FontGammaOverride.GetValueOrDefault(Service<DalamudConfiguration>.Get().FontGamma));
public float FontGamma => Math.Max(0.1f, this.FontGammaOverride.GetValueOrDefault(Service<DalamudConfiguration>.Get().FontGammaLevel));
/// <summary>
/// Gets or sets a value indicating whether to override configuration for FontResolutionLevel.

View file

@ -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<DalamudConfiguration>.Get();
var interfaceManager = Service<InterfaceManager>.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;

View file

@ -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}");

@ -1 +1 @@
Subproject commit db6e7c4a7b2638bedc2888c546009c7292c5de45
Subproject commit e2068a5feda06ae596f3d69cac0e6ed370e3a533