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