From ac45afcf4c8087e1e4512788a311b823f84ef839 Mon Sep 17 00:00:00 2001 From: Infi Date: Sat, 13 Jul 2024 11:25:32 +0200 Subject: [PATCH] More keybind handling improvements --- ChatTwo/ChatTwo.yaml | 8 ++++---- ChatTwo/GameFunctions/Chat.cs | 14 +++++--------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/ChatTwo/ChatTwo.yaml b/ChatTwo/ChatTwo.yaml index fdc44ee..c6916b3 100755 --- a/ChatTwo/ChatTwo.yaml +++ b/ChatTwo/ChatTwo.yaml @@ -23,7 +23,7 @@ tags: - Replacement changelog: |- **Updates** - - Add hide button to chat [thanks dean] - - Fix incorrect parameter for print function [thanks Limiana] - - Improve keybind handling, maybe - - Loc updates + - More keybind handling improvements + - Add keybinds for switching tabs [thanks dean] + - Add auto hide after inactivity [default false, thanks dean] + - Fix auto scroll failing if custom cell padding is used [thanks zbee] diff --git a/ChatTwo/GameFunctions/Chat.cs b/ChatTwo/GameFunctions/Chat.cs index 421784f..902fd99 100755 --- a/ChatTwo/GameFunctions/Chat.cs +++ b/ChatTwo/GameFunctions/Chat.cs @@ -29,8 +29,9 @@ namespace ChatTwo.GameFunctions; internal sealed unsafe class Chat : IDisposable { // Functions + // Replace with [Signature("E8 ?? ?? ?? ?? 48 8D 4D A0 8B F8")] - private readonly delegate* unmanaged GetKeybindNative = null!; + private readonly delegate* unmanaged GetKeybindNative = null!; [Signature("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC ?? 48 8D B9 ?? ?? ?? ?? 33 C0")] private readonly delegate* unmanaged PrintTellNative = null!; @@ -537,16 +538,11 @@ internal sealed unsafe class Chat : IDisposable _ => VirtualKey.NO_KEY, }; - private Keybind? GetKeybind(string id) + private Keybind GetKeybind(string id) { - var agent = (nint) AgentModule.Instance()->GetAgentByInternalId(AgentId.Configkey); - var a1 = *(void**) (agent + 0x78); - if (a1 == null) - return null; - - var outData = stackalloc byte[32]; + var outData = stackalloc byte[11]; var idString = Utf8String.FromString(id); - GetKeybindNative((nint) a1, idString, (nint) outData); + GetKeybindNative(UIInputData.Instance(), idString, (nint) outData); idString->Dtor(true); var key1 = (VirtualKey) outData[0];