0
|
1 #include "OSAPI.h"
|
|
2
|
|
3 #include "Keyboard.h"
|
|
4 #include "GUIWindow.h"
|
|
5 #include "Game.h"
|
|
6 #include "OSInfo.h"
|
|
7
|
|
8 #include "mm7_data.h"
|
|
9
|
|
10
|
|
11
|
|
12
|
|
13
|
|
14
|
|
15 struct KeyboardActionMapping *pKeyActionMap;
|
|
16 struct AsyncKeyboard *pAsyncKeyboard;
|
|
17
|
|
18
|
|
19
|
|
20
|
|
21
|
|
22 //----- (00459C68) --------------------------------------------------------
|
|
23 void KeyboardActionMapping::SetKeyMapping(int uAction, int vKey, KeyToggleType type)
|
|
24 {
|
|
25 pVirtualKeyCodesMapping[uAction] = vKey;
|
|
26 pToggleTypes[uAction] = type;
|
|
27 }
|
|
28
|
|
29 //----- (00459C82) --------------------------------------------------------
|
|
30 unsigned int KeyboardActionMapping::GetActionVKey(enum InputAction eAction)
|
|
31 {
|
|
32 return this->pVirtualKeyCodesMapping[eAction];
|
|
33 }
|
|
34
|
|
35 //----- (00459C8D) --------------------------------------------------------
|
|
36 KeyboardActionMapping::KeyboardActionMapping()
|
|
37 {
|
|
38 uLastKeyPressed = 0;
|
271
|
39 field_204 = 0;
|
323
|
40 pWindow = nullptr;
|
0
|
41
|
|
42 SetDefaultMapping();
|
|
43 ReadMappings();
|
|
44
|
|
45 ResetKeys();
|
|
46
|
1031
|
47 uGameMenuUI_CurentlySelectedKeyIdx = -1;
|
0
|
48 }
|
1031
|
49 // 506E68: using guessed type int uGameMenuUI_CurentlySelectedKeyIdx;
|
0
|
50
|
|
51 //----- (00459CC4) --------------------------------------------------------
|
|
52 void KeyboardActionMapping::SetDefaultMapping()
|
|
53 {
|
|
54 pVirtualKeyCodesMapping[0] = VK_UP;
|
|
55 pToggleTypes[0] = TOGGLE_Continuously;
|
|
56 pVirtualKeyCodesMapping[1] = VK_DOWN;
|
|
57 pToggleTypes[1] = TOGGLE_Continuously;
|
|
58 pVirtualKeyCodesMapping[2] = VK_LEFT;
|
|
59 pToggleTypes[2] = TOGGLE_Continuously;
|
|
60 pVirtualKeyCodesMapping[3] = VK_RIGHT;
|
|
61 pToggleTypes[3] = TOGGLE_Continuously;
|
|
62 pVirtualKeyCodesMapping[8] = 'A';
|
|
63 pToggleTypes[8] = TOGGLE_OneTimePress;
|
|
64 pVirtualKeyCodesMapping[7] = 'S';
|
|
65 pToggleTypes[7] = TOGGLE_OneTimePress;
|
|
66 pVirtualKeyCodesMapping[4] = 'Y';
|
|
67 pToggleTypes[4] = TOGGLE_OneTimePress;
|
|
68 pVirtualKeyCodesMapping[5] = 'X';
|
|
69 pToggleTypes[5] = TOGGLE_OneTimePress;
|
|
70 pVirtualKeyCodesMapping[6] = VK_RETURN;
|
|
71 pToggleTypes[6] = TOGGLE_OneTimePress;
|
|
72 pVirtualKeyCodesMapping[9] = VK_SPACE;
|
|
73 pToggleTypes[9] = TOGGLE_OneTimePress;
|
|
74 pVirtualKeyCodesMapping[10] = 'C';
|
|
75 pToggleTypes[10] = TOGGLE_OneTimePress;
|
|
76 pVirtualKeyCodesMapping[11] = 'B';
|
|
77 pToggleTypes[11] = TOGGLE_OneTimePress;
|
|
78 pVirtualKeyCodesMapping[12] = VK_TAB;
|
|
79 pToggleTypes[12] = TOGGLE_OneTimePress;
|
|
80 pVirtualKeyCodesMapping[13] = 'Q';
|
|
81 pToggleTypes[13] = TOGGLE_OneTimePress;
|
|
82 pVirtualKeyCodesMapping[14] = 'Z';
|
|
83 pToggleTypes[14] = TOGGLE_OneTimePress;
|
|
84 pVirtualKeyCodesMapping[15] = 'R';
|
|
85 pToggleTypes[15] = TOGGLE_OneTimePress;
|
|
86 pVirtualKeyCodesMapping[16] = 'T';
|
|
87 pToggleTypes[16] = TOGGLE_OneTimePress;
|
|
88 pVirtualKeyCodesMapping[17] = 'N';
|
|
89 pToggleTypes[17] = TOGGLE_OneTimePress;
|
|
90 pVirtualKeyCodesMapping[18] = 'M';
|
|
91 pToggleTypes[18] = TOGGLE_OneTimePress;
|
|
92 pVirtualKeyCodesMapping[20] = VK_NEXT;
|
|
93 pToggleTypes[20] = TOGGLE_Continuously;
|
|
94 pVirtualKeyCodesMapping[21] = VK_DELETE;
|
|
95 pToggleTypes[21] = TOGGLE_Continuously;
|
|
96
|
|
97 SetKeyMapping(INPUT_CenterView, VK_END, TOGGLE_Continuously);
|
|
98 SetKeyMapping(INPUT_ZoomIn, VK_ADD, TOGGLE_OneTimePress);
|
|
99 SetKeyMapping(INPUT_ZoomOut, VK_SUBTRACT, TOGGLE_OneTimePress);
|
|
100 SetKeyMapping(INPUT_FlyUp, VK_PRIOR, TOGGLE_Continuously);
|
|
101 SetKeyMapping(INPUT_FlyDown, VK_INSERT, TOGGLE_Continuously);
|
|
102 SetKeyMapping(INPUT_Land, VK_HOME, TOGGLE_OneTimePress);
|
|
103 SetKeyMapping(INPUT_AlwaysRun, 'U', TOGGLE_OneTimePress);
|
|
104 SetKeyMapping(INPUT_StrafeLeft, VK_OEM_4, TOGGLE_Continuously);
|
|
105 SetKeyMapping(INPUT_StrafeRight, VK_OEM_6, TOGGLE_Continuously);
|
|
106 }
|
|
107
|
|
108 //----- (00459E3F) --------------------------------------------------------
|
|
109 void KeyboardActionMapping::ResetKeys()
|
|
110 {
|
|
111 for (uint i = 0; i < 30; ++i)
|
|
112 GetAsyncKeyState(pVirtualKeyCodesMapping[i]);
|
|
113 }
|
|
114
|
|
115 //----- (00459E5A) --------------------------------------------------------
|
1038
|
116 void KeyboardActionMapping::EnterText(int a2, int max_string_len, GUIWindow *pWindow)
|
0
|
117 {
|
|
118 KeyboardActionMapping *v4; // esi@1
|
|
119
|
|
120 v4 = this;
|
|
121 memset(this->pPressedKeysBuffer, 0, 0x101u);
|
|
122 v4->uNumKeysPressed = 0;
|
|
123 if ( a2 )
|
|
124 v4->field_204 = 2;
|
|
125 else
|
|
126 v4->field_204 = 1;
|
1038
|
127 v4->max_input_string_len = max_string_len;
|
0
|
128 v4->pWindow = pWindow;
|
1038
|
129 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_IN_PROGRESS;
|
0
|
130 }
|
|
131
|
|
132 //----- (00459ED1) --------------------------------------------------------
|
1038
|
133 void KeyboardActionMapping::SetWindowInputStatus(int a2)
|
0
|
134 {
|
1038
|
135 field_204 = 0;
|
|
136 if ( pWindow )
|
|
137 pWindow->receives_keyboard_input_2 = a2;
|
0
|
138 }
|
|
139
|
|
140 //----- (00459F10) --------------------------------------------------------
|
|
141 bool KeyboardActionMapping::_459F10(unsigned int a2)
|
|
142 {
|
|
143 int v3; // [sp-4h] [bp-4h]@3
|
|
144
|
|
145 pKeyActionMap->uLastKeyPressed = a2;
|
1031
|
146 if ( uGameMenuUI_CurentlySelectedKeyIdx == -1 )
|
0
|
147 {
|
|
148 if ( pKeyActionMap->field_204 == 1 )
|
|
149 {
|
|
150 if ( a2 != 8 )
|
|
151 {
|
|
152 if ( a2 == 9 )
|
|
153 return 1;
|
|
154 if ( a2 == 13 )
|
|
155 goto LABEL_3;
|
|
156 if ( a2 == 27 )
|
|
157 goto LABEL_15;
|
1038
|
158 if ( this->uNumKeysPressed >= this->max_input_string_len )
|
0
|
159 return 1;
|
|
160 pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = a2;
|
|
161 ++pKeyActionMap->uNumKeysPressed;
|
|
162 LABEL_24:
|
|
163 pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = 0;
|
|
164 return 1;
|
|
165 }
|
|
166 }
|
|
167 else
|
|
168 {
|
|
169 if ( pKeyActionMap->field_204 != 2 )
|
|
170 return 0;
|
|
171 if ( a2 != 8 )
|
|
172 {
|
|
173 if ( a2 == 13 )
|
|
174 goto LABEL_3;
|
|
175 if ( a2 != 27 )
|
|
176 {
|
|
177 if ( (signed int)a2 >= 48 && (signed int)a2 <= 57 )
|
|
178 {
|
1038
|
179 if ( pKeyActionMap->uNumKeysPressed < this->max_input_string_len )
|
0
|
180 {
|
|
181 pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = a2;
|
|
182 ++pKeyActionMap->uNumKeysPressed;
|
|
183 }
|
|
184 }
|
|
185 return 1;
|
|
186 }
|
|
187 LABEL_15:
|
|
188 v3 = 3;
|
|
189 goto LABEL_4;
|
|
190 }
|
|
191 }
|
|
192 if ( !pKeyActionMap->uNumKeysPressed )
|
|
193 return 1;
|
|
194 --pKeyActionMap->uNumKeysPressed;
|
|
195 goto LABEL_24;
|
|
196 }
|
|
197 pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = a2;
|
|
198 ++pKeyActionMap->uNumKeysPressed;
|
|
199 pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = 0;
|
|
200 LABEL_3:
|
|
201 v3 = 2;
|
|
202 LABEL_4:
|
1038
|
203 pKeyActionMap->SetWindowInputStatus(v3);
|
0
|
204 return 1;
|
|
205 }
|
1031
|
206 // 506E68: using guessed type int uGameMenuUI_CurentlySelectedKeyIdx;
|
0
|
207
|
|
208 //----- (00459FFC) --------------------------------------------------------
|
|
209 void KeyboardActionMapping::ReadMappings()
|
|
210 {
|
|
211 //KeyboardActionMapping *v1; // esi@1
|
|
212 int v2; // eax@2
|
|
213 unsigned int v3; // eax@3
|
|
214 int v4; // eax@6
|
|
215 unsigned int v5; // eax@7
|
|
216 int v6; // eax@10
|
|
217 unsigned int v7; // eax@11
|
|
218 int v8; // eax@14
|
|
219 unsigned int v9; // eax@15
|
|
220 int v10; // eax@18
|
|
221 unsigned int v11; // eax@19
|
|
222 int v12; // eax@22
|
|
223 //unsigned int v13; // eax@23
|
|
224 int v14; // eax@26
|
|
225 //unsigned int v15; // eax@27
|
|
226 int v16; // eax@30
|
|
227 //unsigned int v17; // eax@31
|
|
228 int v18; // eax@34
|
|
229 //unsigned int v19; // eax@35
|
|
230 int v20; // eax@38
|
|
231 //unsigned int v21; // eax@39
|
|
232 int v22; // eax@42
|
|
233 //unsigned int v23; // eax@43
|
|
234 int v24; // eax@46
|
|
235 //unsigned int v25; // eax@47
|
|
236 int v26; // eax@50
|
|
237 //unsigned int v27; // eax@51
|
|
238 int v28; // eax@54
|
|
239 //unsigned int v29; // eax@55
|
|
240 int v30; // eax@58
|
|
241 //unsigned int v31; // eax@59
|
|
242 int v32; // eax@62
|
|
243 //unsigned int v33; // eax@63
|
|
244 int v34; // eax@66
|
|
245 //unsigned int v35; // eax@67
|
|
246 int v36; // eax@70
|
|
247 //unsigned int v37; // eax@71
|
|
248 int v38; // eax@74
|
|
249 //unsigned int v39; // eax@75
|
|
250 int v40; // eax@78
|
|
251 //unsigned int v41; // eax@79
|
|
252 int v42; // eax@82
|
|
253 //unsigned int v43; // eax@83
|
|
254 int v44; // eax@86
|
|
255 //unsigned int v45; // eax@87
|
|
256 int v46; // eax@90
|
|
257 //unsigned int v47; // eax@91
|
|
258 int v48; // eax@94
|
|
259 //unsigned int v49; // eax@95
|
|
260 int v50; // eax@98
|
|
261 //unsigned int v51; // eax@99
|
|
262 int v52; // eax@102
|
|
263 //unsigned int v53; // eax@103
|
|
264 int v54; // eax@106
|
|
265 //unsigned int v55; // eax@107
|
|
266 int v56; // eax@110
|
|
267 unsigned int v57; // eax@111
|
|
268 int v58; // eax@114
|
|
269 unsigned int v59; // eax@115
|
|
270 int v60; // eax@118
|
|
271 unsigned int v61; // eax@119
|
|
272 //char str[32]; // [sp+Ch] [bp-20h]@1
|
|
273
|
|
274 char str[32];
|
|
275
|
|
276 ReadWindowsRegistryString("KEY_FORWARD", str, 32, "DEFAULT");
|
|
277 if ( strcmp(str, "DEFAULT") && (LOBYTE(v2) = GetActionDefaultVKey(str), v2 != -1) )
|
|
278 {
|
|
279 pVirtualKeyCodesMapping[0] = GetActionDefaultVKey(str);
|
|
280 }
|
|
281 else
|
|
282 {
|
|
283 pVirtualKeyCodesMapping[0] = VK_UP;
|
|
284 }
|
|
285 pToggleTypes[0] = TOGGLE_Continuously;
|
|
286 ReadWindowsRegistryString("KEY_BACKWARD", str, 0x20u, "DEFAULT");
|
|
287 if ( strcmp(str, "DEFAULT") && (LOBYTE(v4) = GetActionDefaultVKey(str), v4 != -1) )
|
|
288 {
|
|
289 pVirtualKeyCodesMapping[1] = GetActionDefaultVKey(str);
|
|
290 }
|
|
291 else
|
|
292 {
|
|
293 pVirtualKeyCodesMapping[1] = VK_DOWN;
|
|
294 }
|
|
295 pToggleTypes[1] = TOGGLE_Continuously;
|
|
296
|
|
297 ReadWindowsRegistryString("KEY_LEFT", str, 0x20u, "DEFAULT");
|
|
298 if ( strcmp(str, "DEFAULT") && (LOBYTE(v6) = GetActionDefaultVKey(str), v6 != -1) )
|
|
299 {
|
|
300 pVirtualKeyCodesMapping[2] = GetActionDefaultVKey(str);
|
|
301 }
|
|
302 else
|
|
303 {
|
|
304 pVirtualKeyCodesMapping[2] = VK_LEFT;
|
|
305 }
|
|
306 pToggleTypes[2] = TOGGLE_Continuously;
|
|
307
|
|
308 ReadWindowsRegistryString("KEY_RIGHT", str, 0x20u, "DEFAULT");
|
|
309 if ( strcmp(str, "DEFAULT") && (LOBYTE(v8) = GetActionDefaultVKey(str), v8 != -1) )
|
|
310 {
|
|
311 pVirtualKeyCodesMapping[3] = GetActionDefaultVKey(str);
|
|
312 }
|
|
313 else
|
|
314 {
|
|
315 pVirtualKeyCodesMapping[3] = VK_RIGHT;
|
|
316 }
|
|
317 pToggleTypes[3] = TOGGLE_Continuously;
|
|
318
|
|
319 ReadWindowsRegistryString("KEY_ATTACK", str, 0x20u, "DEFAULT");
|
|
320 if ( strcmp(str, "DEFAULT") && (LOBYTE(v10) = GetActionDefaultVKey(str), v10 != -1) )
|
|
321 {
|
|
322 pVirtualKeyCodesMapping[8] = GetActionDefaultVKey(str);
|
|
323 }
|
|
324 else
|
|
325 {
|
|
326 pVirtualKeyCodesMapping[8] = 'A';
|
|
327 }
|
|
328 pToggleTypes[8] = TOGGLE_OneTimePress;
|
|
329
|
|
330 ReadWindowsRegistryString("KEY_CASTREADY", str, 0x20u, "DEFAULT");
|
|
331 if ( strcmp(str, "DEFAULT") && (LOBYTE(v12) = GetActionDefaultVKey(str), v12 != -1) )
|
|
332 {
|
|
333 pVirtualKeyCodesMapping[7] = GetActionDefaultVKey(str);
|
|
334 }
|
|
335 else
|
|
336 {
|
|
337 pVirtualKeyCodesMapping[7] = 'S';
|
|
338 }
|
|
339 pToggleTypes[7] = TOGGLE_OneTimePress;
|
|
340
|
|
341 ReadWindowsRegistryString("KEY_YELL", str, 0x20u, "DEFAULT");
|
|
342 if ( strcmp(str, "DEFAULT") && (LOBYTE(v14) = GetActionDefaultVKey(str), v14 != -1) )
|
|
343 {
|
|
344 pVirtualKeyCodesMapping[4] = GetActionDefaultVKey(str);
|
|
345 }
|
|
346 else
|
|
347 {
|
|
348 pVirtualKeyCodesMapping[4] = 'Y';
|
|
349 }
|
|
350 pToggleTypes[4] = TOGGLE_OneTimePress;
|
|
351
|
|
352 ReadWindowsRegistryString("KEY_JUMP", str, 0x20u, "DEFAULT");
|
|
353 if ( strcmp(str, "DEFAULT") && (LOBYTE(v16) = GetActionDefaultVKey(str), v16 != -1) )
|
|
354 {
|
|
355 pVirtualKeyCodesMapping[5] = GetActionDefaultVKey(str);
|
|
356 }
|
|
357 else
|
|
358 {
|
|
359 pVirtualKeyCodesMapping[5] = 'X';
|
|
360 }
|
|
361 pToggleTypes[5] = TOGGLE_OneTimePress;
|
|
362
|
|
363 ReadWindowsRegistryString("KEY_COMBAT", str, 0x20u, "DEFAULT");
|
|
364 if ( strcmp(str, "DEFAULT") && (LOBYTE(v18) = GetActionDefaultVKey(str), v18 != -1) )
|
|
365 {
|
|
366 pVirtualKeyCodesMapping[6] = GetActionDefaultVKey(str);
|
|
367 }
|
|
368 else
|
|
369 {
|
|
370 pVirtualKeyCodesMapping[6] = VK_RETURN;
|
|
371 }
|
|
372 pToggleTypes[6] = TOGGLE_OneTimePress;
|
|
373
|
|
374 ReadWindowsRegistryString("KEY_EVENTTRIGGER", str, 0x20u, "DEFAULT");
|
|
375 if ( strcmp(str, "DEFAULT") && (LOBYTE(v20) = GetActionDefaultVKey(str), v20 != -1) )
|
|
376 {
|
|
377 pVirtualKeyCodesMapping[9] = GetActionDefaultVKey(str);
|
|
378 }
|
|
379 else
|
|
380 {
|
|
381 pVirtualKeyCodesMapping[9] = VK_SPACE;
|
|
382 }
|
|
383 pToggleTypes[9] = TOGGLE_OneTimePress;
|
|
384
|
|
385 ReadWindowsRegistryString("KEY_CAST", str, 0x20u, "DEFAULT");
|
|
386 if ( strcmp(str, "DEFAULT") && (LOBYTE(v22) = GetActionDefaultVKey(str), v22 != -1) )
|
|
387 {
|
|
388 pVirtualKeyCodesMapping[10] = GetActionDefaultVKey(str);
|
|
389 }
|
|
390 else
|
|
391 {
|
|
392 pVirtualKeyCodesMapping[10] = 'C';
|
|
393 }
|
|
394 pToggleTypes[10] = TOGGLE_OneTimePress;
|
|
395
|
|
396 ReadWindowsRegistryString("KEY_PASS", str, 0x20u, "DEFAULT");
|
|
397 if ( strcmp(str, "DEFAULT") && (LOBYTE(v24) = GetActionDefaultVKey(str), v24 != -1) )
|
|
398 {
|
|
399 pVirtualKeyCodesMapping[11] = GetActionDefaultVKey(str);
|
|
400 }
|
|
401 else
|
|
402 {
|
|
403 pVirtualKeyCodesMapping[11] = 'B';
|
|
404 }
|
|
405 pToggleTypes[11] = TOGGLE_OneTimePress;
|
|
406
|
|
407 ReadWindowsRegistryString("KEY_CHARCYCLE", str, 0x20u, "DEFAULT");
|
|
408 if ( strcmp(str, "DEFAULT") && (LOBYTE(v26) = GetActionDefaultVKey(str), v26 != -1) )
|
|
409 {
|
|
410 pVirtualKeyCodesMapping[12] = GetActionDefaultVKey(str);
|
|
411 }
|
|
412 else
|
|
413 {
|
|
414 pVirtualKeyCodesMapping[12] = VK_TAB;
|
|
415 }
|
|
416 pToggleTypes[12] = TOGGLE_OneTimePress;
|
|
417
|
|
418 ReadWindowsRegistryString("KEY_QUEST", str, 0x20u, "DEFAULT");
|
|
419 if ( strcmp(str, "DEFAULT") && (LOBYTE(v28) = GetActionDefaultVKey(str), v28 != -1) )
|
|
420 {
|
|
421 pVirtualKeyCodesMapping[13] = GetActionDefaultVKey(str);
|
|
422 }
|
|
423 else
|
|
424 {
|
|
425 pVirtualKeyCodesMapping[13] = 'Q';
|
|
426 }
|
|
427 pToggleTypes[13] = TOGGLE_OneTimePress;
|
|
428
|
|
429 ReadWindowsRegistryString("KEY_QUICKREF", str, 0x20u, "DEFAULT");
|
|
430 if ( strcmp(str, "DEFAULT") && (LOBYTE(v30) = GetActionDefaultVKey(str), v30 != -1) )
|
|
431 {
|
|
432 pVirtualKeyCodesMapping[14] = GetActionDefaultVKey(str);
|
|
433 }
|
|
434 else
|
|
435 {
|
|
436 pVirtualKeyCodesMapping[14] = 'Z';
|
|
437 }
|
|
438 pToggleTypes[14] = TOGGLE_OneTimePress;
|
|
439
|
|
440 ReadWindowsRegistryString("KEY_REST", str, 0x20u, "DEFAULT");
|
|
441 if ( strcmp(str, "DEFAULT") && (LOBYTE(v32) = GetActionDefaultVKey(str), v32 != -1) )
|
|
442 {
|
|
443 pVirtualKeyCodesMapping[15] = GetActionDefaultVKey(str);
|
|
444 }
|
|
445 else
|
|
446 {
|
|
447 pVirtualKeyCodesMapping[15] = 'R';
|
|
448 }
|
|
449 pToggleTypes[15] = TOGGLE_OneTimePress;
|
|
450
|
|
451 ReadWindowsRegistryString("KEY_TIMECAL", str, 0x20u, "DEFAULT");
|
|
452 if ( strcmp(str, "DEFAULT") && (LOBYTE(v34) = GetActionDefaultVKey(str), v34 != -1) )
|
|
453 {
|
|
454 pVirtualKeyCodesMapping[16] = GetActionDefaultVKey(str);
|
|
455 }
|
|
456 else
|
|
457 {
|
|
458 pVirtualKeyCodesMapping[16] = 'T';
|
|
459 }
|
|
460 pToggleTypes[16] = TOGGLE_OneTimePress;
|
|
461
|
|
462 ReadWindowsRegistryString("KEY_AUTONOTES", str, 0x20u, "DEFAULT");
|
|
463 if ( strcmp(str, "DEFAULT") && (LOBYTE(v36) = GetActionDefaultVKey(str), v36 != -1) )
|
|
464 {
|
|
465 pVirtualKeyCodesMapping[17] = GetActionDefaultVKey(str);
|
|
466 }
|
|
467 else
|
|
468 {
|
|
469 pVirtualKeyCodesMapping[17] = 'N';
|
|
470 }
|
|
471 pToggleTypes[17] = TOGGLE_OneTimePress;
|
|
472
|
|
473 ReadWindowsRegistryString("KEY_MAPBOOK", str, 0x20u, "DEFAULT");
|
|
474 if ( strcmp(str, "DEFAULT") && (LOBYTE(v38) = GetActionDefaultVKey(str), v38 != -1) )
|
|
475 {
|
|
476 pVirtualKeyCodesMapping[18] = GetActionDefaultVKey(str);
|
|
477 }
|
|
478 else
|
|
479 {
|
|
480 pVirtualKeyCodesMapping[18] = 'M';
|
|
481 }
|
|
482 pToggleTypes[18] = TOGGLE_OneTimePress;
|
|
483
|
|
484 ReadWindowsRegistryString("KEY_LOOKUP", str, 0x20u, "DEFAULT");
|
|
485 if ( strcmp(str, "DEFAULT") && (LOBYTE(v40) = GetActionDefaultVKey(str), v40 != -1) )
|
|
486 {
|
|
487 pVirtualKeyCodesMapping[20] = GetActionDefaultVKey(str);
|
|
488 }
|
|
489 else
|
|
490 {
|
|
491 pVirtualKeyCodesMapping[20] = VK_NEXT;
|
|
492 }
|
|
493 pToggleTypes[20] = TOGGLE_OneTimePress;
|
|
494
|
|
495 ReadWindowsRegistryString("KEY_LOOKDOWN", str, 0x20u, "DEFAULT");
|
|
496 if ( strcmp(str, "DEFAULT") && (LOBYTE(v42) = GetActionDefaultVKey(str), v42 != -1) )
|
|
497 {
|
|
498 pVirtualKeyCodesMapping[21] = GetActionDefaultVKey(str);
|
|
499 }
|
|
500 else
|
|
501 {
|
|
502 pVirtualKeyCodesMapping[21] = VK_DELETE;
|
|
503 }
|
|
504 pToggleTypes[21] = TOGGLE_OneTimePress;
|
|
505
|
|
506 ReadWindowsRegistryString("KEY_CENTERVIEWPT", str, 0x20u, "DEFAULT");
|
|
507 if ( strcmp(str, "DEFAULT") && (LOBYTE(v44) = GetActionDefaultVKey(str), v44 != -1) )
|
|
508 {
|
|
509 pVirtualKeyCodesMapping[22] = GetActionDefaultVKey(str);
|
|
510 }
|
|
511 else
|
|
512 {
|
|
513 pVirtualKeyCodesMapping[22] = VK_END;
|
|
514 }
|
|
515 pToggleTypes[22] = TOGGLE_OneTimePress;
|
|
516
|
|
517 ReadWindowsRegistryString("KEY_ZOOMIN", str, 0x20u, "DEFAULT");
|
|
518 if ( strcmp(str, "DEFAULT") && (LOBYTE(v46) = GetActionDefaultVKey(str), v46 != -1) )
|
|
519 {
|
|
520 pVirtualKeyCodesMapping[23] = GetActionDefaultVKey(str);
|
|
521 }
|
|
522 else
|
|
523 {
|
|
524 pVirtualKeyCodesMapping[23] = VK_ADD;
|
|
525 }
|
|
526 pToggleTypes[23] = TOGGLE_OneTimePress;
|
|
527
|
|
528 ReadWindowsRegistryString("KEY_ZOOMOUT", str, 0x20u, "DEFAULT");
|
|
529 if ( strcmp(str, "DEFAULT") && (LOBYTE(v48) = GetActionDefaultVKey(str), v48 != -1) )
|
|
530 {
|
|
531 pVirtualKeyCodesMapping[24] = GetActionDefaultVKey(str);
|
|
532 }
|
|
533 else
|
|
534 {
|
|
535 pVirtualKeyCodesMapping[24] = VK_SUBTRACT;
|
|
536 }
|
|
537 pToggleTypes[24] = TOGGLE_OneTimePress;
|
|
538
|
|
539 ReadWindowsRegistryString("KEY_FLYUP", str, 0x20u, "DEFAULT");
|
|
540 if ( strcmp(str, "DEFAULT") && (LOBYTE(v50) = GetActionDefaultVKey(str), v50 != -1) )
|
|
541 {
|
|
542 pVirtualKeyCodesMapping[25] = GetActionDefaultVKey(str);
|
|
543 }
|
|
544 else
|
|
545 {
|
|
546 pVirtualKeyCodesMapping[25] = VK_PRIOR;
|
|
547 }
|
|
548 pToggleTypes[25] = TOGGLE_Continuously;
|
|
549
|
|
550 ReadWindowsRegistryString("KEY_FLYDOWN", str, 0x20u, "DEFAULT");
|
|
551 if ( strcmp(str, "DEFAULT") && (LOBYTE(v52) = GetActionDefaultVKey(str), v52 != -1) )
|
|
552 {
|
|
553 pVirtualKeyCodesMapping[26] = GetActionDefaultVKey(str);
|
|
554 }
|
|
555 else
|
|
556 {
|
|
557 pVirtualKeyCodesMapping[26] = VK_INSERT;
|
|
558 }
|
|
559 pToggleTypes[26] = TOGGLE_Continuously;
|
|
560
|
|
561 ReadWindowsRegistryString("KEY_LAND", str, 0x20u, "DEFAULT");
|
|
562 if ( strcmp(str, "DEFAULT") && (LOBYTE(v54) = GetActionDefaultVKey(str), v54 != -1) )
|
|
563 {
|
|
564 pVirtualKeyCodesMapping[27] = GetActionDefaultVKey(str);
|
|
565 }
|
|
566 else
|
|
567 {
|
|
568 pVirtualKeyCodesMapping[27] = VK_HOME;
|
|
569 }
|
|
570 pToggleTypes[27] = TOGGLE_OneTimePress;
|
|
571
|
|
572 ReadWindowsRegistryString("KEY_ALWAYSRUN", str, 0x20u, "DEFAULT");
|
|
573 if ( strcmp(str, "DEFAULT") && (LOBYTE(v56) = GetActionDefaultVKey(str), v56 != -1) )
|
|
574 {
|
|
575 pVirtualKeyCodesMapping[19] = GetActionDefaultVKey(str);
|
|
576 }
|
|
577 else
|
|
578 {
|
|
579 pVirtualKeyCodesMapping[19] = 'U';
|
|
580 }
|
|
581 pToggleTypes[19] = TOGGLE_OneTimePress;
|
|
582
|
|
583 bAlwaysRun = ReadWindowsRegistryInt("valAlwaysRun", 0) != 0;
|
|
584 bFlipOnExit = ReadWindowsRegistryInt("FlipOnExit", 0) != 0;
|
|
585 ReadWindowsRegistryString("KEY_STEPLEFT", str, 0x20u, "DEFAULT");
|
|
586 if ( strcmp(str, "DEFAULT") && (LOBYTE(v58) = GetActionDefaultVKey(str), v58 != -1) )
|
|
587 {
|
|
588 pVirtualKeyCodesMapping[28] = GetActionDefaultVKey(str);
|
|
589 pToggleTypes[28] = TOGGLE_OneTimePress;
|
|
590 }
|
|
591 else
|
|
592 {
|
|
593 pToggleTypes[28] = TOGGLE_Continuously;
|
|
594 pVirtualKeyCodesMapping[28] = VK_OEM_4;
|
|
595 }
|
|
596
|
|
597 ReadWindowsRegistryString("KEY_STEPRIGHT", str, 0x20u, "DEFAULT");
|
|
598 if ( strcmp(str, "DEFAULT") && (LOBYTE(v60) = GetActionDefaultVKey(str), v60 != -1) )
|
|
599 {
|
|
600 pVirtualKeyCodesMapping[29] = GetActionDefaultVKey(str);
|
|
601 pToggleTypes[29] = TOGGLE_OneTimePress;
|
|
602 }
|
|
603 else
|
|
604 {
|
|
605 pToggleTypes[29] = TOGGLE_Continuously;
|
|
606 pVirtualKeyCodesMapping[29] = VK_OEM_6;
|
|
607 }
|
|
608 }
|
|
609
|
|
610 //----- (0045A960) --------------------------------------------------------
|
|
611 void KeyboardActionMapping::StoreMappings()
|
|
612 {
|
|
613 const char *v2; // eax@1
|
|
614 const char *v3; // eax@1
|
|
615 const char *v4; // eax@1
|
|
616 const char *v5; // eax@1
|
|
617 const char *v6; // eax@1
|
|
618 const char *v7; // eax@1
|
|
619 const char *v8; // eax@1
|
|
620 const char *v9; // eax@1
|
|
621 const char *v10; // eax@1
|
|
622 const char *v11; // eax@1
|
|
623 const char *v12; // eax@1
|
|
624 const char *v13; // eax@1
|
|
625 const char *v14; // eax@1
|
|
626 const char *v15; // eax@1
|
|
627 const char *v16; // eax@1
|
|
628 const char *v17; // eax@1
|
|
629 const char *v18; // eax@1
|
|
630 const char *v19; // eax@1
|
|
631 const char *v20; // eax@1
|
|
632 const char *v21; // eax@1
|
|
633 const char *v22; // eax@1
|
|
634 const char *v23; // eax@1
|
|
635 const char *v24; // eax@1
|
|
636 const char *v25; // eax@1
|
|
637 const char *v26; // eax@1
|
|
638 const char *v27; // eax@1
|
|
639 const char *v28; // eax@1
|
|
640 const char *v29; // eax@1
|
|
641
|
1038
|
642 v2 = GetVKeyDisplayName(pVirtualKeyCodesMapping[0]);
|
0
|
643 WriteWindowsRegistryString("KEY_FORWARD", v2);
|
|
644 v3 = GetVKeyDisplayName(pVirtualKeyCodesMapping[1]);
|
|
645 WriteWindowsRegistryString("KEY_BACKWARD", v3);
|
|
646 v4 = GetVKeyDisplayName(pVirtualKeyCodesMapping[2]);
|
|
647 WriteWindowsRegistryString("KEY_LEFT", v4);
|
|
648 v5 = GetVKeyDisplayName(pVirtualKeyCodesMapping[3]);
|
|
649 WriteWindowsRegistryString("KEY_RIGHT", v5);
|
|
650 v6 = GetVKeyDisplayName(pVirtualKeyCodesMapping[8]);
|
|
651 WriteWindowsRegistryString("KEY_ATTACK", v6);
|
|
652 v7 = GetVKeyDisplayName(pVirtualKeyCodesMapping[7]);
|
|
653 WriteWindowsRegistryString("KEY_CASTREADY", v7);
|
|
654 v8 = GetVKeyDisplayName(pVirtualKeyCodesMapping[4]);
|
|
655 WriteWindowsRegistryString("KEY_YELL", v8);
|
|
656 v9 = GetVKeyDisplayName(pVirtualKeyCodesMapping[5]);
|
|
657 WriteWindowsRegistryString("KEY_JUMP", v9);
|
|
658 v10 = GetVKeyDisplayName(pVirtualKeyCodesMapping[6]);
|
|
659 WriteWindowsRegistryString("KEY_COMBAT", v10);
|
|
660 v11 = GetVKeyDisplayName(pVirtualKeyCodesMapping[9]);
|
|
661 WriteWindowsRegistryString("KEY_EVENTTRIGGER", v11);
|
|
662 v12 = GetVKeyDisplayName(pVirtualKeyCodesMapping[10]);
|
|
663 WriteWindowsRegistryString("KEY_CAST", v12);
|
|
664 v13 = GetVKeyDisplayName(pVirtualKeyCodesMapping[11]);
|
|
665 WriteWindowsRegistryString("KEY_PASS", v13);
|
|
666 v14 = GetVKeyDisplayName(pVirtualKeyCodesMapping[12]);
|
|
667 WriteWindowsRegistryString("KEY_CHARCYCLE", v14);
|
|
668 v15 = GetVKeyDisplayName(pVirtualKeyCodesMapping[13]);
|
|
669 WriteWindowsRegistryString("KEY_QUEST", v15);
|
|
670 v16 = GetVKeyDisplayName(pVirtualKeyCodesMapping[14]);
|
|
671 WriteWindowsRegistryString("KEY_QUICKREF", v16);
|
|
672 v17 = GetVKeyDisplayName(pVirtualKeyCodesMapping[15]);
|
|
673 WriteWindowsRegistryString("KEY_REST", v17);
|
|
674 v18 = GetVKeyDisplayName(pVirtualKeyCodesMapping[16]);
|
|
675 WriteWindowsRegistryString("KEY_TIMECAL", v18);
|
|
676 v19 = GetVKeyDisplayName(pVirtualKeyCodesMapping[17]);
|
|
677 WriteWindowsRegistryString("KEY_AUTONOTES", v19);
|
|
678 v20 = GetVKeyDisplayName(pVirtualKeyCodesMapping[18]);
|
|
679 WriteWindowsRegistryString("KEY_MAPBOOK", v20);
|
|
680 v21 = GetVKeyDisplayName(pVirtualKeyCodesMapping[20]);
|
|
681 WriteWindowsRegistryString("KEY_LOOKUP", v21);
|
|
682 v22 = GetVKeyDisplayName(pVirtualKeyCodesMapping[21]);
|
|
683 WriteWindowsRegistryString("KEY_LOOKDOWN", v22);
|
|
684 v23 = GetVKeyDisplayName(pVirtualKeyCodesMapping[22]);
|
|
685 WriteWindowsRegistryString("KEY_CENTERVIEWPT", v23);
|
|
686 v24 = GetVKeyDisplayName(pVirtualKeyCodesMapping[23]);
|
|
687 WriteWindowsRegistryString("KEY_ZOOMIN", v24);
|
|
688 v25 = GetVKeyDisplayName(pVirtualKeyCodesMapping[24]);
|
|
689 WriteWindowsRegistryString("KEY_ZOOMOUT", v25);
|
|
690 v26 = GetVKeyDisplayName(pVirtualKeyCodesMapping[25]);
|
|
691 WriteWindowsRegistryString("KEY_FLYUP", v26);
|
|
692 v27 = GetVKeyDisplayName(pVirtualKeyCodesMapping[26]);
|
|
693 WriteWindowsRegistryString("KEY_FLYDOWN", v27);
|
|
694 v28 = GetVKeyDisplayName(pVirtualKeyCodesMapping[27]);
|
|
695 WriteWindowsRegistryString("KEY_LAND", v28);
|
|
696 v29 = GetVKeyDisplayName(pVirtualKeyCodesMapping[19]);
|
|
697 WriteWindowsRegistryString("KEY_ALWAYSRUN", v29);
|
|
698 }
|
|
699
|
|
700 //----- (0045ABCA) --------------------------------------------------------
|
|
701 const unsigned __int8 KeyboardActionMapping::GetActionDefaultVKey(const char *Str)
|
|
702 {
|
|
703 unsigned __int8 result; // al@3
|
|
704
|
|
705 if ( !strcmp(Str, "UP") )
|
|
706 return VK_UP;
|
|
707 if ( !strcmp(Str, "DOWN") )
|
|
708 return VK_DOWN;
|
|
709 if (!strcmp(Str, "") || !strcmp(Str, "LEFT"))
|
|
710 return VK_LEFT;
|
|
711 if (!strcmp(Str, "") || !strcmp(Str, "RIGHT"))
|
|
712 return VK_RIGHT;
|
|
713 if ( !strcmp(Str, "RETURN") )
|
|
714 return VK_RETURN;
|
|
715 if ( !strcmp(Str, "SPACE") )
|
|
716 return VK_SPACE;
|
|
717 if ( !strcmp(Str, "PAGE_DOWN") )
|
|
718 return VK_NEXT;
|
|
719 if ( !strcmp(Str, "PAGE_UP") )
|
|
720 return VK_PRIOR;
|
|
721 if ( !strcmp(Str, "TAB") )
|
|
722 return VK_TAB;
|
|
723 if ( !strcmp(Str, "SUBTRACT") )
|
|
724 return VK_SUBTRACT;
|
|
725 if ( !strcmp(Str, "ADD") )
|
|
726 return VK_ADD;
|
|
727 if ( !strcmp(Str, "END") )
|
|
728 return VK_END;
|
|
729 if ( !strcmp(Str, "DELETE") )
|
|
730 return VK_DELETE;
|
|
731 if ( !strcmp(Str, "HOME") )
|
|
732 return VK_HOME;
|
|
733 if ( !strcmp(Str, "INSERT") )
|
|
734 return VK_INSERT;
|
|
735 if ( strcmp(Str, "COMMA") )
|
|
736 {
|
|
737 if ( !strcmp(Str, "DECIMAL") )
|
|
738 return VK_DECIMAL;
|
|
739 if ( strcmp(Str, "SEMICOLON") )
|
|
740 {
|
|
741 if ( strcmp(Str, "PERIOD") )
|
|
742 {
|
|
743 if ( strcmp(Str, "SLASH") )
|
|
744 {
|
|
745 if ( strcmp(Str, "SQUOTE") )
|
|
746 {
|
|
747 if ( strcmp(Str, "BACKSLASH") )
|
|
748 {
|
|
749 if ( !strcmp(Str, "BACKSPACE") )
|
|
750 return VK_BACK;
|
|
751 if ( !strcmp(Str, "CONTROL") )
|
|
752 return VK_CONTROL;
|
|
753 if ( strlen(Str) != 1 || (result = *Str, (unsigned __int8)*Str < 0x41u) || result > 0x5Au )
|
|
754 result = -1;
|
|
755 }
|
|
756 else
|
|
757 {
|
|
758 result = -36;
|
|
759 }
|
|
760 }
|
|
761 else
|
|
762 {
|
|
763 result = -34;
|
|
764 }
|
|
765 }
|
|
766 else
|
|
767 {
|
|
768 result = -65;
|
|
769 }
|
|
770 }
|
|
771 else
|
|
772 {
|
|
773 result = -66;
|
|
774 }
|
|
775 }
|
|
776 else
|
|
777 {
|
|
778 result = -70;
|
|
779 }
|
|
780 }
|
|
781 else
|
|
782 {
|
|
783 result = -68;
|
|
784 }
|
|
785 return result;
|
|
786 }
|
|
787
|
|
788 //----- (0045AE2C) --------------------------------------------------------
|
|
789 const char *KeyboardActionMapping::GetVKeyDisplayName(signed int a1)
|
|
790 {
|
|
791 char *v3; // [sp-4h] [bp-8h]@2
|
|
792
|
|
793 static char static_sub_45AE2C_string_69ADE0[32];
|
|
794
|
|
795 if ( a1 == VK_UP )
|
|
796 {
|
|
797 v3 = "UP";
|
|
798 LABEL_53:
|
|
799 strcpy(static_sub_45AE2C_string_69ADE0, v3);
|
|
800 return static_sub_45AE2C_string_69ADE0;
|
|
801 }
|
|
802 if ( a1 == VK_DOWN )
|
|
803 {
|
|
804 v3 = "DOWN";
|
|
805 goto LABEL_53;
|
|
806 }
|
|
807 if ( a1 == VK_LEFT )
|
|
808 {
|
159
|
809 v3 = "LEFT";
|
0
|
810 goto LABEL_53;
|
|
811 }
|
|
812 if ( a1 == VK_RIGHT )
|
|
813 {
|
159
|
814 v3 = "RIGHT";
|
0
|
815 goto LABEL_53;
|
|
816 }
|
|
817 if ( a1 == VK_RETURN )
|
|
818 {
|
|
819 v3 = "RETURN";
|
|
820 goto LABEL_53;
|
|
821 }
|
|
822 if ( a1 == VK_SPACE )
|
|
823 {
|
|
824 v3 = "SPACE";
|
|
825 goto LABEL_53;
|
|
826 }
|
|
827 if ( a1 == VK_NEXT )
|
|
828 {
|
|
829 v3 = "PAGE_DOWN";
|
|
830 goto LABEL_53;
|
|
831 }
|
|
832 if ( a1 == VK_PRIOR )
|
|
833 {
|
|
834 v3 = "PAGE_UP";
|
|
835 goto LABEL_53;
|
|
836 }
|
|
837 if ( a1 == VK_TAB )
|
|
838 {
|
|
839 v3 = "TAB";
|
|
840 goto LABEL_53;
|
|
841 }
|
|
842 if ( a1 == 'm' )
|
|
843 {
|
|
844 v3 = "SUBTRACT";
|
|
845 goto LABEL_53;
|
|
846 }
|
|
847 if ( a1 == 'k' )
|
|
848 {
|
|
849 v3 = "ADD";
|
|
850 goto LABEL_53;
|
|
851 }
|
|
852 if ( a1 == VK_END )
|
|
853 {
|
|
854 v3 = "END";
|
|
855 goto LABEL_53;
|
|
856 }
|
|
857 if ( a1 == VK_DELETE )
|
|
858 {
|
|
859 v3 = "DELETE";
|
|
860 goto LABEL_53;
|
|
861 }
|
|
862 if ( a1 == VK_HOME )
|
|
863 {
|
|
864 v3 = "HOME";
|
|
865 goto LABEL_53;
|
|
866 }
|
|
867 if ( a1 == VK_INSERT )
|
|
868 {
|
|
869 v3 = "INSERT";
|
|
870 goto LABEL_53;
|
|
871 }
|
|
872 if ( a1 == VK_DECIMAL )
|
|
873 {
|
|
874 v3 = "DECIMAL";
|
|
875 goto LABEL_53;
|
|
876 }
|
|
877 if ( a1 == VK_OEM_COMMA )
|
|
878 {
|
|
879 v3 = "COMMA";
|
|
880 goto LABEL_53;
|
|
881 }
|
|
882 if ( a1 == VK_OEM_1 )
|
|
883 {
|
|
884 v3 = "SEMICOLON";
|
|
885 goto LABEL_53;
|
|
886 }
|
|
887 if ( a1 == VK_OEM_PERIOD )
|
|
888 {
|
|
889 v3 = "PERIOD";
|
|
890 goto LABEL_53;
|
|
891 }
|
|
892 if ( a1 == VK_OEM_2 )
|
|
893 {
|
|
894 v3 = "SLASH";
|
|
895 goto LABEL_53;
|
|
896 }
|
|
897 if ( a1 == VK_OEM_7 )
|
|
898 {
|
|
899 v3 = "SQUOTE";
|
|
900 goto LABEL_53;
|
|
901 }
|
|
902 if ( a1 == VK_OEM_5 )
|
|
903 {
|
|
904 v3 = "BACKSLASH";
|
|
905 goto LABEL_53;
|
|
906 }
|
|
907 if ( a1 == VK_CONTROL )
|
|
908 {
|
|
909 v3 = "CONTROL";
|
|
910 goto LABEL_53;
|
|
911 }
|
|
912 if ( a1 == VK_BACK )
|
|
913 {
|
|
914 v3 = "BACKSPACE";
|
|
915 goto LABEL_53;
|
|
916 }
|
|
917 if ( a1 < 65 || a1 > 90 )
|
|
918 {
|
|
919 v3 = "- -";
|
|
920 goto LABEL_53;
|
|
921 }
|
|
922 *(unsigned short *)static_sub_45AE2C_string_69ADE0 = (unsigned __int8)a1;
|
|
923 return static_sub_45AE2C_string_69ADE0;
|
|
924 }
|
|
925
|
|
926 //----- (0045AFD9) --------------------------------------------------------
|
|
927 Keyboard::Keyboard()
|
|
928 {
|
|
929 bUsingAsynKeyboard = false;
|
|
930
|
|
931 if (pVersion->pVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT &&
|
|
932 pVersion->pVersionInfo.dwMajorVersion == 4)
|
|
933 bUsingAsynKeyboard = false;
|
|
934 }
|
|
935
|
|
936 //----- (0045B019) --------------------------------------------------------
|
|
937 void Keyboard::EnterCriticalSection()
|
|
938 {
|
|
939 }
|
|
940
|
|
941 //----- (0045B06E) --------------------------------------------------------
|
|
942 bool Keyboard::IsShiftHeld()
|
|
943 {
|
1038
|
944 return GetAsyncKeyState(VK_SHIFT);
|
0
|
945 }
|
|
946
|
|
947 //----- (0045B0A9) --------------------------------------------------------
|
|
948 bool Keyboard::IsKeyBeingHeld(int vKey)
|
|
949 {
|
1038
|
950 return GetAsyncKeyState(vKey) & 0x8001;
|
0
|
951 }
|
|
952
|
|
953 //----- (0045B0CE) --------------------------------------------------------
|
|
954 bool Keyboard::WasKeyPressed(int vKey)
|
|
955 {
|
1038
|
956 return GetAsyncKeyState(vKey) & 1;
|
0
|
957 }
|