refactor: update for api 9
This commit is contained in:
parent
51e0fe042b
commit
c7c93006d8
|
@ -6,17 +6,15 @@ using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Dalamud;
|
using Dalamud;
|
||||||
using Dalamud.Game;
|
using Dalamud.Game;
|
||||||
using Dalamud.Game.Command;
|
|
||||||
using Dalamud.Hooking;
|
using Dalamud.Hooking;
|
||||||
using Dalamud.IoC;
|
using Dalamud.IoC;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
|
using Dalamud.Plugin.Services;
|
||||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||||
|
|
||||||
namespace TheGreatSeparator {
|
namespace TheGreatSeparator {
|
||||||
// ReSharper disable once ClassNeverInstantiated.Global
|
// ReSharper disable once ClassNeverInstantiated.Global
|
||||||
public class TheGreatSeparator : IDalamudPlugin {
|
public class TheGreatSeparator : IDalamudPlugin {
|
||||||
public string Name => "The Great Separator";
|
|
||||||
|
|
||||||
private static class Signatures {
|
private static class Signatures {
|
||||||
internal const string ShowFlyText = "E8 ?? ?? ?? ?? FF C7 41 D1 C7";
|
internal const string ShowFlyText = "E8 ?? ?? ?? ?? FF C7 41 D1 C7";
|
||||||
internal const string SprintfNumber = "48 83 EC 28 44 8B C9";
|
internal const string SprintfNumber = "48 83 EC 28 44 8B C9";
|
||||||
|
@ -44,10 +42,13 @@ namespace TheGreatSeparator {
|
||||||
internal DalamudPluginInterface Interface { get; init; } = null!;
|
internal DalamudPluginInterface Interface { get; init; } = null!;
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal CommandManager CommandManager { get; init; } = null!;
|
internal ICommandManager CommandManager { get; init; } = null!;
|
||||||
|
|
||||||
[PluginService]
|
[PluginService]
|
||||||
internal SigScanner SigScanner { get; init; } = null!;
|
internal ISigScanner SigScanner { get; init; } = null!;
|
||||||
|
|
||||||
|
[PluginService]
|
||||||
|
internal IGameInteropProvider GameInteropProvider { get; init; } = null!;
|
||||||
|
|
||||||
internal Configuration Config { get; }
|
internal Configuration Config { get; }
|
||||||
internal PluginUi Ui { get; }
|
internal PluginUi Ui { get; }
|
||||||
|
@ -66,12 +67,12 @@ namespace TheGreatSeparator {
|
||||||
this.Commands = new Commands(this);
|
this.Commands = new Commands(this);
|
||||||
|
|
||||||
if (this.SigScanner.TryScanText(Signatures.ShowFlyText, out var showFlyPtr)) {
|
if (this.SigScanner.TryScanText(Signatures.ShowFlyText, out var showFlyPtr)) {
|
||||||
this.ShowFlyTextHook = new Hook<ShowFlyTextDelegate>(showFlyPtr + 9, this.ShowFlyTextDetour);
|
this.ShowFlyTextHook = this.GameInteropProvider.HookFromAddress<ShowFlyTextDelegate>(showFlyPtr + 9, this.ShowFlyTextDetour);
|
||||||
this.ShowFlyTextHook.Enable();
|
this.ShowFlyTextHook.Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.SigScanner.TryScanText(Signatures.SprintfNumber, out var sprintfPtr)) {
|
if (this.SigScanner.TryScanText(Signatures.SprintfNumber, out var sprintfPtr)) {
|
||||||
this.SprintfNumberHook = new Hook<SprintfNumberDelegate>(sprintfPtr, this.SprintfNumberDetour);
|
this.SprintfNumberHook = this.GameInteropProvider.HookFromAddress<SprintfNumberDelegate>(sprintfPtr, this.SprintfNumberDetour);
|
||||||
this.SprintfNumberHook.Enable();
|
this.SprintfNumberHook.Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue