Sunshine master
Self-hosted game stream host for Moonlight.
keylayout.h
Go to the documentation of this file.
1
5#pragma once
6
7// standard includes
8#include <array>
9#include <cstdint>
10
11namespace platf {
12 // Virtual Key to Scan Code mapping for the US English layout (00000409).
13 // GameStream uses this as the canonical key layout for scancode conversion.
17 constexpr std::array<std::uint8_t, std::numeric_limits<std::uint8_t>::max() + 1> VK_TO_SCANCODE_MAP {
18 0, /* 0x00 */
19 0, /* 0x01 */
20 0, /* 0x02 */
21 70, /* 0x03 */
22 0, /* 0x04 */
23 0, /* 0x05 */
24 0, /* 0x06 */
25 0, /* 0x07 */
26 14, /* 0x08 */
27 15, /* 0x09 */
28 0, /* 0x0a */
29 0, /* 0x0b */
30 76, /* 0x0c */
31 28, /* 0x0d */
32 0, /* 0x0e */
33 0, /* 0x0f */
34 42, /* 0x10 */
35 29, /* 0x11 */
36 56, /* 0x12 */
37 0, /* 0x13 */
38 58, /* 0x14 */
39 0, /* 0x15 */
40 0, /* 0x16 */
41 0, /* 0x17 */
42 0, /* 0x18 */
43 0, /* 0x19 */
44 0, /* 0x1a */
45 1, /* 0x1b */
46 0, /* 0x1c */
47 0, /* 0x1d */
48 0, /* 0x1e */
49 0, /* 0x1f */
50 57, /* 0x20 */
51 73, /* 0x21 */
52 81, /* 0x22 */
53 79, /* 0x23 */
54 71, /* 0x24 */
55 75, /* 0x25 */
56 72, /* 0x26 */
57 77, /* 0x27 */
58 80, /* 0x28 */
59 0, /* 0x29 */
60 0, /* 0x2a */
61 0, /* 0x2b */
62 84, /* 0x2c */
63 82, /* 0x2d */
64 83, /* 0x2e */
65 99, /* 0x2f */
66 11, /* 0x30 */
67 2, /* 0x31 */
68 3, /* 0x32 */
69 4, /* 0x33 */
70 5, /* 0x34 */
71 6, /* 0x35 */
72 7, /* 0x36 */
73 8, /* 0x37 */
74 9, /* 0x38 */
75 10, /* 0x39 */
76 0, /* 0x3a */
77 0, /* 0x3b */
78 0, /* 0x3c */
79 0, /* 0x3d */
80 0, /* 0x3e */
81 0, /* 0x3f */
82 0, /* 0x40 */
83 30, /* 0x41 */
84 48, /* 0x42 */
85 46, /* 0x43 */
86 32, /* 0x44 */
87 18, /* 0x45 */
88 33, /* 0x46 */
89 34, /* 0x47 */
90 35, /* 0x48 */
91 23, /* 0x49 */
92 36, /* 0x4a */
93 37, /* 0x4b */
94 38, /* 0x4c */
95 50, /* 0x4d */
96 49, /* 0x4e */
97 24, /* 0x4f */
98 25, /* 0x50 */
99 16, /* 0x51 */
100 19, /* 0x52 */
101 31, /* 0x53 */
102 20, /* 0x54 */
103 22, /* 0x55 */
104 47, /* 0x56 */
105 17, /* 0x57 */
106 45, /* 0x58 */
107 21, /* 0x59 */
108 44, /* 0x5a */
109 91, /* 0x5b */
110 92, /* 0x5c */
111 93, /* 0x5d */
112 0, /* 0x5e */
113 95, /* 0x5f */
114 82, /* 0x60 */
115 79, /* 0x61 */
116 80, /* 0x62 */
117 81, /* 0x63 */
118 75, /* 0x64 */
119 76, /* 0x65 */
120 77, /* 0x66 */
121 71, /* 0x67 */
122 72, /* 0x68 */
123 73, /* 0x69 */
124 55, /* 0x6a */
125 78, /* 0x6b */
126 0, /* 0x6c */
127 74, /* 0x6d */
128 83, /* 0x6e */
129 53, /* 0x6f */
130 59, /* 0x70 */
131 60, /* 0x71 */
132 61, /* 0x72 */
133 62, /* 0x73 */
134 63, /* 0x74 */
135 64, /* 0x75 */
136 65, /* 0x76 */
137 66, /* 0x77 */
138 67, /* 0x78 */
139 68, /* 0x79 */
140 87, /* 0x7a */
141 88, /* 0x7b */
142 100, /* 0x7c */
143 101, /* 0x7d */
144 102, /* 0x7e */
145 103, /* 0x7f */
146 104, /* 0x80 */
147 105, /* 0x81 */
148 106, /* 0x82 */
149 107, /* 0x83 */
150 108, /* 0x84 */
151 109, /* 0x85 */
152 110, /* 0x86 */
153 118, /* 0x87 */
154 0, /* 0x88 */
155 0, /* 0x89 */
156 0, /* 0x8a */
157 0, /* 0x8b */
158 0, /* 0x8c */
159 0, /* 0x8d */
160 0, /* 0x8e */
161 0, /* 0x8f */
162 69, /* 0x90 */
163 70, /* 0x91 */
164 0, /* 0x92 */
165 0, /* 0x93 */
166 0, /* 0x94 */
167 0, /* 0x95 */
168 0, /* 0x96 */
169 0, /* 0x97 */
170 0, /* 0x98 */
171 0, /* 0x99 */
172 0, /* 0x9a */
173 0, /* 0x9b */
174 0, /* 0x9c */
175 0, /* 0x9d */
176 0, /* 0x9e */
177 0, /* 0x9f */
178 42, /* 0xa0 */
179 54, /* 0xa1 */
180 29, /* 0xa2 */
181 29, /* 0xa3 */
182 56, /* 0xa4 */
183 56, /* 0xa5 */
184 106, /* 0xa6 */
185 105, /* 0xa7 */
186 103, /* 0xa8 */
187 104, /* 0xa9 */
188 101, /* 0xaa */
189 102, /* 0xab */
190 50, /* 0xac */
191 32, /* 0xad */
192 46, /* 0xae */
193 48, /* 0xaf */
194 25, /* 0xb0 */
195 16, /* 0xb1 */
196 36, /* 0xb2 */
197 34, /* 0xb3 */
198 108, /* 0xb4 */
199 109, /* 0xb5 */
200 107, /* 0xb6 */
201 33, /* 0xb7 */
202 0, /* 0xb8 */
203 0, /* 0xb9 */
204 39, /* 0xba */
205 13, /* 0xbb */
206 51, /* 0xbc */
207 12, /* 0xbd */
208 52, /* 0xbe */
209 53, /* 0xbf */
210 41, /* 0xc0 */
211 115, /* 0xc1 */
212 126, /* 0xc2 */
213 0, /* 0xc3 */
214 0, /* 0xc4 */
215 0, /* 0xc5 */
216 0, /* 0xc6 */
217 0, /* 0xc7 */
218 0, /* 0xc8 */
219 0, /* 0xc9 */
220 0, /* 0xca */
221 0, /* 0xcb */
222 0, /* 0xcc */
223 0, /* 0xcd */
224 0, /* 0xce */
225 0, /* 0xcf */
226 0, /* 0xd0 */
227 0, /* 0xd1 */
228 0, /* 0xd2 */
229 0, /* 0xd3 */
230 0, /* 0xd4 */
231 0, /* 0xd5 */
232 0, /* 0xd6 */
233 0, /* 0xd7 */
234 0, /* 0xd8 */
235 0, /* 0xd9 */
236 0, /* 0xda */
237 26, /* 0xdb */
238 43, /* 0xdc */
239 27, /* 0xdd */
240 40, /* 0xde */
241 0, /* 0xdf */
242 0, /* 0xe0 */
243 0, /* 0xe1 */
244 86, /* 0xe2 */
245 0, /* 0xe3 */
246 0, /* 0xe4 */
247 0, /* 0xe5 */
248 0, /* 0xe6 */
249 0, /* 0xe7 */
250 0, /* 0xe8 */
251 113, /* 0xe9 */
252 92, /* 0xea */
253 123, /* 0xeb */
254 0, /* 0xec */
255 111, /* 0xed */
256 90, /* 0xee */
257 0, /* 0xef */
258 0, /* 0xf0 */
259 91, /* 0xf1 */
260 0, /* 0xf2 */
261 95, /* 0xf3 */
262 0, /* 0xf4 */
263 94, /* 0xf5 */
264 0, /* 0xf6 */
265 0, /* 0xf7 */
266 0, /* 0xf8 */
267 93, /* 0xf9 */
268 0, /* 0xfa */
269 98, /* 0xfb */
270 0, /* 0xfc */
271 0, /* 0xfd */
272 0, /* 0xfe */
273 0, /* 0xff */
274 };
275} // namespace platf
constexpr std::array< std::uint8_t, std::numeric_limits< std::uint8_t >::max()+1 > VK_TO_SCANCODE_MAP
Protocol or platform constant for vk to scancode map.
Definition keylayout.h:17