From 9a5ef1acabc4cfeeb851c4de8a5f6f1f6c82b4d8 Mon Sep 17 00:00:00 2001 From: Raymond Date: Tue, 7 Sep 2021 22:06:47 -0400 Subject: [PATCH] throw if set value is non-zero --- Dalamud/Game/ClientState/Keys/KeyState.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Dalamud/Game/ClientState/Keys/KeyState.cs b/Dalamud/Game/ClientState/Keys/KeyState.cs index 65d949ed8..0c8956006 100644 --- a/Dalamud/Game/ClientState/Keys/KeyState.cs +++ b/Dalamud/Game/ClientState/Keys/KeyState.cs @@ -52,6 +52,7 @@ namespace Dalamud.Game.ClientState.Keys /// The virtual key to change. /// Whether the specified key is currently pressed. /// If the vkCode is not valid. Refer to or . + /// If the set value is non-zero. public unsafe bool this[int vkCode] { get => this.GetRawValue(vkCode) != 0; @@ -84,8 +85,14 @@ namespace Dalamud.Game.ClientState.Keys /// The virtual key to change. /// The raw value to set in the index array. /// If the vkCode is not valid. Refer to or . + /// If the set value is non-zero. public void SetRawValue(int vkCode, int value) - => this.GetRefValue(vkCode) = value; + { + if (value != 0) + throw new ArgumentOutOfRangeException(nameof(value), "Dalamud does not support pressing keys, only preventing them via zero or False. If you have a valid use-case for this, please contact the dev team."); + + this.GetRefValue(vkCode) = value; + } /// public void SetRawValue(VirtualKey vkCode, int value)