From 6f1a3fc548d5ca625c5599838ca6f4722ae1c919 Mon Sep 17 00:00:00 2001 From: Infi Date: Mon, 15 Jul 2024 12:27:08 +0200 Subject: [PATCH] Fix virtual key check missing --- ChatTwo/GameFunctions/Chat.cs | 6 +++--- ChatTwo/GameFunctions/KeybindManager.cs | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ChatTwo/GameFunctions/Chat.cs b/ChatTwo/GameFunctions/Chat.cs index a6da4fa..29d47f2 100755 --- a/ChatTwo/GameFunctions/Chat.cs +++ b/ChatTwo/GameFunctions/Chat.cs @@ -394,11 +394,11 @@ internal sealed unsafe class Chat : IDisposable private static byte[] EncodeMessage(string str) { using var input = new Utf8String(str); - using var ouput = new Utf8String(); + using var output = new Utf8String(); input.Copy(PronounModule.Instance()->ProcessString(&input, true)); - ouput.Copy(PronounModule.Instance()->ProcessString(&input, false)); - return ouput.AsSpan().ToArray(); + output.Copy(PronounModule.Instance()->ProcessString(&input, false)); + return output.AsSpan().ToArray(); } internal bool IsCharValid(char c) diff --git a/ChatTwo/GameFunctions/KeybindManager.cs b/ChatTwo/GameFunctions/KeybindManager.cs index d83beea..bb22056 100644 --- a/ChatTwo/GameFunctions/KeybindManager.cs +++ b/ChatTwo/GameFunctions/KeybindManager.cs @@ -315,9 +315,7 @@ internal unsafe class KeybindManager : IDisposable { private void UpdateKeybinds() { foreach (var name in KeybindsToIntercept.Keys) - { Keybinds[name] = GetKeybind(name); - } } private static ModifierFlag GetModifiers(KeyboardSource source) @@ -348,6 +346,10 @@ internal unsafe class KeybindManager : IDisposable { { if (key == VirtualKey.NO_KEY) return false; + + if (!Plugin.KeyState.IsVirtualKeyValid(key)) + return false; + if (source == KeyboardSource.Game) return Plugin.KeyState[key];