From 81099651bc477586900311f9923bff6e75c8b6c5 Mon Sep 17 00:00:00 2001 From: Anna Date: Fri, 19 Aug 2022 09:47:36 -0400 Subject: [PATCH] refactor: update for API 7 --- XivCommon/Functions/BattleTalk.cs | 2 +- XivCommon/Functions/ChatBubbles.cs | 4 ++-- XivCommon/Functions/NamePlates/NamePlates.cs | 2 +- XivCommon/Functions/PartyFinder.cs | 4 ++-- XivCommon/Functions/Talk.cs | 2 +- XivCommon/Functions/Tooltips/Tooltips.cs | 4 ++-- XivCommon/XivCommon.csproj | 8 ++++---- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/XivCommon/Functions/BattleTalk.cs b/XivCommon/Functions/BattleTalk.cs index ab1b2f4..d470455 100755 --- a/XivCommon/Functions/BattleTalk.cs +++ b/XivCommon/Functions/BattleTalk.cs @@ -39,7 +39,7 @@ namespace XivCommon.Functions { this.AddBattleTalk = Marshal.GetDelegateForFunctionPointer(addBattleTalkPtr); if (this.HookEnabled) { - this.AddBattleTalkHook = new Hook(addBattleTalkPtr, this.AddBattleTalkDetour); + this.AddBattleTalkHook = Hook.FromAddress(addBattleTalkPtr, this.AddBattleTalkDetour); this.AddBattleTalkHook.Enable(); } } diff --git a/XivCommon/Functions/ChatBubbles.cs b/XivCommon/Functions/ChatBubbles.cs index c216332..f8c2f57 100755 --- a/XivCommon/Functions/ChatBubbles.cs +++ b/XivCommon/Functions/ChatBubbles.cs @@ -64,12 +64,12 @@ namespace XivCommon.Functions { } if (scanner.TryScanText(Signatures.ChatBubbleOpen, out var openPtr, "chat bubbles open")) { - this.OpenChatBubbleHook = new Hook(openPtr, this.OpenChatBubbleDetour); + this.OpenChatBubbleHook = Hook.FromAddress(openPtr, this.OpenChatBubbleDetour); this.OpenChatBubbleHook.Enable(); } if (scanner.TryScanText(Signatures.ChatBubbleUpdate, out var updatePtr, "chat bubbles update")) { - this.UpdateChatBubbleHook = new Hook(updatePtr + 9, this.UpdateChatBubbleDetour); + this.UpdateChatBubbleHook = Hook.FromAddress(updatePtr + 9, this.UpdateChatBubbleDetour); this.UpdateChatBubbleHook.Enable(); } } diff --git a/XivCommon/Functions/NamePlates/NamePlates.cs b/XivCommon/Functions/NamePlates/NamePlates.cs index 4fda3c7..b8cb043 100755 --- a/XivCommon/Functions/NamePlates/NamePlates.cs +++ b/XivCommon/Functions/NamePlates/NamePlates.cs @@ -55,7 +55,7 @@ namespace XivCommon.Functions.NamePlates { if (scanner.TryScanText(Signatures.NamePlateUpdate, out var updatePtr)) { unsafe { - this._namePlateUpdateHook = new Hook(updatePtr, this.NamePlateUpdateDetour); + this._namePlateUpdateHook = Hook.FromAddress(updatePtr, this.NamePlateUpdateDetour); } this._namePlateUpdateHook.Enable(); diff --git a/XivCommon/Functions/PartyFinder.cs b/XivCommon/Functions/PartyFinder.cs index 10c7774..cae6368 100755 --- a/XivCommon/Functions/PartyFinder.cs +++ b/XivCommon/Functions/PartyFinder.cs @@ -73,13 +73,13 @@ namespace XivCommon.Functions { this.RequestPartyFinderListings = Marshal.GetDelegateForFunctionPointer(requestPfPtr); if (this.ListingsEnabled) { - this.RequestPfListingsHook = new Hook(requestPfPtr, this.OnRequestPartyFinderListings); + this.RequestPfListingsHook = Hook.FromAddress(requestPfPtr, this.OnRequestPartyFinderListings); this.RequestPfListingsHook.Enable(); } } if (this.JoinsEnabled && scanner.TryScanText(Signatures.JoinCrossParty, out var joinPtr, "Party Finder joins")) { - this.JoinPfHook = new Hook(joinPtr, this.JoinPfDetour); + this.JoinPfHook = Hook.FromAddress(joinPtr, this.JoinPfDetour); this.JoinPfHook.Enable(); } } diff --git a/XivCommon/Functions/Talk.cs b/XivCommon/Functions/Talk.cs index 9307b6a..69f3a4a 100755 --- a/XivCommon/Functions/Talk.cs +++ b/XivCommon/Functions/Talk.cs @@ -54,7 +54,7 @@ namespace XivCommon.Functions { } if (scanner.TryScanText(Signatures.ShowMessageBox, out var showMessageBoxPtr, "Talk")) { - this.AddonTalkV45Hook = new Hook(showMessageBoxPtr, this.AddonTalkV45Detour); + this.AddonTalkV45Hook = Hook.FromAddress(showMessageBoxPtr, this.AddonTalkV45Detour); this.AddonTalkV45Hook.Enable(); } } diff --git a/XivCommon/Functions/Tooltips/Tooltips.cs b/XivCommon/Functions/Tooltips/Tooltips.cs index 8a198a9..5d17b5a 100755 --- a/XivCommon/Functions/Tooltips/Tooltips.cs +++ b/XivCommon/Functions/Tooltips/Tooltips.cs @@ -78,7 +78,7 @@ namespace XivCommon.Functions.Tooltips { if (scanner.TryScanText(Signatures.AgentItemDetailUpdateTooltip, out var updateItemPtr, "Tooltips - Items")) { unsafe { - this.ItemUpdateTooltipHook = new Hook(updateItemPtr, this.ItemUpdateTooltipDetour); + this.ItemUpdateTooltipHook = Hook.FromAddress(updateItemPtr, this.ItemUpdateTooltipDetour); } this.ItemUpdateTooltipHook.Enable(); @@ -86,7 +86,7 @@ namespace XivCommon.Functions.Tooltips { if (scanner.TryScanText(Signatures.AgentActionDetailUpdateTooltip, out var updateActionPtr, "Tooltips - Actions")) { unsafe { - this.ActionGenerateTooltipHook = new Hook(updateActionPtr, this.ActionUpdateTooltipDetour); + this.ActionGenerateTooltipHook = Hook.FromAddress(updateActionPtr, this.ActionUpdateTooltipDetour); } this.ActionGenerateTooltipHook.Enable(); diff --git a/XivCommon/XivCommon.csproj b/XivCommon/XivCommon.csproj index 48aa023..cd986a3 100755 --- a/XivCommon/XivCommon.csproj +++ b/XivCommon/XivCommon.csproj @@ -1,7 +1,7 @@ - net5-windows + net6-windows latest true enable @@ -14,7 +14,7 @@ true XivCommon ascclemens - https://git.sr.ht/~jkcclemens/XivCommon + https://git.annaclemens.io/ascclemens/XivCommon A set of common functions, hooks, and events not included in Dalamud. MIT @@ -23,8 +23,8 @@ $(AppData)\XIVLauncher\addon\Hooks\dev - - $(HOME)/games/final-fantasy-xiv-online/drive_c/users/$(USER)/AppData/Roaming/XIVLauncher/addon/Hooks/dev + + $(DALAMUD_HOME)