diff --git a/ChatTwo/ChatTwo.csproj b/ChatTwo/ChatTwo.csproj index 88f534f..c6d96a2 100755 --- a/ChatTwo/ChatTwo.csproj +++ b/ChatTwo/ChatTwo.csproj @@ -1,6 +1,6 @@ - 1.26.2 + 1.26.3 net8.0-windows enable enable diff --git a/ChatTwo/ChatTwo.yaml b/ChatTwo/ChatTwo.yaml index 1180090..f6117cb 100755 --- a/ChatTwo/ChatTwo.yaml +++ b/ChatTwo/ChatTwo.yaml @@ -30,4 +30,5 @@ changelog: |- - Fix flags not working in reply mode - Force the main chat log to be always open - Prevent emotes inside auto translation - - Make Linkshells appear in selection again + - Linkshells appear in selection again + - Fix rotate mode not working for CW and Normal Linkshells diff --git a/ChatTwo/GameFunctions/Chat.cs b/ChatTwo/GameFunctions/Chat.cs index 12a5a52..3aac8ff 100755 --- a/ChatTwo/GameFunctions/Chat.cs +++ b/ChatTwo/GameFunctions/Chat.cs @@ -129,7 +129,7 @@ internal sealed unsafe class Chat : IDisposable if (lsInfo == null) return null; - // TODO APIX: lsInfo type changed to Entry + // TODO APIX: use infoproxychat var utf = instance->GetLinkshellName(*(ulong**)lsInfo); return utf == null ? null : MemoryHelper.ReadStringNullTerminated((nint) utf); } @@ -140,29 +140,24 @@ internal sealed unsafe class Chat : IDisposable return utf == null ? null : utf->ToString(); } + private static int GetRotateIdx(RotateMode mode) => mode switch + { + RotateMode.Forward => 1, + RotateMode.Reverse => -1, + _ => 0, + }; + internal static int RotateLinkshellHistory(RotateMode mode) { var uiModule = UIModule.Instance(); if (mode == RotateMode.None) uiModule->LinkshellCycle = -1; - return RotateLinkshellHistoryInternal(uiModule->RotateLinkshellHistory, mode); + return uiModule->RotateLinkshellHistory(GetRotateIdx(mode)); } internal static int RotateCrossLinkshellHistory(RotateMode mode) => - RotateLinkshellHistoryInternal(UIModule.Instance()->RotateCrossLinkshellHistory, mode); - - private static int RotateLinkshellHistoryInternal(Func func, RotateMode mode) - { - var idx = mode switch - { - RotateMode.Forward => 1, - RotateMode.Reverse => -1, - _ => 0, - }; - - return func(idx); - } + UIModule.Instance()->RotateCrossLinkshellHistory(GetRotateIdx(mode)); // This function looks up a channel's user-defined color. // If this function ever returns 0, it returns null instead. diff --git a/ChatTwo/Ui/ChatLogWindow.cs b/ChatTwo/Ui/ChatLogWindow.cs index 8531d88..29d88c1 100644 --- a/ChatTwo/Ui/ChatLogWindow.cs +++ b/ChatTwo/Ui/ChatLogWindow.cs @@ -188,7 +188,6 @@ public sealed class ChatLogWindow : Window } var mode = prevTemp == null ? RotateMode.None : info.Rotate; - if (info.Channel is InputChannel.Linkshell1 && info.Rotate != RotateMode.None) { var idx = GameFunctions.Chat.RotateLinkshellHistory(mode); @@ -692,15 +691,14 @@ public sealed class ChatLogWindow : Window var push = inputColour != null; using (ImRaii.PushColor(ImGuiCol.Text, push ? ColourUtil.RgbaToAbgr(inputColour!.Value) : 0, push)) { - if (Activate || FocusedPreview) + var isChatEnabled = activeTab is { InputDisabled: false }; + if (isChatEnabled && (Activate || FocusedPreview)) { FocusedPreview = false; ImGui.SetKeyboardFocusHere(); } var chatCopy = Chat; - - var isChatEnabled = activeTab is { InputDisabled: false }; using (ImRaii.Disabled(!isChatEnabled)) { var flags = InputFlags | (!isChatEnabled ? ImGuiInputTextFlags.ReadOnly : ImGuiInputTextFlags.None);