diff --git a/Assets/defctrl.json b/Assets/defctrl.json index c920fedd55..406fbcf6aa 100644 --- a/Assets/defctrl.json +++ b/Assets/defctrl.json @@ -14,7 +14,7 @@ "P1 RetroPad L": "W, J1 B5, X1 LeftShoulder", "P1 RetroPad R": "E, J1 B6, X1 RightShoulder", "Pointer Pressed": "WMouse L", - "Key Backspace": "BackSpace", + "Key Backspace": "Backspace", "Key Tab": "Tab", "Key Return": "Enter", "Key Escape": "Escape", @@ -34,11 +34,11 @@ "Key 8": "Number8", "Key 9": "Number9", "Key Semicolon": "Semicolon", - "Key Equals": "Plus", - "Key LeftBracket": "BracketLeft", - "Key Backslash": "BackSlash", - "Key RightBracket": "BracketRight", - "Key Backquote": "Tilde", + "Key Equals": "Equals", + "Key LeftBracket": "LeftBracket", + "Key Backslash": "Backslash", + "Key RightBracket": "RightBracket", + "Key Backquote": "Backtick", "Key A": "A", "Key B": "B", "Key C": "C", @@ -85,7 +85,7 @@ "Key Up": "Up", "Key Down": "Down", "Key Left": "Left", - "Key Insert": "ControlLeft", + "Key Insert": "LeftCtrl", "Key Home": "Home", "Key End": "End", "Key PageUp": "PageUp", @@ -102,16 +102,16 @@ "Key F10": "F10", "Key F11": "F11", "Key F12": "F12", - "Key NumLock": "NumberLock", + "Key NumLock": "NumLock", "Key CapsLock": "CapsLock", "Key ScrollLock": "ScrollLock", - "Key RShift": "ShiftRight", - "Key LShift": "ShiftLeft", - "Key RCtrl": "ControlRight", - "Key LCtrl": "ControlLeft", - "Key RAlt": "AltRight", - "Key LAlt": "AltLeft", - "Key Menu": "Applications", + "Key RShift": "RightShift", + "Key LShift": "LeftShift", + "Key RCtrl": "RightCtrl", + "Key LCtrl": "LeftCtrl", + "Key RAlt": "RightAlt", + "Key LAlt": "LeftAlt", + "Key Menu": "Apps", "Key Right": "Right" }, "NES Controller": { @@ -308,7 +308,7 @@ "Key F3": "F3", "Key F5": "F5", "Key F7": "F7", - "Key Left Arrow": "Tilde", + "Key Left Arrow": "Backtick", "Key 1": "Number1", "Key 2": "Number2", "Key 3": "Number3", @@ -319,11 +319,11 @@ "Key 8": "Number8", "Key 9": "Number9", "Key 0": "Number0", - "Key Plus": "Plus", + "Key Plus": "Equals", "Key Minus": "Minus", "Key Pound": "Insert", "Key Clear/Home": "Delete", - "Key Insert/Delete": "BackSpace", + "Key Insert/Delete": "Backspace", "Key Control": "Tab", "Key Q": "Q", "Key W": "W", @@ -335,9 +335,9 @@ "Key I": "I", "Key O": "O", "Key P": "P", - "Key At": "BracketLeft", - "Key Asterisk": "BracketRight", - "Key Up Arrow": "BackSlash", + "Key At": "LeftBracket", + "Key Asterisk": "RightBracket", + "Key Up Arrow": "Backslash", "Key Run/Stop": "CapsLock", "Key A": "A", "Key S": "S", @@ -349,11 +349,11 @@ "Key K": "K", "Key L": "L", "Key Colon": "Semicolon", - "Key Semicolon": "Quote", - "Key Equal": "ControlRight", + "Key Semicolon": "Apostrophe", + "Key Equal": "RightCtrl", "Key Return": "Enter", - "Key Commodore": "ControlLeft", - "Key Left Shift": "ShiftLeft", + "Key Commodore": "LeftCtrl", + "Key Left Shift": "LeftShift", "Key Z": "Z", "Key X": "X", "Key C": "C", @@ -364,7 +364,7 @@ "Key Comma": "Comma", "Key Period": "Period", "Key Slash": "Slash", - "Key Right Shift": "ShiftRight", + "Key Right Shift": "RightShift", "Key Cursor Up/Down": "Down", "Key Cursor Left/Right": "Right", "Key Space": "Space" @@ -386,7 +386,7 @@ "Key 9": "Number9", "Key 0": "Number0", "Key Break": "Delete", - "Key Delete": "BackSpace", + "Key Delete": "Backspace", "Key Q": "Q", "Key W": "W", "Key E": "E", @@ -407,7 +407,7 @@ "Key K": "K", "Key L": "L", "Key Return": "Enter", - "Key Caps Shift": "ShiftLeft, ShiftRight", + "Key Caps Shift": "LeftShift, RightShift", "Key Z": "Z", "Key X": "X", "Key C": "C", @@ -416,7 +416,7 @@ "Key N": "N", "Key M": "M", "Key Period": "Period", - "Key Symbol Shift": "ControlLeft, ControlRight", + "Key Symbol Shift": "LeftCtrl, RightCtrl", "Key Semi-Colon": "Semicolon", "Key Left Cursor": "Left", "Key Right Cursor": "Right", @@ -503,7 +503,7 @@ "P1 F10": "F10", "P1 F11": "F11", "P1 F12": "F12", - "P1 Grave`": "Tilde", + "P1 Grave`": "Backtick", "P1 1(One)": "Number1", "P1 2": "Number2", "P1 3": "Number3", @@ -515,9 +515,9 @@ "P1 9": "Number9", "P1 0(Zero)": "Number0", "P1 Minus-": "Minus", - "P1 Equals=": "Plus", - "P1 Backslash\\": "BackSlash", - "P1 Backspace": "BackSpace", + "P1 Equals=": "Equals", + "P1 Backslash\\": "Backslash", + "P1 Backspace": "Backspace", "P1 Tab": "Tab", "P1 Q": "Q", "P1 W": "W", @@ -529,8 +529,8 @@ "P1 I": "I", "P1 O": "O", "P1 P": "P", - "P1 LeftBracket[": "BracketLeft", - "P1 RightBracket]": "BracketRight", + "P1 LeftBracket[": "LeftBracket", + "P1 RightBracket]": "RightBracket", "P1 Enter": "Enter", "P1 CapsLock": "CapsLock", "P1 A(Key)": "A", @@ -543,8 +543,8 @@ "P1 K": "K", "P1 L(Key)": "L", "P1 Semicolon;": "Semicolon", - "P1 Quote'": "Quote", - "P1 LeftShift": "ShiftLeft", + "P1 Quote'": "Apostrophe", + "P1 LeftShift": "LeftShift", "P1 Z(Key)": "Z", "P1 X(Key)": "X", "P1 C(Key)": "C", @@ -555,12 +555,12 @@ "P1 Comma,": "Comma", "P1 Period.": "Period", "P1 Slash/": "Slash", - "P1 RightShift": "ShiftRight", - "P1 LeftCtrl": "ControlLeft", - "P1 LeftAlt": "AltLeft", + "P1 RightShift": "RightShift", + "P1 LeftCtrl": "LeftCtrl", + "P1 LeftAlt": "LeftAlt", "P1 Space": "Space", - "P1 RightAlt": "AltRight", - "P1 RightCtrl": "ControlRight", + "P1 RightAlt": "RightAlt", + "P1 RightCtrl": "RightCtrl", "P1 ScrollLock": "ScrollLock", "P1 Pause": "Pause", "P1 Insert": "Insert", @@ -570,7 +570,7 @@ "P1 PageUp": "PageUp", "P1 PageDown": "PageDown", "P1 CursorLeft": "Left", - "P1 NumLock": "NumberLock", + "P1 NumLock": "NumLock", "P1 KeypadSlash(Divide)": "KeypadDivide", "P1 KeypadAsterisk(Multiply)": "KeypadMultiply", "P1 KeypadMinus": "KeypadSubtract", @@ -603,8 +603,8 @@ "P1 VI": "A, J1 B12, X1 X", "P1 Select": "V, J1 B9, X1 Back", "P1 Run": "Enter, J1 B10, X1 Start", - "P1 Mode: Set 2-button": "BracketLeft", - "P1 Mode: Set 6-button": "BracketRight" + "P1 Mode: Set 2-button": "LeftBracket", + "P1 Mode: Set 6-button": "RightBracket" }, "ColecoVision Basic Controller": { "P1 Up": "Up, J1 POV1U, X1 DpadUp, X1 LStickUp", @@ -670,8 +670,8 @@ "Key 9": "Number9", "Key 0": "Number0", "Key Minus": "Minus", - "Key Caret": "Plus", - "Key Yen": "BackSpace", + "Key Caret": "Equals", + "Key Yen": "Backspace", "Key Break": "Delete", "Key Function": "Tab", "Key Q": "Q", @@ -684,8 +684,8 @@ "Key I": "I", "Key O": "O", "Key P": "P", - "Key At": "BracketLeft", - "Key Left Bracket": "BracketRight", + "Key At": "LeftBracket", + "Key Left Bracket": "RightBracket", "Key Return": "Enter", "Key Up Arrow": "Up", "Key Control": "CapsLock", @@ -699,11 +699,11 @@ "Key K": "K", "Key L": "L", "Key Semicolon": "Semicolon", - "Key Colon": "Quote", - "Key Right Bracket": "BackSlash", + "Key Colon": "Apostrophe", + "Key Right Bracket": "Backslash", "Key Left Arrow": "Left", "Key Right Arrow": "Right", - "Key Shift": "ShiftLeft", + "Key Shift": "LeftShift", "Key Z": "Z", "Key X": "X", "Key C": "C", @@ -714,7 +714,7 @@ "Key Comma": "Comma", "Key Period": "Period", "Key Slash": "Slash", - "Key PI": "ShiftRight", + "Key PI": "RightShift", "Key Down Arrow": "Down", "Key Graph": "PageUp", "Key Kana": "PageDown", @@ -753,8 +753,8 @@ "P2 Down": "Keypad2, J1 RotationZ+, X1 RStickDown", "P2 Left": "Keypad4, J1 Z-, X1 RStickLeft", "P2 Right": "Keypad6, J1 Z+, X1 RStickRight", - "P2 Start": "BracketRight, J1 B5, X1 LeftShoulder", - "P2 Select": "BracketLeft, J1 B6, X1 RightShoulder", + "P2 Start": "RightBracket, J1 B5, X1 LeftShoulder", + "P2 Select": "LeftBracket, J1 B6, X1 RightShoulder", "P2 B": "C, J1 B4, X1 Y", "P2 A": "V, J1 B3, X1 B" }, @@ -791,7 +791,7 @@ "PRGM": "R", "STAT": "S", "SIN": "Period", - "MATRIX": "BracketLeft", + "MATRIX": "LeftBracket", "X": "X", "STO": "Insert", "LN": "L", @@ -806,7 +806,7 @@ "WINDOW": "W", "Y": "Y", "SECOND": "Slash", - "MODE": "BackSlash", + "MODE": "Backslash", "DEL": "Delete", "COMMA": "Comma" }, @@ -903,7 +903,7 @@ "Return": "Enter", "Right": "Right", "Space": "Space", - "'": "Quote", + "'": "Apostrophe", ",": "Comma", "-": "Minus", ".": "Period", @@ -919,11 +919,11 @@ "8": "Keypad8", "9": "Keypad9", ";": "Semicolon", - "=": "Plus", - "[": "BracketLeft", - "\\": "BackSlash", - "]": "BracketRight", - "`": "Tilde", + "=": "Equals", + "[": "LeftBracket", + "\\": "Backslash", + "]": "RightBracket", + "`": "Backtick", "A": "A", "B": "B", "C": "C", @@ -950,8 +950,8 @@ "X": "X", "Y": "Y", "Z": "Z", - "Control": "ControlRight", - "Shift": "ShiftRight", + "Control": "RightCtrl", + "Shift": "RightShift", "Caps Lock": "CapsLock" }, "VirtualBoy Controller": { diff --git a/src/BizHawk.Bizware.DirectX/IPCKeyInput.cs b/src/BizHawk.Bizware.DirectX/IPCKeyInput.cs index 995c257f3d..4ad4fd55c2 100644 --- a/src/BizHawk.Bizware.DirectX/IPCKeyInput.cs +++ b/src/BizHawk.Bizware.DirectX/IPCKeyInput.cs @@ -5,8 +5,6 @@ using System.IO.Pipes; using BizHawk.Client.Common; -using SlimDX.DirectInput; - // this is not a very safe or pretty protocol, I'm not proud of it namespace BizHawk.Bizware.DirectX { @@ -41,7 +39,7 @@ namespace BizHawk.Bizware.DirectX int e = br.ReadInt32(); bool pressed = (e & 0x80000000) != 0; lock (PendingEventList) - PendingEventList.Add(new KeyEvent(KeyInput.KeyEnumMap[(Key) (e & 0x7FFFFFFF)], pressed)); + PendingEventList.Add(new KeyEvent(KeyInput.KeyEnumMap[e & 0x7FFFFFFF], pressed)); } } catch { } diff --git a/src/BizHawk.Bizware.DirectX/Keyboard.cs b/src/BizHawk.Bizware.DirectX/Keyboard.cs index a5a8950d57..05b1726a0c 100644 --- a/src/BizHawk.Bizware.DirectX/Keyboard.cs +++ b/src/BizHawk.Bizware.DirectX/Keyboard.cs @@ -12,7 +12,6 @@ using SlimDX.DirectInput; using static BizHawk.Common.Win32Imports; using DInputKey = SlimDX.DirectInput.Key; -using OpenTKKey = OpenTK.Input.Key; using WinFormsKey = System.Windows.Forms.Keys; namespace BizHawk.Bizware.DirectX @@ -52,7 +51,7 @@ namespace BizHawk.Bizware.DirectX public static IEnumerable Update(Config config) { - OpenTKKey Mapped(DInputKey k) => KeyEnumMap[config.HandleAlternateKeyboardLayouts ? MapToRealKeyViaScanCode(k) : k]; + DistinctKey Mapped(DInputKey k) => KeyEnumMap[(int) (config.HandleAlternateKeyboardLayouts ? MapToRealKeyViaScanCode(k) : k)]; lock (_lockObj) { @@ -380,31 +379,153 @@ namespace BizHawk.Bizware.DirectX }; } - internal static readonly Dictionary KeyEnumMap = new Dictionary + internal static readonly IReadOnlyList KeyEnumMap = new List { - {DInputKey.Unknown, OpenTKKey.Unknown}, - - // A-Z - {DInputKey.A, OpenTKKey.A}, {DInputKey.B, OpenTKKey.B}, {DInputKey.C, OpenTKKey.C}, {DInputKey.D, OpenTKKey.D}, {DInputKey.E, OpenTKKey.E}, {DInputKey.F, OpenTKKey.F}, {DInputKey.G, OpenTKKey.G}, {DInputKey.H, OpenTKKey.H}, {DInputKey.I, OpenTKKey.I}, {DInputKey.J, OpenTKKey.J}, {DInputKey.K, OpenTKKey.K}, {DInputKey.L, OpenTKKey.L}, {DInputKey.M, OpenTKKey.M}, {DInputKey.N, OpenTKKey.N}, {DInputKey.O, OpenTKKey.O}, {DInputKey.P, OpenTKKey.P}, {DInputKey.Q, OpenTKKey.Q}, {DInputKey.R, OpenTKKey.R}, {DInputKey.S, OpenTKKey.S}, {DInputKey.T, OpenTKKey.T}, {DInputKey.U, OpenTKKey.U}, {DInputKey.V, OpenTKKey.V}, {DInputKey.W, OpenTKKey.W}, {DInputKey.X, OpenTKKey.X}, {DInputKey.Y, OpenTKKey.Y}, {DInputKey.Z, OpenTKKey.Z}, - // 0-9 - {DInputKey.D1, OpenTKKey.Number1}, {DInputKey.D2, OpenTKKey.Number2}, {DInputKey.D3, OpenTKKey.Number3}, {DInputKey.D4, OpenTKKey.Number4}, {DInputKey.D5, OpenTKKey.Number5}, {DInputKey.D6, OpenTKKey.Number6}, {DInputKey.D7, OpenTKKey.Number7}, {DInputKey.D8, OpenTKKey.Number8}, {DInputKey.D9, OpenTKKey.Number9}, {DInputKey.D0, OpenTKKey.Number0}, - // misc. printables (ASCII order) - {DInputKey.Space, OpenTKKey.Space}, {DInputKey.Apostrophe, OpenTKKey.Quote}, {DInputKey.Comma, OpenTKKey.Comma}, {DInputKey.Minus, OpenTKKey.Minus}, {DInputKey.Period, OpenTKKey.Period}, {DInputKey.Slash, OpenTKKey.Slash}, {DInputKey.Semicolon, OpenTKKey.Semicolon}, {DInputKey.Equals, OpenTKKey.Plus}, {DInputKey.LeftBracket, OpenTKKey.BracketLeft}, {DInputKey.Backslash, OpenTKKey.BackSlash}, {DInputKey.RightBracket, OpenTKKey.BracketRight}, {DInputKey.Grave, OpenTKKey.Tilde}, - // misc. (alphabetically) - {DInputKey.Backspace, OpenTKKey.BackSpace}, {DInputKey.CapsLock, OpenTKKey.CapsLock}, {DInputKey.Delete, OpenTKKey.Delete}, {DInputKey.DownArrow, OpenTKKey.Down}, {DInputKey.End, OpenTKKey.End}, {DInputKey.Return, OpenTKKey.Enter}, {DInputKey.Escape, OpenTKKey.Escape}, {DInputKey.Home, OpenTKKey.Home}, {DInputKey.Insert, OpenTKKey.Insert}, {DInputKey.LeftArrow, OpenTKKey.Left}, {DInputKey.Applications, OpenTKKey.Menu}, {DInputKey.Oem102, OpenTKKey.NonUSBackSlash}, {DInputKey.NumberLock, OpenTKKey.NumLock}, {DInputKey.PageDown, OpenTKKey.PageDown}, {DInputKey.PageUp, OpenTKKey.PageUp}, {DInputKey.Pause, OpenTKKey.Pause}, {DInputKey.PrintScreen, OpenTKKey.PrintScreen}, {DInputKey.RightArrow, OpenTKKey.Right}, {DInputKey.ScrollLock, OpenTKKey.ScrollLock}, {DInputKey.Tab, OpenTKKey.Tab}, {DInputKey.UpArrow, OpenTKKey.Up}, - // modifier - {DInputKey.LeftWindowsKey, OpenTKKey.WinLeft}, {DInputKey.RightWindowsKey, OpenTKKey.WinRight}, {DInputKey.LeftControl, OpenTKKey.ControlLeft}, {DInputKey.RightControl, OpenTKKey.ControlRight}, {DInputKey.LeftAlt, OpenTKKey.AltLeft}, {DInputKey.RightAlt, OpenTKKey.AltRight}, {DInputKey.LeftShift, OpenTKKey.ShiftLeft}, {DInputKey.RightShift, OpenTKKey.ShiftRight}, - - // function - {DInputKey.F1, OpenTKKey.F1}, {DInputKey.F2, OpenTKKey.F2}, {DInputKey.F3, OpenTKKey.F3}, {DInputKey.F4, OpenTKKey.F4}, {DInputKey.F5, OpenTKKey.F5}, {DInputKey.F6, OpenTKKey.F6}, {DInputKey.F7, OpenTKKey.F7}, {DInputKey.F8, OpenTKKey.F8}, {DInputKey.F9, OpenTKKey.F9}, {DInputKey.F10, OpenTKKey.F10}, {DInputKey.F11, OpenTKKey.F11}, {DInputKey.F12, OpenTKKey.F12}, - // keypad (alphabetically) - {DInputKey.NumberPad0, OpenTKKey.Keypad0}, {DInputKey.NumberPad1, OpenTKKey.Keypad1}, {DInputKey.NumberPad2, OpenTKKey.Keypad2}, {DInputKey.NumberPad3, OpenTKKey.Keypad3}, {DInputKey.NumberPad4, OpenTKKey.Keypad4}, {DInputKey.NumberPad5, OpenTKKey.Keypad5}, {DInputKey.NumberPad6, OpenTKKey.Keypad6}, {DInputKey.NumberPad7, OpenTKKey.Keypad7}, {DInputKey.NumberPad8, OpenTKKey.Keypad8}, {DInputKey.NumberPad9, OpenTKKey.Keypad9}, {DInputKey.NumberPadPlus, OpenTKKey.KeypadAdd}, {DInputKey.NumberPadPeriod, OpenTKKey.KeypadDecimal}, {DInputKey.NumberPadSlash, OpenTKKey.KeypadDivide}, {DInputKey.NumberPadEnter, OpenTKKey.KeypadEnter}, {DInputKey.NumberPadStar, OpenTKKey.KeypadMultiply}, {DInputKey.NumberPadMinus, OpenTKKey.KeypadSubtract}, - - // misc. available in DInput alt. mode but not in OpenTK - // I have some of the media keys on my keyboard but SlimDX didn't seem to pick them up --yoshi - {DInputKey.Convert, OpenTKKey.Unknown}, {DInputKey.Mail, OpenTKKey.Unknown}, {DInputKey.MediaSelect, OpenTKKey.Unknown}, {DInputKey.MediaStop, OpenTKKey.Unknown}, {DInputKey.Mute, OpenTKKey.Unknown}, {DInputKey.NextTrack, OpenTKKey.Unknown}, {DInputKey.PlayPause, OpenTKKey.Unknown}, {DInputKey.PreviousTrack, OpenTKKey.Unknown}, {DInputKey.Sleep, OpenTKKey.Unknown}, {DInputKey.VolumeDown, OpenTKKey.Unknown}, {DInputKey.VolumeUp, OpenTKKey.Unknown}, {DInputKey.WebBack, OpenTKKey.Unknown}, {DInputKey.WebFavorites, OpenTKKey.Unknown}, {DInputKey.WebForward, OpenTKKey.Unknown}, {DInputKey.WebHome, OpenTKKey.Unknown}, {DInputKey.WebRefresh, OpenTKKey.Unknown}, {DInputKey.WebSearch, OpenTKKey.Unknown}, {DInputKey.WebStop, OpenTKKey.Unknown}, - // misc. not available in DInput alt. mode - {DInputKey.AbntC1, OpenTKKey.Unknown}, {DInputKey.AbntC2, OpenTKKey.Unknown}, {DInputKey.AT, OpenTKKey.Unknown}, {DInputKey.AX, OpenTKKey.Unknown}, {DInputKey.Calculator, OpenTKKey.Unknown}, {DInputKey.Colon, OpenTKKey.Unknown}, {DInputKey.Kana, OpenTKKey.Unknown}, {DInputKey.Kanji, OpenTKKey.Unknown}, {DInputKey.MyComputer, OpenTKKey.Unknown}, {DInputKey.NoConvert, OpenTKKey.Unknown}, {DInputKey.NumberPadComma, OpenTKKey.Unknown}, {DInputKey.NumberPadEquals, OpenTKKey.Unknown}, {DInputKey.Power, OpenTKKey.Unknown}, {DInputKey.Stop, OpenTKKey.Unknown}, {DInputKey.Underline, OpenTKKey.Unknown}, {DInputKey.Unlabeled, OpenTKKey.Unknown}, {DInputKey.Wake, OpenTKKey.Unknown}, {DInputKey.Yen, OpenTKKey.Unknown}, + DistinctKey.D0, + DistinctKey.D1, + DistinctKey.D2, + DistinctKey.D3, + DistinctKey.D4, + DistinctKey.D5, + DistinctKey.D6, + DistinctKey.D7, + DistinctKey.D8, + DistinctKey.D9, + DistinctKey.A, + DistinctKey.B, + DistinctKey.C, + DistinctKey.D, + DistinctKey.E, + DistinctKey.F, + DistinctKey.G, + DistinctKey.H, + DistinctKey.I, + DistinctKey.J, + DistinctKey.K, + DistinctKey.L, + DistinctKey.M, + DistinctKey.N, + DistinctKey.O, + DistinctKey.P, + DistinctKey.Q, + DistinctKey.R, + DistinctKey.S, + DistinctKey.T, + DistinctKey.U, + DistinctKey.V, + DistinctKey.W, + DistinctKey.X, + DistinctKey.Y, + DistinctKey.Z, + DistinctKey.AbntC1, + DistinctKey.AbntC2, + DistinctKey.OemQuotes, + DistinctKey.Apps, + DistinctKey.Unknown, // AT + DistinctKey.Unknown, // AX + DistinctKey.Back, + DistinctKey.OemPipe, // Backslash + DistinctKey.Unknown, // Calculator + DistinctKey.CapsLock, + DistinctKey.Unknown, // Colon + DistinctKey.OemComma, + DistinctKey.ImeConvert, + DistinctKey.Delete, + DistinctKey.Down, + DistinctKey.End, + DistinctKey.OemPlus, + DistinctKey.Escape, + DistinctKey.F1, + DistinctKey.F2, + DistinctKey.F3, + DistinctKey.F4, + DistinctKey.F5, + DistinctKey.F6, + DistinctKey.F7, + DistinctKey.F8, + DistinctKey.F9, + DistinctKey.F10, + DistinctKey.F11, + DistinctKey.F12, + DistinctKey.F13, + DistinctKey.F14, + DistinctKey.F15, + DistinctKey.OemTilde, + DistinctKey.Home, + DistinctKey.Insert, + DistinctKey.KanaMode, + DistinctKey.KanjiMode, + DistinctKey.OemOpenBrackets, + DistinctKey.LeftCtrl, + DistinctKey.Left, + DistinctKey.LeftAlt, + DistinctKey.LeftShift, + DistinctKey.LWin, + DistinctKey.LaunchMail, + DistinctKey.SelectMedia, + DistinctKey.MediaStop, + DistinctKey.OemMinus, + DistinctKey.VolumeMute, + DistinctKey.Unknown, // MyComputer + DistinctKey.MediaNextTrack, + DistinctKey.ImeNonConvert, + DistinctKey.NumLock, + DistinctKey.NumPad0, + DistinctKey.NumPad1, + DistinctKey.NumPad2, + DistinctKey.NumPad3, + DistinctKey.NumPad4, + DistinctKey.NumPad5, + DistinctKey.NumPad6, + DistinctKey.NumPad7, + DistinctKey.NumPad8, + DistinctKey.NumPad9, + DistinctKey.Separator, + DistinctKey.NumPadEnter, + DistinctKey.OemPlus, // NumberPadEquals + DistinctKey.Subtract, + DistinctKey.Decimal, + DistinctKey.Add, + DistinctKey.Divide, + DistinctKey.Multiply, + DistinctKey.OemBackslash, // Oem102 + DistinctKey.PageDown, + DistinctKey.PageUp, + DistinctKey.Pause, + DistinctKey.OemPeriod, + DistinctKey.MediaPlayPause, + DistinctKey.Unknown, // Power + DistinctKey.MediaPreviousTrack, + DistinctKey.OemCloseBrackets, + DistinctKey.RightCtrl, + DistinctKey.Return, + DistinctKey.Right, + DistinctKey.RightAlt, + DistinctKey.RightShift, + DistinctKey.RWin, + DistinctKey.Scroll, + DistinctKey.OemSemicolon, + DistinctKey.OemQuestion, // Slash + DistinctKey.Sleep, + DistinctKey.Space, + DistinctKey.MediaStop, + DistinctKey.PrintScreen, + DistinctKey.Tab, + DistinctKey.Unknown, // Underline + DistinctKey.Unknown, // Unlabeled + DistinctKey.Up, + DistinctKey.VolumeDown, + DistinctKey.VolumeUp, + DistinctKey.Sleep, // Wake + DistinctKey.BrowserBack, + DistinctKey.BrowserFavorites, + DistinctKey.BrowserForward, + DistinctKey.BrowserHome, + DistinctKey.BrowserRefresh, + DistinctKey.BrowserSearch, + DistinctKey.BrowserStop, + DistinctKey.Unknown, // Yen + DistinctKey.Unknown // Unknown }; } } diff --git a/src/BizHawk.Client.Common/input/DistinctKey.cs b/src/BizHawk.Client.Common/input/DistinctKey.cs new file mode 100644 index 0000000000..c02e549bf9 --- /dev/null +++ b/src/BizHawk.Client.Common/input/DistinctKey.cs @@ -0,0 +1,621 @@ +#nullable enable + +namespace BizHawk.Client.Common +{ + /// values are one-to-one with System.Windows.Input.Key except and which were added for this project + /// copied from MIT-licensed WPF source: https://github.com/dotnet/wpf/blob/49bb41ad83abeb5ae22e4c59d0f43c1287acac00/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Input/Key.cs + public enum DistinctKey + { + /// No key pressed. + None, + + /// The CANCEL key. + Cancel, + + /// The BACKSPACE key. + Back, + + /// The TAB key. + Tab, + + /// The LineFeed key. + LineFeed, + + /// The CLEAR key. + Clear, + + /// The RETURN key. + Return, + + /// The ENTER key. + Enter = Return, + + /// The PAUSE key. + Pause, + + /// The CAPS LOCK key. + Capital, + + /// The CAPS LOCK key. + CapsLock = Capital, + + /// The IME Kana mode key. + KanaMode, + + /// The IME Hangul mode key. + HangulMode = KanaMode, + + /// The IME Junja mode key. + JunjaMode, + + /// The IME Final mode key. + FinalMode, + + /// The IME Hanja mode key. + HanjaMode, + + /// The IME Kanji mode key. + KanjiMode = HanjaMode, + + /// The ESC key. + Escape, + + /// The IME Convert key. + ImeConvert, + + /// The IME NonConvert key. + ImeNonConvert, + + /// The IME Accept key. + ImeAccept, + + /// The IME Mode change request. + ImeModeChange, + + /// The SPACEBAR key. + Space, + + /// The PAGE UP key. + Prior, + + /// The PAGE UP key. + PageUp = Prior, + + /// The PAGE DOWN key. + Next, + + /// The PAGE DOWN key. + PageDown = Next, + + /// The END key. + End, + + /// The HOME key. + Home, + + /// The LEFT ARROW key. + Left, + + /// The UP ARROW key. + Up, + + /// The RIGHT ARROW key. + Right, + + /// The DOWN ARROW key. + Down, + + /// The SELECT key. + Select, + + /// The PRINT key. + Print, + + /// The EXECUTE key. + Execute, + + /// The PRINT SCREEN key. + Snapshot, + + /// The PRINT SCREEN key. + PrintScreen = Snapshot, + + /// The INS key. + Insert, + + /// The DEL key. + Delete, + + /// The HELP key. + Help, + + /// The 0 key. + D0, + + /// The 1 key. + D1, + + /// The 2 key. + D2, + + /// The 3 key. + D3, + + /// The 4 key. + D4, + + /// The 5 key. + D5, + + /// The 6 key. + D6, + + /// The 7 key. + D7, + + /// The 8 key. + D8, + + /// The 9 key. + D9, + + /// The A key. + A, + + /// The B key. + B, + + /// The C key. + C, + + /// The D key. + D, + + /// The E key. + E, + + /// The F key. + F, + + /// The G key. + G, + + /// The H key. + H, + + /// The I key. + I, + + /// The J key. + J, + + /// The K key. + K, + + /// The L key. + L, + + /// The M key. + M, + + /// The N key. + N, + + /// The O key. + O, + + /// The P key. + P, + + /// The Q key. + Q, + + /// The R key. + R, + + /// The S key. + S, + + /// The T key. + T, + + /// The U key. + U, + + /// The V key. + V, + + /// The W key. + W, + + /// The X key. + X, + + /// The Y key. + Y, + + /// The Z key. + Z, + + /// The left Windows logo key (Microsoft Natural Keyboard). + LWin, + + /// The right Windows logo key (Microsoft Natural Keyboard). + RWin, + + /// The Application key (Microsoft Natural Keyboard). + Apps, + + /// The Computer Sleep key. + Sleep, + + /// The 0 key on the numeric keypad. + NumPad0, + + /// The 1 key on the numeric keypad. + NumPad1, + + /// The 2 key on the numeric keypad. + NumPad2, + + /// The 3 key on the numeric keypad. + NumPad3, + + /// The 4 key on the numeric keypad. + NumPad4, + + /// The 5 key on the numeric keypad. + NumPad5, + + /// The 6 key on the numeric keypad. + NumPad6, + + /// The 7 key on the numeric keypad. + NumPad7, + + /// The 8 key on the numeric keypad. + NumPad8, + + /// The 9 key on the numeric keypad. + NumPad9, + + /// The Multiply key. + Multiply, + + /// The Add key. + Add, + + /// The Separator key. + Separator, + + /// The Subtract key. + Subtract, + + /// The Decimal key. + Decimal, + + /// The Divide key. + Divide, + + /// The F1 key. + F1, + + /// The F2 key. + F2, + + /// The F3 key. + F3, + + /// The F4 key. + F4, + + /// The F5 key. + F5, + + /// The F6 key. + F6, + + /// The F7 key. + F7, + + /// The F8 key. + F8, + + /// The F9 key. + F9, + + /// The F10 key. + F10, + + /// The F11 key. + F11, + + /// The F12 key. + F12, + + /// The F13 key. + F13, + + /// The F14 key. + F14, + + /// The F15 key. + F15, + + /// The F16 key. + F16, + + /// The F17 key. + F17, + + /// The F18 key. + F18, + + /// The F19 key. + F19, + + /// The F20 key. + F20, + + /// The F21 key. + F21, + + /// The F22 key. + F22, + + /// The F23 key. + F23, + + /// The F24 key. + F24, + + /// The NUM LOCK key. + NumLock, + + /// The SCROLL LOCK key. + Scroll, + + /// The left SHIFT key. + LeftShift, + + /// The right SHIFT key. + RightShift, + + /// The left CTRL key. + LeftCtrl, + + /// The right CTRL key. + RightCtrl, + + /// The left ALT key. + LeftAlt, + + /// The right ALT key. + RightAlt, + + /// The Browser Back key. + BrowserBack, + + /// The Browser Forward key. + BrowserForward, + + /// The Browser Refresh key. + BrowserRefresh, + + /// The Browser Stop key. + BrowserStop, + + /// The Browser Search key. + BrowserSearch, + + /// The Browser Favorites key. + BrowserFavorites, + + /// The Browser Home key. + BrowserHome, + + /// The Volume Mute key. + VolumeMute, + + /// The Volume Down key. + VolumeDown, + + /// The Volume Up key. + VolumeUp, + + /// The Media Next Track key. + MediaNextTrack, + + /// The Media Previous Track key. + MediaPreviousTrack, + + /// The Media Stop key. + MediaStop, + + /// The Media Play Pause key. + MediaPlayPause, + + /// The Launch Mail key. + LaunchMail, + + /// The Select Media key. + SelectMedia, + + /// The Launch Application1 key. + LaunchApplication1, + + /// The Launch Application2 key. + LaunchApplication2, + + /// The Oem 1 key. + Oem1, + + /// The Oem Semicolon key. + OemSemicolon = Oem1, + + /// The Oem plus key. + OemPlus, + + /// The Oem comma key. + OemComma, + + /// The Oem Minus key. + OemMinus, + + /// The Oem Period key. + OemPeriod, + + /// The Oem 2 key. + Oem2, + + /// The Oem Question key. + OemQuestion = Oem2, + + /// The Oem 3 key. + Oem3, + + /// The Oem tilde key. + OemTilde = Oem3, + + /// The ABNT_C1 Portuguese (Brazilian) key. + AbntC1, + + /// The ABNT_C2 Portuguese (Brazilian) key. + AbntC2, + + /// The Oem 4 key. + Oem4, + + /// The Oem Open Brackets key. + OemOpenBrackets = Oem4, + + /// The Oem 5 key. + Oem5, + + /// The Oem Pipe key. + OemPipe = Oem5, + + /// The Oem 6 key. + Oem6, + + /// The Oem Close Brackets key. + OemCloseBrackets = Oem6, + + /// The Oem 7 key. + Oem7, + + /// The Oem Quotes key. + OemQuotes = Oem7, + + /// The Oem8 key. + Oem8, + + /// The Oem 102 key. + Oem102, + + /// The Oem Backslash key. + OemBackslash = Oem102, + + /// A special key masking the real key being processed by an IME. + ImeProcessed, + + /// A special key masking the real key being processed as a system key. + System, + + /// The OEM_ATTN key. + OemAttn, + + /// The DBE_ALPHANUMERIC key. + DbeAlphanumeric = OemAttn, + + /// The OEM_FINISH key. + OemFinish, + + /// The DBE_KATAKANA key. + DbeKatakana = OemFinish, + + /// The OEM_COPY key. + OemCopy, + + /// The DBE_HIRAGANA key. + DbeHiragana = OemCopy, + + /// The OEM_AUTO key. + OemAuto, + + /// The DBE_SBCSCHAR key. + DbeSbcsChar = OemAuto, + + /// The OEM_ENLW key. + OemEnlw, + + /// The DBE_DBCSCHAR key. + DbeDbcsChar = OemEnlw, + + /// The OEM_BACKTAB key. + OemBackTab, + + /// The DBE_ROMAN key. + DbeRoman = OemBackTab, + + /// The ATTN key. + Attn, + + /// The DBE_NOROMAN key. + DbeNoRoman = Attn, + + /// The CRSEL key. + CrSel, + + /// The DBE_ENTERWORDREGISTERMODE key. + DbeEnterWordRegisterMode = CrSel, + + /// The EXSEL key. + ExSel, + + /// The DBE_ENTERIMECONFIGMODE key. + DbeEnterImeConfigureMode = ExSel, + + /// The ERASE EOF key. + EraseEof, + + /// The DBE_FLUSHSTRING key. + DbeFlushString = EraseEof, + + /// The PLAY key. + Play, + + /// The DBE_CODEINPUT key. + DbeCodeInput = Play, + + /// The ZOOM key. + Zoom, + + /// The DBE_NOCODEINPUT key. + DbeNoCodeInput = Zoom, + + /// A constant reserved for future use. + NoName, + + /// The DBE_DETERMINESTRING key. + DbeDetermineString = NoName, + + /// The PA1 key. + Pa1, + + /// The DBE_ENTERDLGCONVERSIONMODE key. + DbeEnterDialogConversionMode = Pa1, + + /// The CLEAR key. + OemClear, + + /// Indicates the key is part of a dead-key composition + DeadCharProcessed, + + /// The ENTER key on the numeric keypad. + NumPadEnter, + + /// Indicates a key which is not present in this enum + Unknown = unchecked((int) 0xFFFFFFFF) + } +} diff --git a/src/BizHawk.Client.Common/input/KeyEvent.cs b/src/BizHawk.Client.Common/input/KeyEvent.cs index 1b5150c027..89feec15a8 100644 --- a/src/BizHawk.Client.Common/input/KeyEvent.cs +++ b/src/BizHawk.Client.Common/input/KeyEvent.cs @@ -1,16 +1,14 @@ #nullable enable -using OpenTK.Input; - namespace BizHawk.Client.Common { public readonly struct KeyEvent { - public readonly Key Key; + public readonly DistinctKey Key; public readonly bool Pressed; - public KeyEvent(Key key, bool pressed) + public KeyEvent(DistinctKey key, bool pressed) { Key = key; Pressed = pressed; diff --git a/src/BizHawk.Client.EmuHawk/Input/Input.cs b/src/BizHawk.Client.EmuHawk/Input/Input.cs index ba086351c7..8d3e83d861 100644 --- a/src/BizHawk.Client.EmuHawk/Input/Input.cs +++ b/src/BizHawk.Client.EmuHawk/Input/Input.cs @@ -200,7 +200,18 @@ namespace BizHawk.Client.EmuHawk private void HandleButton(string button, bool newState, ClientInputFocus source) { - ModifierKey currentModifier = ButtonToModifierKey(button); + var currentModifier = button switch + { +// "LeftWin" => ModifierKey.Win, +// "RightWin" => ModifierKey.Win, + "LeftShift" => ModifierKey.Shift, + "RightShift" => ModifierKey.Shift, + "LeftCtrl" => ModifierKey.Control, + "RightCtrl" => ModifierKey.Control, + "LeftAlt" => ModifierKey.Alt, + "RightAlt" => ModifierKey.Alt, + _ => ModifierKey.None + }; if (EnableIgnoreModifiers && currentModifier != ModifierKey.None) return; if (_lastState[button] == newState) return; @@ -268,23 +279,6 @@ namespace BizHawk.Client.EmuHawk _axisValues[axis] = newValue; } - private static ModifierKey ButtonToModifierKey(string button) => button switch - { - "LeftShift" => ModifierKey.Shift, - "ShiftLeft" => ModifierKey.Shift, - "RightShift" => ModifierKey.Shift, - "ShiftRight" => ModifierKey.Shift, - "LeftControl" => ModifierKey.Control, - "ControlLeft" => ModifierKey.Control, - "RightControl" => ModifierKey.Control, - "RControl" => ModifierKey.Control, // no idea why this is different - "LeftAlt" => ModifierKey.Alt, - "LAlt" => ModifierKey.Alt, - "RightAlt" => ModifierKey.Alt, - "RAlt" => ModifierKey.Alt, - _ => ModifierKey.None - }; - private ModifierKey _modifiers; private readonly List _newEvents = new List(); @@ -331,6 +325,56 @@ namespace BizHawk.Client.EmuHawk private void UpdateThreadProc() { + static string KeyName(DistinctKey k) => k switch + { + DistinctKey.Back => "Backspace", + DistinctKey.Enter => "Enter", + DistinctKey.CapsLock => "CapsLock", + DistinctKey.PageDown => "PageDown", + DistinctKey.D0 => "Number0", + DistinctKey.D1 => "Number1", + DistinctKey.D2 => "Number2", + DistinctKey.D3 => "Number3", + DistinctKey.D4 => "Number4", + DistinctKey.D5 => "Number5", + DistinctKey.D6 => "Number6", + DistinctKey.D7 => "Number7", + DistinctKey.D8 => "Number8", + DistinctKey.D9 => "Number9", + DistinctKey.LWin => "LeftWin", + DistinctKey.RWin => "RightWin", + DistinctKey.NumPad0 => "Keypad0", + DistinctKey.NumPad1 => "Keypad1", + DistinctKey.NumPad2 => "Keypad2", + DistinctKey.NumPad3 => "Keypad3", + DistinctKey.NumPad4 => "Keypad4", + DistinctKey.NumPad5 => "Keypad5", + DistinctKey.NumPad6 => "Keypad6", + DistinctKey.NumPad7 => "Keypad7", + DistinctKey.NumPad8 => "Keypad8", + DistinctKey.NumPad9 => "Keypad9", + DistinctKey.Multiply => "KeypadMultiply", + DistinctKey.Add => "KeypadAdd", + DistinctKey.Separator => "KeypadComma", + DistinctKey.Subtract => "KeypadSubtract", + DistinctKey.Decimal => "KeypadDecimal", + DistinctKey.Divide => "KeypadDivide", + DistinctKey.Scroll => "ScrollLock", + DistinctKey.OemSemicolon => "Semicolon", + DistinctKey.OemPlus => "Equals", + DistinctKey.OemComma => "Comma", + DistinctKey.OemMinus => "Minus", + DistinctKey.OemPeriod => "Period", + DistinctKey.OemQuestion => "Slash", + DistinctKey.OemTilde => "Backtick", + DistinctKey.OemOpenBrackets => "LeftBracket", + DistinctKey.OemPipe => "Backslash", + DistinctKey.OemCloseBrackets => "RightBracket", + DistinctKey.OemQuotes => "Apostrophe", + DistinctKey.OemBackslash => "OEM102", + DistinctKey.NumPadEnter => "KeypadEnter", + _ => k.ToString() + }; while (true) { Adapter.UpdateConfig(GlobalWin.Config); @@ -345,7 +389,7 @@ namespace BizHawk.Client.EmuHawk //analyze keys foreach (var ke in keyEvents) - HandleButton(ke.Key.ToString(), ke.Pressed, ClientInputFocus.Keyboard); + HandleButton(KeyName(ke.Key), ke.Pressed, ClientInputFocus.Keyboard); lock (_axisValues) { diff --git a/src/BizHawk.Client.EmuHawk/Input/OTK_Keyboard.cs b/src/BizHawk.Client.EmuHawk/Input/OTK_Keyboard.cs index 5e100fed3e..d442b641b4 100644 --- a/src/BizHawk.Client.EmuHawk/Input/OTK_Keyboard.cs +++ b/src/BizHawk.Client.EmuHawk/Input/OTK_Keyboard.cs @@ -28,6 +28,141 @@ namespace BizHawk.Client.EmuHawk Key.Keypad0, Key.Keypad1, Key.Keypad2, Key.Keypad3, Key.Keypad4, Key.Keypad5, Key.Keypad6, Key.Keypad7, Key.Keypad8, Key.Keypad9, Key.KeypadAdd, Key.KeypadDecimal, Key.KeypadDivide, Key.KeypadEnter, Key.KeypadMultiply, Key.KeypadSubtract }; + private static readonly IReadOnlyList KeyEnumMap = new List + { + DistinctKey.Unknown, // Unknown + DistinctKey.LeftShift, + DistinctKey.RightShift, + DistinctKey.LeftCtrl, + DistinctKey.RightCtrl, + DistinctKey.LeftAlt, + DistinctKey.RightAlt, + DistinctKey.LWin, + DistinctKey.RWin, + DistinctKey.Apps, + DistinctKey.F1, + DistinctKey.F2, + DistinctKey.F3, + DistinctKey.F4, + DistinctKey.F5, + DistinctKey.F6, + DistinctKey.F7, + DistinctKey.F8, + DistinctKey.F9, + DistinctKey.F10, + DistinctKey.F11, + DistinctKey.F12, + DistinctKey.F13, + DistinctKey.F14, + DistinctKey.F15, + DistinctKey.F16, + DistinctKey.F17, + DistinctKey.F18, + DistinctKey.F19, + DistinctKey.F20, + DistinctKey.F21, + DistinctKey.F22, + DistinctKey.F23, + DistinctKey.F24, + DistinctKey.Unknown, // F25 + DistinctKey.Unknown, // F26 + DistinctKey.Unknown, // F27 + DistinctKey.Unknown, // F28 + DistinctKey.Unknown, // F29 + DistinctKey.Unknown, // F30 + DistinctKey.Unknown, // F31 + DistinctKey.Unknown, // F32 + DistinctKey.Unknown, // F33 + DistinctKey.Unknown, // F34 + DistinctKey.Unknown, // F35 + DistinctKey.Up, + DistinctKey.Down, + DistinctKey.Left, + DistinctKey.Right, + DistinctKey.Return, + DistinctKey.Escape, + DistinctKey.Space, + DistinctKey.Tab, + DistinctKey.Back, + DistinctKey.Insert, + DistinctKey.Delete, + DistinctKey.PageUp, + DistinctKey.PageDown, + DistinctKey.Home, + DistinctKey.End, + DistinctKey.CapsLock, + DistinctKey.Scroll, // ScrollLock; my Scroll Lock key is only recognised by OpenTK as Pause tho --yoshi + DistinctKey.PrintScreen, + DistinctKey.Pause, + DistinctKey.NumLock, + DistinctKey.Clear, + DistinctKey.Sleep, + DistinctKey.NumPad0, + DistinctKey.NumPad1, + DistinctKey.NumPad2, + DistinctKey.NumPad3, + DistinctKey.NumPad4, + DistinctKey.NumPad5, + DistinctKey.NumPad6, + DistinctKey.NumPad7, + DistinctKey.NumPad8, + DistinctKey.NumPad9, + DistinctKey.Divide, + DistinctKey.Multiply, + DistinctKey.Subtract, + DistinctKey.Add, + DistinctKey.Decimal, + DistinctKey.NumPadEnter, + DistinctKey.A, + DistinctKey.B, + DistinctKey.C, + DistinctKey.D, + DistinctKey.E, + DistinctKey.F, + DistinctKey.G, + DistinctKey.H, + DistinctKey.I, + DistinctKey.J, + DistinctKey.K, + DistinctKey.L, + DistinctKey.M, + DistinctKey.N, + DistinctKey.O, + DistinctKey.P, + DistinctKey.Q, + DistinctKey.R, + DistinctKey.S, + DistinctKey.T, + DistinctKey.U, + DistinctKey.V, + DistinctKey.W, + DistinctKey.X, + DistinctKey.Y, + DistinctKey.Z, + DistinctKey.D0, + DistinctKey.D1, + DistinctKey.D2, + DistinctKey.D3, + DistinctKey.D4, + DistinctKey.D5, + DistinctKey.D6, + DistinctKey.D7, + DistinctKey.D8, + DistinctKey.D9, + DistinctKey.OemTilde, + DistinctKey.OemMinus, + DistinctKey.OemPlus, + DistinctKey.OemOpenBrackets, + DistinctKey.OemCloseBrackets, + DistinctKey.OemSemicolon, + DistinctKey.OemQuotes, + DistinctKey.OemComma, + DistinctKey.OemPeriod, + DistinctKey.OemQuestion, // Slash + DistinctKey.OemPipe, // BackSlash + DistinctKey.OemBackslash, // NonUSBackSlash + }; + private static readonly List EventList = new List(); private static KeyboardState _kbState; @@ -46,9 +181,9 @@ namespace BizHawk.Client.EmuHawk foreach (var key in KeyList) { if (lastState.IsKeyUp(key) && _kbState.IsKeyDown(key)) - EventList.Add(new KeyEvent(key, pressed: true)); + EventList.Add(new KeyEvent(KeyEnumMap[(int) key], pressed: true)); else if (lastState.IsKeyDown(key) && _kbState.IsKeyUp(key)) - EventList.Add(new KeyEvent(key, pressed: false)); + EventList.Add(new KeyEvent(KeyEnumMap[(int) key], pressed: false)); } } catch