mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
chore: make sure that ctx menu code is 100% accurate to 6.0 version
This commit is contained in:
parent
08ad57aa6c
commit
ab8eb2dba2
4 changed files with 44 additions and 14 deletions
|
|
@ -183,6 +183,9 @@ namespace Dalamud.Game.Gui.ContextMenus
|
||||||
// TODO: For inventory sub context menus, we take only the last item -- the return item.
|
// TODO: For inventory sub context menus, we take only the last item -- the return item.
|
||||||
// This is because we're doing a hack to spawn a Second Tier sub context menu and then appropriating it.
|
// This is because we're doing a hack to spawn a Second Tier sub context menu and then appropriating it.
|
||||||
var contextMenuItems = contextMenuReaderWriter.Read();
|
var contextMenuItems = contextMenuReaderWriter.Read();
|
||||||
|
if (contextMenuItems == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (IsInventoryContext(this.currentAgentContextInterface) && this.selectedOpenSubContextMenuItem != null)
|
if (IsInventoryContext(this.currentAgentContextInterface) && this.selectedOpenSubContextMenuItem != null)
|
||||||
{
|
{
|
||||||
contextMenuItems = contextMenuItems.TakeLast(1).ToArray();
|
contextMenuItems = contextMenuItems.TakeLast(1).ToArray();
|
||||||
|
|
@ -400,6 +403,9 @@ namespace Dalamud.Game.Gui.ContextMenus
|
||||||
// Read the selected item directly from the game
|
// Read the selected item directly from the game
|
||||||
ContextMenuReaderWriter contextMenuReaderWriter = new ContextMenuReaderWriter(this.currentAgentContextInterface, addonContextMenu->AtkValuesCount, addonContextMenu->AtkValues);
|
ContextMenuReaderWriter contextMenuReaderWriter = new ContextMenuReaderWriter(this.currentAgentContextInterface, addonContextMenu->AtkValuesCount, addonContextMenu->AtkValues);
|
||||||
var gameContextMenuItems = contextMenuReaderWriter.Read();
|
var gameContextMenuItems = contextMenuReaderWriter.Read();
|
||||||
|
if (gameContextMenuItems == null)
|
||||||
|
return;
|
||||||
|
|
||||||
var gameSelectedItem = gameContextMenuItems.ElementAtOrDefault(selectedIndex);
|
var gameSelectedItem = gameContextMenuItems.ElementAtOrDefault(selectedIndex);
|
||||||
|
|
||||||
// This should be impossible
|
// This should be impossible
|
||||||
|
|
|
||||||
|
|
@ -277,7 +277,7 @@ namespace Dalamud.Game.Gui.ContextMenus
|
||||||
/// Read the context menu from the agent.
|
/// Read the context menu from the agent.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Read menu items.</returns>
|
/// <returns>Read menu items.</returns>
|
||||||
public GameContextMenuItem[] Read()
|
public GameContextMenuItem[]? Read()
|
||||||
{
|
{
|
||||||
var gameContextMenuItems = new List<GameContextMenuItem>();
|
var gameContextMenuItems = new List<GameContextMenuItem>();
|
||||||
for (var contextMenuItemIndex = 0; contextMenuItemIndex < this.ContextMenuItemCount; contextMenuItemIndex++)
|
for (var contextMenuItemIndex = 0; contextMenuItemIndex < this.ContextMenuItemCount; contextMenuItemIndex++)
|
||||||
|
|
@ -306,19 +306,24 @@ namespace Dalamud.Game.Gui.ContextMenus
|
||||||
byte action;
|
byte action;
|
||||||
if (this.IsInventoryContext)
|
if (this.IsInventoryContext)
|
||||||
{
|
{
|
||||||
var actions = &((AgentInventoryContext*)this.agentContextInterface)->EventIdArray;
|
var actions = &((OldAgentInventoryContext*)this.agentContextInterface)->Actions;
|
||||||
action = *actions[contextMenuItemAtkValueBaseIndex];
|
action = *(actions + contextMenuItemAtkValueBaseIndex);
|
||||||
}
|
}
|
||||||
else if (this.StructLayout is SubContextMenuStructLayout.Alternate)
|
else if (this.StructLayout is SubContextMenuStructLayout.Alternate)
|
||||||
{
|
{
|
||||||
var redButtonActions = &((OldAgentContext*)this.agentContextInterface)->Items->RedButtonActions;
|
var redButtonActions = &((OldAgentContext*)this.agentContextInterface)->Items->RedButtonActions;
|
||||||
action = (byte)*(redButtonActions + contextMenuItemIndex);
|
action = (byte)*(redButtonActions + contextMenuItemIndex);
|
||||||
}
|
}
|
||||||
else
|
else if (((OldAgentContext*)this.agentContextInterface)->Items != null)
|
||||||
{
|
{
|
||||||
var actions = &((OldAgentContext*)this.agentContextInterface)->Items->Actions;
|
var actions = &((OldAgentContext*)this.agentContextInterface)->Items->Actions;
|
||||||
action = *(actions + contextMenuItemAtkValueBaseIndex);
|
action = *(actions + contextMenuItemAtkValueBaseIndex);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PluginLog.Warning("Context Menu action failed, Items pointer was unexpectedly null.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// Get the has previous indicator flag
|
// Get the has previous indicator flag
|
||||||
var hasPreviousIndicatorFlagsAtkValue = &this.atkValues[this.HasPreviousIndicatorFlagsIndex];
|
var hasPreviousIndicatorFlagsAtkValue = &this.atkValues[this.HasPreviousIndicatorFlagsIndex];
|
||||||
|
|
@ -438,8 +443,8 @@ namespace Dalamud.Game.Gui.ContextMenus
|
||||||
|
|
||||||
if (this.IsInventoryContext)
|
if (this.IsInventoryContext)
|
||||||
{
|
{
|
||||||
var actions = &((AgentInventoryContext*)this.agentContextInterface)->EventIdArray;
|
var actions = &((OldAgentInventoryContext*)this.agentContextInterface)->Actions;
|
||||||
*actions[this.FirstContextMenuItemIndex + contextMenuItemIndex] = action;
|
*(actions + this.FirstContextMenuItemIndex + contextMenuItemIndex) = action;
|
||||||
}
|
}
|
||||||
else if (this.StructLayout is SubContextMenuStructLayout.Alternate && this.FirstUnhandledAction != null)
|
else if (this.StructLayout is SubContextMenuStructLayout.Alternate && this.FirstUnhandledAction != null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||||
|
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||||
|
|
||||||
|
namespace Dalamud.Game.Gui.ContextMenus.OldStructs;
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Explicit)]
|
||||||
|
public unsafe struct OldAgentInventoryContext
|
||||||
|
{
|
||||||
|
public static OldAgentInventoryContext* Instance() => (OldAgentInventoryContext*) FFXIVClientStructs.FFXIV.Client.System.Framework.Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.InventoryContext);
|
||||||
|
|
||||||
|
[FieldOffset(0x0)] public AgentInterface AgentInterface;
|
||||||
|
[FieldOffset(0x0)] public OldAgentContextInterface AgentContextInterface;
|
||||||
|
[FieldOffset(0x2C)] public uint FirstContextMenuItemAtkValueIndex;
|
||||||
|
[FieldOffset(0x30)] public uint ContextMenuItemCount;
|
||||||
|
[FieldOffset(0x38)] public AtkValue AtkValues;
|
||||||
|
[FieldOffset(0x558)] public unsafe byte Actions;
|
||||||
|
[FieldOffset(0x5A8)] public uint UnkFlags;
|
||||||
|
[FieldOffset(0x5B0)] public uint PositionX;
|
||||||
|
[FieldOffset(0x5B4)] public uint PositionY;
|
||||||
|
[FieldOffset(0x5F8)] public uint InventoryItemId;
|
||||||
|
[FieldOffset(0x5FC)] public uint InventoryItemCount;
|
||||||
|
[FieldOffset(0x604)] public bool InventoryItemIsHighQuality;
|
||||||
|
}
|
||||||
|
|
@ -19,7 +19,7 @@ namespace Dalamud.Interface.Internal.Windows
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the latest update warrants a changelog window.
|
/// Whether the latest update warrants a changelog window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string WarrantsChangelogForMajorMinor = "6.3.";
|
public const string WarrantsChangelogForMajorMinor = "6.4.";
|
||||||
|
|
||||||
private const string ChangeLog =
|
private const string ChangeLog =
|
||||||
@"• Added a new menu to the title screen which allows you to access the plugin installer and various other plugins before logging in.
|
@"• Added a new menu to the title screen which allows you to access the plugin installer and various other plugins before logging in.
|
||||||
|
|
@ -39,11 +39,7 @@ Thanks and have fun!";
|
||||||
@"• All of your plugins were disabled automatically, due to this update. This is normal.
|
@"• All of your plugins were disabled automatically, due to this update. This is normal.
|
||||||
• Open the plugin installer, then click 'update plugins'. Updated plugins should update and then re-enable themselves.
|
• Open the plugin installer, then click 'update plugins'. Updated plugins should update and then re-enable themselves.
|
||||||
=> Please keep in mind that not all of your plugins may already be updated for the new version.
|
=> Please keep in mind that not all of your plugins may already be updated for the new version.
|
||||||
=> If some plugins are displayed with a red cross in the 'Installed Plugins' tab, they may not yet be available.
|
=> If some plugins are displayed with a red cross in the 'Installed Plugins' tab, they may not yet be available.";
|
||||||
|
|
||||||
While we tested the released plugins considerably with a smaller set of people and believe that they are stable, we cannot guarantee to you that you will not run into crashes.
|
|
||||||
|
|
||||||
Considering current queue times, this is why we recommend that for now, you only use a set of plugins that are most essential to you, so you can go on playing the game instead of waiting endlessly.";
|
|
||||||
|
|
||||||
private readonly string assemblyVersion = Util.AssemblyVersion;
|
private readonly string assemblyVersion = Util.AssemblyVersion;
|
||||||
|
|
||||||
|
|
@ -82,13 +78,11 @@ Considering current queue times, this is why we recommend that for now, you only
|
||||||
|
|
||||||
ImGui.TextWrapped(ChangeLog);
|
ImGui.TextWrapped(ChangeLog);
|
||||||
|
|
||||||
/*
|
|
||||||
ImGuiHelpers.ScaledDummy(5);
|
ImGuiHelpers.ScaledDummy(5);
|
||||||
|
|
||||||
ImGui.TextColored(ImGuiColors.DalamudRed, " !!! ATTENTION !!!");
|
ImGui.TextColored(ImGuiColors.DalamudRed, " !!! ATTENTION !!!");
|
||||||
|
|
||||||
ImGui.TextWrapped(UpdatePluginsInfo);
|
ImGui.TextWrapped(UpdatePluginsInfo);
|
||||||
*/
|
|
||||||
|
|
||||||
ImGuiHelpers.ScaledDummy(10);
|
ImGuiHelpers.ScaledDummy(10);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue