6.4 Patch Rollup (#1206)

Fix Dalamud for 6.4, hopefully.
This commit is contained in:
KazWolfe 2023-05-23 11:41:59 -07:00 committed by GitHub
parent 71bf9fdcf2
commit dd1586d5d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 52 additions and 107 deletions

View file

@ -28,7 +28,7 @@
<ItemGroup>
<PackageReference Include="Lumina" Version="3.10.2" />
<PackageReference Include="Lumina.Excel" Version="6.3.2" />
<PackageReference Include="Lumina.Excel" Version="6.4.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.333">
<PrivateAssets>all</PrivateAssets>

View file

@ -68,7 +68,7 @@
<PackageReference Include="goaaats.Reloaded.Assembler" Version="1.0.14-goat.2" />
<PackageReference Include="JetBrains.Annotations" Version="2021.2.0" />
<PackageReference Include="Lumina" Version="3.10.2" />
<PackageReference Include="Lumina.Excel" Version="6.3.2" />
<PackageReference Include="Lumina.Excel" Version="6.4.0" />
<PackageReference Include="MinSharp" Version="1.0.4" />
<PackageReference Include="MonoModReorg.RuntimeDetour" Version="23.1.2-prerelease.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />

View file

@ -1,10 +1,9 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Dalamud.IoC;
using Dalamud.IoC.Internal;
using FFXIVClientStructs.FFXIV.Client.Game.UI;
using Serilog;
namespace Dalamud.Game.ClientState.Aetherytes;
@ -15,28 +14,23 @@ namespace Dalamud.Game.ClientState.Aetherytes;
[PluginInterface]
[InterfaceVersion("1.0")]
[ServiceManager.BlockingEarlyLoadedService]
public sealed partial class AetheryteList : IServiceType
public sealed unsafe partial class AetheryteList : IServiceType
{
[ServiceManager.ServiceDependency]
private readonly ClientState clientState = Service<ClientState>.Get();
private readonly ClientStateAddressResolver address;
private readonly UpdateAetheryteListDelegate updateAetheryteListFunc;
private readonly Telepo* telepoInstance = Telepo.Instance();
[ServiceManager.ServiceConstructor]
private AetheryteList()
{
this.address = this.clientState.AddressResolver;
this.updateAetheryteListFunc = Marshal.GetDelegateForFunctionPointer<UpdateAetheryteListDelegate>(this.address.UpdateAetheryteList);
Log.Verbose($"Teleport address 0x{this.address.Telepo.ToInt64():X}");
Log.Verbose($"Teleport address 0x{((nint)this.telepoInstance).ToInt64():X}");
}
private delegate void UpdateAetheryteListDelegate(IntPtr telepo, byte arg1);
/// <summary>
/// Gets the amount of Aetherytes the local player has unlocked.
/// </summary>
public unsafe int Length
public int Length
{
get
{
@ -45,21 +39,19 @@ public sealed partial class AetheryteList : IServiceType
this.Update();
if (TelepoStruct->TeleportList.First == TelepoStruct->TeleportList.Last)
if (this.telepoInstance->TeleportList.First == this.telepoInstance->TeleportList.Last)
return 0;
return (int)TelepoStruct->TeleportList.Size();
return (int)this.telepoInstance->TeleportList.Size();
}
}
private unsafe FFXIVClientStructs.FFXIV.Client.Game.UI.Telepo* TelepoStruct => (FFXIVClientStructs.FFXIV.Client.Game.UI.Telepo*)this.address.Telepo;
/// <summary>
/// Gets a Aetheryte Entry at the specified index.
/// </summary>
/// <param name="index">Index.</param>
/// <returns>A <see cref="AetheryteEntry"/> at the specified index.</returns>
public unsafe AetheryteEntry? this[int index]
public AetheryteEntry? this[int index]
{
get
{
@ -71,7 +63,7 @@ public sealed partial class AetheryteList : IServiceType
if (this.clientState.LocalPlayer == null)
return null;
return new AetheryteEntry(TelepoStruct->TeleportList.Get((ulong)index));
return new AetheryteEntry(this.telepoInstance->TeleportList.Get((ulong)index));
}
}
@ -81,7 +73,7 @@ public sealed partial class AetheryteList : IServiceType
if (this.clientState.LocalPlayer == null)
return;
this.updateAetheryteListFunc(this.address.Telepo, 0);
this.telepoInstance->UpdateAetheryteList();
}
}

View file

@ -62,11 +62,6 @@ public sealed class ClientStateAddressResolver : BaseAddressResolver
/// </summary>
public IntPtr ConditionFlags { get; private set; }
/// <summary>
/// Gets the address of the Telepo instance.
/// </summary>
public IntPtr Telepo { get; private set; }
// Functions
/// <summary>
@ -80,11 +75,6 @@ public sealed class ClientStateAddressResolver : BaseAddressResolver
/// </summary>
public IntPtr GamepadPoll { get; private set; }
/// <summary>
/// Gets the address of the method which updates the list of available teleport locations.
/// </summary>
public IntPtr UpdateAetheryteList { get; private set; }
/// <summary>
/// Scan for and setup any configured address pointers.
/// </summary>
@ -115,9 +105,5 @@ public sealed class ClientStateAddressResolver : BaseAddressResolver
this.TargetManager = sig.GetStaticAddressFromSig("48 8B 05 ?? ?? ?? ?? 48 8D 0D ?? ?? ?? ?? FF 50 ?? 48 85 DB");
this.GamepadPoll = sig.ScanText("40 ?? 57 41 ?? 48 81 EC ?? ?? ?? ?? 44 0F ?? ?? ?? ?? ?? ?? ?? 48 8B");
this.Telepo = sig.GetStaticAddressFromSig("48 8D 0D ?? ?? ?? ?? 48 8B 12");
this.UpdateAetheryteList = sig.ScanText("E8 ?? ?? ?? ?? 48 89 46 68 4C 8D 45 50");
}
}

View file

@ -96,7 +96,7 @@ public sealed class ChatGuiAddressResolver : BaseAddressResolver
// PopulateItemLinkObject = sig.ScanText("48 89 5C 24 08 57 48 83 EC 20 80 7A 06 00 48 8B DA 48 8B F9 74 14 48 8B CA E8 32 03 00 00 48 8B C8 E8 FA F2 B0 FF 8B C8 EB 1D 0F B6 42 14 8B 4A");
// PopulateItemLinkObject = sig.ScanText( "48 89 5C 24 08 57 48 83 EC 20 80 7A 06 00 48 8B DA 48 8B F9 74 14 48 8B CA E8 32 03 00 00 48 8B C8 E8 ?? ?? B0 FF 8B C8 EB 1D 0F B6 42 14 8B 4A"); 5.0
this.PopulateItemLinkObject = sig.ScanText("48 89 5C 24 08 57 48 83 EC 20 80 7A 06 00 48 8B DA 48 8B F9 74 14 48 8B CA E8 32 03 00 00 48 8B C8 E8 ?? ?? ?? FF 8B C8 EB 1D 0F B6 42 14 8B 4A");
this.PopulateItemLinkObject = sig.ScanText("48 89 5C 24 08 57 48 83 EC 20 80 7A 06 00 48 8B DA 48 8B F9 74 14 48 8B CA E8 32 03 00 00 48 8B C8 E8 ?? ?? ?? FF 8B C8 EB 1D 0F B6 42 14 8B 4A");
this.InteractableLinkClicked = sig.ScanText("E8 ?? ?? ?? ?? E9 ?? ?? ?? ?? 80 BB ?? ?? ?? ?? ?? 0F 85 ?? ?? ?? ?? 80 BB") + 9;
}

View file

@ -11,9 +11,14 @@ using Dalamud.Utility;
using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel;
using FFXIVClientStructs.FFXIV.Client.System.String;
using FFXIVClientStructs.FFXIV.Client.UI;
using FFXIVClientStructs.FFXIV.Common.Component.BGCollision;
using FFXIVClientStructs.FFXIV.Component.GUI;
using ImGuiNET;
using Serilog;
using SharpDX;
using Vector2 = System.Numerics.Vector2;
using Vector3 = System.Numerics.Vector3;
namespace Dalamud.Game.Gui;
@ -28,7 +33,6 @@ public sealed unsafe class GameGui : IDisposable, IServiceType
private readonly GameGuiAddressResolver address;
private readonly GetMatrixSingletonDelegate getMatrixSingleton;
private readonly ScreenToWorldNativeDelegate screenToWorldNative;
private readonly Hook<SetGlobalBgmDelegate> setGlobalBgmHook;
private readonly Hook<HandleItemHoverDelegate> handleItemHoverHook;
@ -67,8 +71,6 @@ public sealed unsafe class GameGui : IDisposable, IServiceType
this.getMatrixSingleton = Marshal.GetDelegateForFunctionPointer<GetMatrixSingletonDelegate>(this.address.GetMatrixSingleton);
this.screenToWorldNative = Marshal.GetDelegateForFunctionPointer<ScreenToWorldNativeDelegate>(this.address.ScreenToWorld);
this.toggleUiHideHook = Hook<ToggleUiHideDelegate>.FromAddress(this.address.ToggleUiHide, this.ToggleUiHideDetour);
this.utf8StringFromSequenceHook = Hook<Utf8StringFromSequenceDelegate>.FromAddress(this.address.Utf8StringFromSequence, this.Utf8StringFromSequenceDetour);
@ -79,9 +81,6 @@ public sealed unsafe class GameGui : IDisposable, IServiceType
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate IntPtr GetMatrixSingletonDelegate();
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
private unsafe delegate bool ScreenToWorldNativeDelegate(float* camPos, float* clipPos, float rayDistance, float* worldPos, int* unknown);
// Hooked delegates
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
@ -246,18 +245,15 @@ public sealed unsafe class GameGui : IDisposable, IServiceType
var matrixSingleton = this.getMatrixSingleton();
// Read current ViewProjectionMatrix plus game window size
var viewProjectionMatrix = default(SharpDX.Matrix);
var viewProjectionMatrix = default(Matrix);
float width, height;
unsafe
{
var rawMatrix = (float*)(matrixSingleton + 0x1b4).ToPointer();
var rawMatrix = (float*)(matrixSingleton + 0x1b4).ToPointer();
for (var i = 0; i < 16; i++, rawMatrix++)
viewProjectionMatrix[i] = *rawMatrix;
for (var i = 0; i < 16; i++, rawMatrix++)
viewProjectionMatrix[i] = *rawMatrix;
width = *rawMatrix;
height = *(rawMatrix + 1);
}
width = *rawMatrix;
height = *(rawMatrix + 1);
viewProjectionMatrix.Invert();
@ -277,38 +273,19 @@ public sealed unsafe class GameGui : IDisposable, IServiceType
var clipPos = camPosOne - camPos;
clipPos.Normalize();
bool isSuccess;
unsafe
// This array is larger than necessary because it contains more info than we currently use
var worldPosArray = default(RaycastHit);
// Theory: this is some kind of flag on what type of things the ray collides with
var unknown = stackalloc int[3]
{
var camPosArray = camPos.ToArray();
var clipPosArray = clipPos.ToArray();
0x4000,
0x4000,
0x0,
};
// This array is larger than necessary because it contains more info than we currently use
var worldPosArray = stackalloc float[32];
// Theory: this is some kind of flag on what type of things the ray collides with
var unknown = stackalloc int[3]
{
0x4000,
0x4000,
0x0,
};
fixed (float* pCamPos = camPosArray)
{
fixed (float* pClipPos = clipPosArray)
{
isSuccess = this.screenToWorldNative(pCamPos, pClipPos, rayDistance, worldPosArray, unknown);
}
}
worldPos = new Vector3
{
X = worldPosArray[0],
Y = worldPosArray[1],
Z = worldPosArray[2],
};
}
var isSuccess = BGCollisionModule.Raycast2(camPos.ToSystem(), clipPos.ToSystem(), rayDistance, &worldPosArray, unknown);
worldPos = worldPosArray.Point;
return isSuccess;
}
@ -317,7 +294,7 @@ public sealed unsafe class GameGui : IDisposable, IServiceType
/// Gets a pointer to the game's UI module.
/// </summary>
/// <returns>IntPtr pointing to UI module.</returns>
public unsafe IntPtr GetUIModule()
public IntPtr GetUIModule()
{
var framework = FFXIVClientStructs.FFXIV.Client.System.Framework.Framework.Instance();
if (framework == null)
@ -336,9 +313,9 @@ public sealed unsafe class GameGui : IDisposable, IServiceType
/// <param name="name">Name of addon to find.</param>
/// <param name="index">Index of addon to find (1-indexed).</param>
/// <returns>IntPtr.Zero if unable to find UI, otherwise IntPtr pointing to the start of the addon.</returns>
public unsafe IntPtr GetAddonByName(string name, int index = 1)
public IntPtr GetAddonByName(string name, int index = 1)
{
var atkStage = FFXIVClientStructs.FFXIV.Component.GUI.AtkStage.GetSingleton();
var atkStage = AtkStage.GetSingleton();
if (atkStage == null)
return IntPtr.Zero;
@ -360,7 +337,7 @@ public sealed unsafe class GameGui : IDisposable, IServiceType
/// <returns>A pointer to the agent interface.</returns>
public IntPtr FindAgentInterface(string addonName)
{
var addon = this.GetAddonByName(addonName, 1);
var addon = this.GetAddonByName(addonName);
return this.FindAgentInterface(addon);
}
@ -369,7 +346,7 @@ public sealed unsafe class GameGui : IDisposable, IServiceType
/// </summary>
/// <param name="addon">The addon address.</param>
/// <returns>A pointer to the agent interface.</returns>
public unsafe IntPtr FindAgentInterface(void* addon) => this.FindAgentInterface((IntPtr)addon);
public IntPtr FindAgentInterface(void* addon) => this.FindAgentInterface((IntPtr)addon);
/// <summary>
/// Find the agent associated with an addon, if possible.
@ -430,9 +407,9 @@ public sealed unsafe class GameGui : IDisposable, IServiceType
/// <returns>A value indicating whether or not the game is on the title screen.</returns>
internal bool IsOnTitleScreen()
{
var charaSelect = this.GetAddonByName("CharaSelect", 1);
var charaMake = this.GetAddonByName("CharaMake", 1);
var titleDcWorldMap = this.GetAddonByName("TitleDCWorldMap", 1);
var charaSelect = this.GetAddonByName("CharaSelect");
var charaMake = this.GetAddonByName("CharaMake");
var titleDcWorldMap = this.GetAddonByName("TitleDCWorldMap");
if (charaMake != nint.Zero || charaSelect != nint.Zero || titleDcWorldMap != nint.Zero)
return false;

View file

@ -47,11 +47,6 @@ internal sealed class GameGuiAddressResolver : BaseAddressResolver
/// </summary>
public IntPtr GetMatrixSingleton { get; private set; }
/// <summary>
/// Gets the address of the native ScreenToWorld method.
/// </summary>
public IntPtr ScreenToWorld { get; private set; }
/// <summary>
/// Gets the address of the native ToggleUiHide method.
/// </summary>
@ -66,13 +61,12 @@ internal sealed class GameGuiAddressResolver : BaseAddressResolver
protected override void Setup64Bit(SigScanner sig)
{
this.SetGlobalBgm = sig.ScanText("4C 8B 15 ?? ?? ?? ?? 4D 85 D2 74 58");
this.HandleItemHover = sig.ScanText("E8 ?? ?? ?? ?? 48 8B 5C 24 ?? 48 89 AE ?? ?? ?? ??");
this.HandleItemHover = sig.ScanText("E8 ?? ?? ?? ?? 48 8B 5C 24 ?? 48 89 AE ?? ?? ?? ?? 48 89 AE ?? ?? ?? ??");
this.HandleItemOut = sig.ScanText("48 89 5C 24 ?? 57 48 83 EC 20 48 8B FA 48 8B D9 4D");
this.HandleActionHover = sig.ScanText("E8 ?? ?? ?? ?? E9 ?? ?? ?? ?? 83 F8 0F");
this.HandleActionOut = sig.ScanText("48 89 5C 24 ?? 57 48 83 EC 20 48 8B DA 48 8B F9 4D 85 C0 74 1F");
this.HandleImm = sig.ScanText("E8 ?? ?? ?? ?? 84 C0 75 10 48 83 FF 09");
this.GetMatrixSingleton = sig.ScanText("E8 ?? ?? ?? ?? 48 8D 4C 24 ?? 48 89 4c 24 ?? 4C 8D 4D ?? 4C 8D 44 24 ??");
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");
}

View file

@ -56,7 +56,7 @@ internal sealed unsafe partial class DalamudAtkTweaks : IServiceType
var uiModuleRequestMainCommandAddress = sigScanner.ScanText("40 53 56 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 84 24 ?? ?? ?? ?? 48 8B 01 8B DA 48 8B F1 FF 90 ?? ?? ?? ??");
this.hookUiModuleRequestMainCommand = Hook<UiModuleRequestMainCommand>.FromAddress(uiModuleRequestMainCommandAddress, this.UiModuleRequestMainCommandDetour);
var atkUnitBaseReceiveGlobalEventAddress = sigScanner.ScanText("48 89 5C 24 ?? 48 89 7C 24 ?? 55 41 56 41 57 48 8B EC 48 83 EC 50 44 0F B7 F2 ");
var atkUnitBaseReceiveGlobalEventAddress = sigScanner.ScanText("48 89 5C 24 ?? 48 89 7C 24 ?? 55 41 56 41 57 48 8B EC 48 83 EC 50 44 0F B7 F2");
this.hookAtkUnitBaseReceiveGlobalEvent = Hook<AtkUnitBaseReceiveGlobalEvent>.FromAddress(atkUnitBaseReceiveGlobalEventAddress, this.AtkUnitBaseReceiveGlobalEventDetour);
this.locDalamudPlugins = Loc.Localize("SystemMenuPlugins", "Dalamud Plugins");

View file

@ -22,7 +22,7 @@ public sealed class LibcFunctionAddressResolver : BaseAddressResolver
/// <inheritdoc/>
protected override void Setup64Bit(SigScanner sig)
{
this.StdStringFromCstring = sig.ScanText("48895C2408 4889742410 57 4883EC20 488D4122 66C741200101 488901 498BD8");
this.StdStringDeallocate = sig.ScanText("80792100 7512 488B5108 41B833000000 488B09 E9??????00 C3");
this.StdStringFromCstring = sig.ScanText("48 89 5C 24 08 48 89 74 24 10 57 48 83 EC 20 48 8D 41 22 66 C7 41 20 01 01 48 89 01 49 8B D8");
this.StdStringDeallocate = sig.ScanText("80 79 21 00 75 12 48 8B 51 08 41 B8 33 00 00 00 48 8B 09 E9 ?? ?? ?? 00 C3");
}
}

View file

@ -22,7 +22,7 @@ public sealed class GameNetworkAddressResolver : BaseAddressResolver
{
// ProcessZonePacket = sig.ScanText("48 89 74 24 18 57 48 83 EC 50 8B F2 49 8B F8 41 0F B7 50 02 8B CE E8 ?? ?? 7A FF 0F B7 57 02 8D 42 89 3D 5F 02 00 00 0F 87 60 01 00 00 4C 8D 05");
// ProcessZonePacket = sig.ScanText("48 89 74 24 18 57 48 83 EC 50 8B F2 49 8B F8 41 0F B7 50 02 8B CE E8 ?? ?? 73 FF 0F B7 57 02 8D 42 ?? 3D ?? ?? 00 00 0F 87 60 01 00 00 4C 8D 05");
this.ProcessZonePacketDown = sig.ScanText("48 89 5C 24 ?? 56 48 83 EC 50 8B F2");
this.ProcessZonePacketDown = sig.ScanText("40 53 56 48 81 EC ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 33 C4 48 89 44 24 ?? 8B F2");
this.ProcessZonePacketUp = sig.ScanText("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 41 56 41 57 48 83 EC 70 8B 81 ?? ?? ?? ??");
}
}

View file

@ -19,7 +19,6 @@ internal unsafe class UiDebug
{
private const int UnitListCount = 18;
private readonly GetAtkStageSingleton getAtkStageSingleton;
private readonly bool[] selectedInList = new bool[UnitListCount];
private readonly string[] listNames = new string[UnitListCount]
{
@ -52,9 +51,6 @@ internal unsafe class UiDebug
/// </summary>
public UiDebug()
{
var sigScanner = Service<SigScanner>.Get();
var getSingletonAddr = sigScanner.ScanText("E8 ?? ?? ?? ?? 41 B8 01 00 00 00 48 8D 15 ?? ?? ?? ?? 48 8B 48 20 E8 ?? ?? ?? ?? 48 8B CF");
this.getAtkStageSingleton = Marshal.GetDelegateForFunctionPointer<GetAtkStageSingleton>(getSingletonAddr);
}
private delegate AtkStage* GetAtkStageSingleton();
@ -445,7 +441,7 @@ internal unsafe class UiDebug
{
var foundSelected = false;
var noResults = true;
var stage = this.getAtkStageSingleton();
var stage = AtkStage.GetSingleton();
var unitManagers = &stage->RaptureAtkUnitManager->AtkUnitManager.DepthLayerOneList;

@ -1 +1 @@
Subproject commit a00585972e44ccc6799091f8f53020b7f8c16f1d
Subproject commit af97552fa584073be9c2dba1830ec08a71b7dd93