refactor: update for 5.5
This commit is contained in:
parent
242f9876ce
commit
d4423854eb
|
@ -55,7 +55,7 @@ namespace XivCommon.Functions {
|
|||
throw new InvalidOperationException("PartyFinder hooks are not enabled");
|
||||
}
|
||||
|
||||
// Updated 5.41
|
||||
// Updated 5.5
|
||||
const int categoryOffset = 10_655;
|
||||
|
||||
if (this.PartyFinderAgent == IntPtr.Zero) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Dalamud.Game;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Plugin;
|
||||
using XivCommon.Functions;
|
||||
|
||||
namespace XivCommon {
|
||||
|
@ -9,11 +7,7 @@ namespace XivCommon {
|
|||
/// A class containing game functions
|
||||
/// </summary>
|
||||
public class GameFunctions : IDisposable {
|
||||
private IntPtr UiModulePtr { get; }
|
||||
|
||||
private delegate IntPtr GetUiModuleDelegate(IntPtr basePtr);
|
||||
|
||||
private GetUiModuleDelegate InternalGetUiModule { get; }
|
||||
private DalamudPluginInterface Interface { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Chat functions
|
||||
|
@ -30,15 +24,11 @@ namespace XivCommon {
|
|||
/// </summary>
|
||||
public BattleTalk BattleTalk { get; }
|
||||
|
||||
internal GameFunctions(Hooks hooks, SigScanner scanner, SeStringManager seStringManager) {
|
||||
this.UiModulePtr = scanner.GetStaticAddressFromSig("48 8B 0D ?? ?? ?? ?? 48 8D 54 24 ?? 48 83 C1 10 E8 ?? ?? ?? ??");
|
||||
|
||||
var getUiModulePtr = scanner.ScanText("E8 ?? ?? ?? ?? 83 3B 01");
|
||||
this.InternalGetUiModule = Marshal.GetDelegateForFunctionPointer<GetUiModuleDelegate>(getUiModulePtr);
|
||||
|
||||
this.Chat = new Chat(this, scanner);
|
||||
this.PartyFinder = new PartyFinder(scanner, hooks.HasFlag(Hooks.PartyFinder));
|
||||
this.BattleTalk = new BattleTalk(this, scanner, seStringManager, hooks.HasFlag(Hooks.BattleTalk));
|
||||
internal GameFunctions(Hooks hooks, DalamudPluginInterface @interface) {
|
||||
this.Interface = @interface;
|
||||
this.Chat = new Chat(this, @interface.TargetModuleScanner);
|
||||
this.PartyFinder = new PartyFinder(@interface.TargetModuleScanner, hooks.HasFlag(Hooks.PartyFinder));
|
||||
this.BattleTalk = new BattleTalk(this, @interface.TargetModuleScanner, @interface.SeStringManager, hooks.HasFlag(Hooks.BattleTalk));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@ -52,7 +42,7 @@ namespace XivCommon {
|
|||
/// </summary>
|
||||
/// <returns>Pointer</returns>
|
||||
public IntPtr GetUiModule() {
|
||||
return this.InternalGetUiModule(Marshal.ReadIntPtr(this.UiModulePtr));
|
||||
return this.Interface.Framework.Gui.GetUIModule();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace XivCommon {
|
|||
/// <param name="interface">The <see cref="DalamudPluginInterface"/> of the plugin constructing this base</param>
|
||||
/// <param name="hooks">Flags indicating which hooks to enable</param>
|
||||
public XivCommonBase(DalamudPluginInterface @interface, Hooks hooks = HooksExt.DefaultHooks) {
|
||||
this.Functions = new GameFunctions(hooks, @interface.TargetModuleScanner, @interface.SeStringManager);
|
||||
this.Functions = new GameFunctions(hooks, @interface);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
|
Loading…
Reference in New Issue
Block a user