From 2ab56db678939142f7a941e072eafc843fed8d2a Mon Sep 17 00:00:00 2001 From: Infi Date: Thu, 16 May 2024 17:12:56 +0200 Subject: [PATCH] Remove goto --- ChatTwo/GameFunctions/GameFunctions.cs | 10 ++-------- ChatTwo/Ui/SeStringDebugger.cs | 4 +++- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/ChatTwo/GameFunctions/GameFunctions.cs b/ChatTwo/GameFunctions/GameFunctions.cs index 96d995d..0f5157c 100755 --- a/ChatTwo/GameFunctions/GameFunctions.cs +++ b/ChatTwo/GameFunctions/GameFunctions.cs @@ -300,19 +300,13 @@ internal unsafe class GameFunctions : IDisposable private nint ResolveTextCommandPlaceholderDetour(nint a1, byte* placeholderText, byte a3, byte a4) { - if (ReplacementName == null) - goto Original; - var placeholder = MemoryHelper.ReadStringNullTerminated((nint) placeholderText); - if (placeholder != Placeholder) - goto Original; + if (ReplacementName == null || placeholder != Placeholder) + return ResolveTextCommandPlaceholderHook!.Original(a1, placeholderText, a3, a4); MemoryHelper.WriteString(PlaceholderNamePtr, ReplacementName); ReplacementName = null; return PlaceholderNamePtr; - - Original: - return ResolveTextCommandPlaceholderHook!.Original(a1, placeholderText, a3, a4); } } diff --git a/ChatTwo/Ui/SeStringDebugger.cs b/ChatTwo/Ui/SeStringDebugger.cs index 3d28426..54e6f18 100644 --- a/ChatTwo/Ui/SeStringDebugger.cs +++ b/ChatTwo/Ui/SeStringDebugger.cs @@ -5,6 +5,7 @@ using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling.Payloads; using Dalamud.Interface.Windowing; using ImGuiNET; + using DalamudPartyFinderPayload = Dalamud.Game.Text.SeStringHandling.Payloads.PartyFinderPayload; namespace ChatTwo.Ui; @@ -64,7 +65,7 @@ public class SeStringDebugger : Window ImGui.TextUnformatted("Nothing to show"); } - private static void ProcessPayloads(List payloads) + private void ProcessPayloads(List payloads) { foreach (var payload in payloads) { @@ -152,6 +153,7 @@ public class SeStringDebugger : Window RenderMetadataDictionary("Link AutoTranslatePayload", new Dictionary { { "Text", at.Text }, + { "Data", string.Join(" ", at.Encode().Select(b => b.ToString("X2"))) }, }); break; }