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
|
|
47 dword_506E68 = -1;
|
|
48 }
|
|
49 // 506E68: using guessed type int dword_506E68;
|
|
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) --------------------------------------------------------
|
3
|
116 void KeyboardActionMapping::EnterText(int a2, int pNumWord, 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;
|
3
|
127 v4->field_FC = pNumWord;
|
0
|
128 v4->pWindow = pWindow;
|
|
129 pWindow->field_40 = 1;
|
|
130 if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) )
|
|
131 {
|
|
132 if ( pAsyncKeyboard )
|
|
133 pAsyncKeyboard->Suspend();
|
|
134 }
|
|
135 }
|
|
136
|
|
137 //----- (00459ED1) --------------------------------------------------------
|
|
138 void KeyboardActionMapping::_459ED1(int a2)
|
|
139 {
|
|
140 KeyboardActionMapping *v2; // esi@1
|
|
141 GUIWindow *v3; // esi@4
|
|
142
|
|
143 v2 = this;
|
|
144 if (pGame->pKeyboardInstance->bUsingAsynKeyboard && pAsyncKeyboard)
|
|
145 pAsyncKeyboard->Resume();
|
|
146 v2->field_204 = 0;
|
|
147 v3 = v2->pWindow;
|
|
148 if ( v3 )
|
|
149 v3->field_40 = a2;
|
|
150 }
|
|
151
|
|
152 //----- (00459F10) --------------------------------------------------------
|
|
153 bool KeyboardActionMapping::_459F10(unsigned int a2)
|
|
154 {
|
|
155 int v3; // [sp-4h] [bp-4h]@3
|
|
156
|
|
157 pKeyActionMap->uLastKeyPressed = a2;
|
|
158 if ( dword_506E68 == -1 )
|
|
159 {
|
|
160 if ( pKeyActionMap->field_204 == 1 )
|
|
161 {
|
|
162 if ( a2 != 8 )
|
|
163 {
|
|
164 if ( a2 == 9 )
|
|
165 return 1;
|
|
166 if ( a2 == 13 )
|
|
167 goto LABEL_3;
|
|
168 if ( a2 == 27 )
|
|
169 goto LABEL_15;
|
|
170 if ( this->uNumKeysPressed >= this->field_FC )
|
|
171 return 1;
|
|
172 pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = a2;
|
|
173 ++pKeyActionMap->uNumKeysPressed;
|
|
174 LABEL_24:
|
|
175 pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = 0;
|
|
176 return 1;
|
|
177 }
|
|
178 }
|
|
179 else
|
|
180 {
|
|
181 if ( pKeyActionMap->field_204 != 2 )
|
|
182 return 0;
|
|
183 if ( a2 != 8 )
|
|
184 {
|
|
185 if ( a2 == 13 )
|
|
186 goto LABEL_3;
|
|
187 if ( a2 != 27 )
|
|
188 {
|
|
189 if ( (signed int)a2 >= 48 && (signed int)a2 <= 57 )
|
|
190 {
|
|
191 if ( pKeyActionMap->uNumKeysPressed < this->field_FC )
|
|
192 {
|
|
193 pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = a2;
|
|
194 ++pKeyActionMap->uNumKeysPressed;
|
|
195 }
|
|
196 }
|
|
197 return 1;
|
|
198 }
|
|
199 LABEL_15:
|
|
200 v3 = 3;
|
|
201 goto LABEL_4;
|
|
202 }
|
|
203 }
|
|
204 if ( !pKeyActionMap->uNumKeysPressed )
|
|
205 return 1;
|
|
206 --pKeyActionMap->uNumKeysPressed;
|
|
207 goto LABEL_24;
|
|
208 }
|
|
209 pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = a2;
|
|
210 ++pKeyActionMap->uNumKeysPressed;
|
|
211 pKeyActionMap->pPressedKeysBuffer[pKeyActionMap->uNumKeysPressed] = 0;
|
|
212 LABEL_3:
|
|
213 v3 = 2;
|
|
214 LABEL_4:
|
|
215 pKeyActionMap->_459ED1(v3);
|
|
216 return 1;
|
|
217 }
|
|
218 // 506E68: using guessed type int dword_506E68;
|
|
219
|
|
220 //----- (00459FFC) --------------------------------------------------------
|
|
221 void KeyboardActionMapping::ReadMappings()
|
|
222 {
|
|
223 //KeyboardActionMapping *v1; // esi@1
|
|
224 int v2; // eax@2
|
|
225 unsigned int v3; // eax@3
|
|
226 int v4; // eax@6
|
|
227 unsigned int v5; // eax@7
|
|
228 int v6; // eax@10
|
|
229 unsigned int v7; // eax@11
|
|
230 int v8; // eax@14
|
|
231 unsigned int v9; // eax@15
|
|
232 int v10; // eax@18
|
|
233 unsigned int v11; // eax@19
|
|
234 int v12; // eax@22
|
|
235 //unsigned int v13; // eax@23
|
|
236 int v14; // eax@26
|
|
237 //unsigned int v15; // eax@27
|
|
238 int v16; // eax@30
|
|
239 //unsigned int v17; // eax@31
|
|
240 int v18; // eax@34
|
|
241 //unsigned int v19; // eax@35
|
|
242 int v20; // eax@38
|
|
243 //unsigned int v21; // eax@39
|
|
244 int v22; // eax@42
|
|
245 //unsigned int v23; // eax@43
|
|
246 int v24; // eax@46
|
|
247 //unsigned int v25; // eax@47
|
|
248 int v26; // eax@50
|
|
249 //unsigned int v27; // eax@51
|
|
250 int v28; // eax@54
|
|
251 //unsigned int v29; // eax@55
|
|
252 int v30; // eax@58
|
|
253 //unsigned int v31; // eax@59
|
|
254 int v32; // eax@62
|
|
255 //unsigned int v33; // eax@63
|
|
256 int v34; // eax@66
|
|
257 //unsigned int v35; // eax@67
|
|
258 int v36; // eax@70
|
|
259 //unsigned int v37; // eax@71
|
|
260 int v38; // eax@74
|
|
261 //unsigned int v39; // eax@75
|
|
262 int v40; // eax@78
|
|
263 //unsigned int v41; // eax@79
|
|
264 int v42; // eax@82
|
|
265 //unsigned int v43; // eax@83
|
|
266 int v44; // eax@86
|
|
267 //unsigned int v45; // eax@87
|
|
268 int v46; // eax@90
|
|
269 //unsigned int v47; // eax@91
|
|
270 int v48; // eax@94
|
|
271 //unsigned int v49; // eax@95
|
|
272 int v50; // eax@98
|
|
273 //unsigned int v51; // eax@99
|
|
274 int v52; // eax@102
|
|
275 //unsigned int v53; // eax@103
|
|
276 int v54; // eax@106
|
|
277 //unsigned int v55; // eax@107
|
|
278 int v56; // eax@110
|
|
279 unsigned int v57; // eax@111
|
|
280 int v58; // eax@114
|
|
281 unsigned int v59; // eax@115
|
|
282 int v60; // eax@118
|
|
283 unsigned int v61; // eax@119
|
|
284 //char str[32]; // [sp+Ch] [bp-20h]@1
|
|
285
|
|
286 char str[32];
|
|
287
|
|
288 ReadWindowsRegistryString("KEY_FORWARD", str, 32, "DEFAULT");
|
|
289 if ( strcmp(str, "DEFAULT") && (LOBYTE(v2) = GetActionDefaultVKey(str), v2 != -1) )
|
|
290 {
|
|
291 pVirtualKeyCodesMapping[0] = GetActionDefaultVKey(str);
|
|
292 }
|
|
293 else
|
|
294 {
|
|
295 pVirtualKeyCodesMapping[0] = VK_UP;
|
|
296 }
|
|
297 pToggleTypes[0] = TOGGLE_Continuously;
|
|
298 ReadWindowsRegistryString("KEY_BACKWARD", str, 0x20u, "DEFAULT");
|
|
299 if ( strcmp(str, "DEFAULT") && (LOBYTE(v4) = GetActionDefaultVKey(str), v4 != -1) )
|
|
300 {
|
|
301 pVirtualKeyCodesMapping[1] = GetActionDefaultVKey(str);
|
|
302 }
|
|
303 else
|
|
304 {
|
|
305 pVirtualKeyCodesMapping[1] = VK_DOWN;
|
|
306 }
|
|
307 pToggleTypes[1] = TOGGLE_Continuously;
|
|
308
|
|
309 ReadWindowsRegistryString("KEY_LEFT", str, 0x20u, "DEFAULT");
|
|
310 if ( strcmp(str, "DEFAULT") && (LOBYTE(v6) = GetActionDefaultVKey(str), v6 != -1) )
|
|
311 {
|
|
312 pVirtualKeyCodesMapping[2] = GetActionDefaultVKey(str);
|
|
313 }
|
|
314 else
|
|
315 {
|
|
316 pVirtualKeyCodesMapping[2] = VK_LEFT;
|
|
317 }
|
|
318 pToggleTypes[2] = TOGGLE_Continuously;
|
|
319
|
|
320 ReadWindowsRegistryString("KEY_RIGHT", str, 0x20u, "DEFAULT");
|
|
321 if ( strcmp(str, "DEFAULT") && (LOBYTE(v8) = GetActionDefaultVKey(str), v8 != -1) )
|
|
322 {
|
|
323 pVirtualKeyCodesMapping[3] = GetActionDefaultVKey(str);
|
|
324 }
|
|
325 else
|
|
326 {
|
|
327 pVirtualKeyCodesMapping[3] = VK_RIGHT;
|
|
328 }
|
|
329 pToggleTypes[3] = TOGGLE_Continuously;
|
|
330
|
|
331 ReadWindowsRegistryString("KEY_ATTACK", str, 0x20u, "DEFAULT");
|
|
332 if ( strcmp(str, "DEFAULT") && (LOBYTE(v10) = GetActionDefaultVKey(str), v10 != -1) )
|
|
333 {
|
|
334 pVirtualKeyCodesMapping[8] = GetActionDefaultVKey(str);
|
|
335 }
|
|
336 else
|
|
337 {
|
|
338 pVirtualKeyCodesMapping[8] = 'A';
|
|
339 }
|
|
340 pToggleTypes[8] = TOGGLE_OneTimePress;
|
|
341
|
|
342 ReadWindowsRegistryString("KEY_CASTREADY", str, 0x20u, "DEFAULT");
|
|
343 if ( strcmp(str, "DEFAULT") && (LOBYTE(v12) = GetActionDefaultVKey(str), v12 != -1) )
|
|
344 {
|
|
345 pVirtualKeyCodesMapping[7] = GetActionDefaultVKey(str);
|
|
346 }
|
|
347 else
|
|
348 {
|
|
349 pVirtualKeyCodesMapping[7] = 'S';
|
|
350 }
|
|
351 pToggleTypes[7] = TOGGLE_OneTimePress;
|
|
352
|
|
353 ReadWindowsRegistryString("KEY_YELL", str, 0x20u, "DEFAULT");
|
|
354 if ( strcmp(str, "DEFAULT") && (LOBYTE(v14) = GetActionDefaultVKey(str), v14 != -1) )
|
|
355 {
|
|
356 pVirtualKeyCodesMapping[4] = GetActionDefaultVKey(str);
|
|
357 }
|
|
358 else
|
|
359 {
|
|
360 pVirtualKeyCodesMapping[4] = 'Y';
|
|
361 }
|
|
362 pToggleTypes[4] = TOGGLE_OneTimePress;
|
|
363
|
|
364 ReadWindowsRegistryString("KEY_JUMP", str, 0x20u, "DEFAULT");
|
|
365 if ( strcmp(str, "DEFAULT") && (LOBYTE(v16) = GetActionDefaultVKey(str), v16 != -1) )
|
|
366 {
|
|
367 pVirtualKeyCodesMapping[5] = GetActionDefaultVKey(str);
|
|
368 }
|
|
369 else
|
|
370 {
|
|
371 pVirtualKeyCodesMapping[5] = 'X';
|
|
372 }
|
|
373 pToggleTypes[5] = TOGGLE_OneTimePress;
|
|
374
|
|
375 ReadWindowsRegistryString("KEY_COMBAT", str, 0x20u, "DEFAULT");
|
|
376 if ( strcmp(str, "DEFAULT") && (LOBYTE(v18) = GetActionDefaultVKey(str), v18 != -1) )
|
|
377 {
|
|
378 pVirtualKeyCodesMapping[6] = GetActionDefaultVKey(str);
|
|
379 }
|
|
380 else
|
|
381 {
|
|
382 pVirtualKeyCodesMapping[6] = VK_RETURN;
|
|
383 }
|
|
384 pToggleTypes[6] = TOGGLE_OneTimePress;
|
|
385
|
|
386 ReadWindowsRegistryString("KEY_EVENTTRIGGER", str, 0x20u, "DEFAULT");
|
|
387 if ( strcmp(str, "DEFAULT") && (LOBYTE(v20) = GetActionDefaultVKey(str), v20 != -1) )
|
|
388 {
|
|
389 pVirtualKeyCodesMapping[9] = GetActionDefaultVKey(str);
|
|
390 }
|
|
391 else
|
|
392 {
|
|
393 pVirtualKeyCodesMapping[9] = VK_SPACE;
|
|
394 }
|
|
395 pToggleTypes[9] = TOGGLE_OneTimePress;
|
|
396
|
|
397 ReadWindowsRegistryString("KEY_CAST", str, 0x20u, "DEFAULT");
|
|
398 if ( strcmp(str, "DEFAULT") && (LOBYTE(v22) = GetActionDefaultVKey(str), v22 != -1) )
|
|
399 {
|
|
400 pVirtualKeyCodesMapping[10] = GetActionDefaultVKey(str);
|
|
401 }
|
|
402 else
|
|
403 {
|
|
404 pVirtualKeyCodesMapping[10] = 'C';
|
|
405 }
|
|
406 pToggleTypes[10] = TOGGLE_OneTimePress;
|
|
407
|
|
408 ReadWindowsRegistryString("KEY_PASS", str, 0x20u, "DEFAULT");
|
|
409 if ( strcmp(str, "DEFAULT") && (LOBYTE(v24) = GetActionDefaultVKey(str), v24 != -1) )
|
|
410 {
|
|
411 pVirtualKeyCodesMapping[11] = GetActionDefaultVKey(str);
|
|
412 }
|
|
413 else
|
|
414 {
|
|
415 pVirtualKeyCodesMapping[11] = 'B';
|
|
416 }
|
|
417 pToggleTypes[11] = TOGGLE_OneTimePress;
|
|
418
|
|
419 ReadWindowsRegistryString("KEY_CHARCYCLE", str, 0x20u, "DEFAULT");
|
|
420 if ( strcmp(str, "DEFAULT") && (LOBYTE(v26) = GetActionDefaultVKey(str), v26 != -1) )
|
|
421 {
|
|
422 pVirtualKeyCodesMapping[12] = GetActionDefaultVKey(str);
|
|
423 }
|
|
424 else
|
|
425 {
|
|
426 pVirtualKeyCodesMapping[12] = VK_TAB;
|
|
427 }
|
|
428 pToggleTypes[12] = TOGGLE_OneTimePress;
|
|
429
|
|
430 ReadWindowsRegistryString("KEY_QUEST", str, 0x20u, "DEFAULT");
|
|
431 if ( strcmp(str, "DEFAULT") && (LOBYTE(v28) = GetActionDefaultVKey(str), v28 != -1) )
|
|
432 {
|
|
433 pVirtualKeyCodesMapping[13] = GetActionDefaultVKey(str);
|
|
434 }
|
|
435 else
|
|
436 {
|
|
437 pVirtualKeyCodesMapping[13] = 'Q';
|
|
438 }
|
|
439 pToggleTypes[13] = TOGGLE_OneTimePress;
|
|
440
|
|
441 ReadWindowsRegistryString("KEY_QUICKREF", str, 0x20u, "DEFAULT");
|
|
442 if ( strcmp(str, "DEFAULT") && (LOBYTE(v30) = GetActionDefaultVKey(str), v30 != -1) )
|
|
443 {
|
|
444 pVirtualKeyCodesMapping[14] = GetActionDefaultVKey(str);
|
|
445 }
|
|
446 else
|
|
447 {
|
|
448 pVirtualKeyCodesMapping[14] = 'Z';
|
|
449 }
|
|
450 pToggleTypes[14] = TOGGLE_OneTimePress;
|
|
451
|
|
452 ReadWindowsRegistryString("KEY_REST", str, 0x20u, "DEFAULT");
|
|
453 if ( strcmp(str, "DEFAULT") && (LOBYTE(v32) = GetActionDefaultVKey(str), v32 != -1) )
|
|
454 {
|
|
455 pVirtualKeyCodesMapping[15] = GetActionDefaultVKey(str);
|
|
456 }
|
|
457 else
|
|
458 {
|
|
459 pVirtualKeyCodesMapping[15] = 'R';
|
|
460 }
|
|
461 pToggleTypes[15] = TOGGLE_OneTimePress;
|
|
462
|
|
463 ReadWindowsRegistryString("KEY_TIMECAL", str, 0x20u, "DEFAULT");
|
|
464 if ( strcmp(str, "DEFAULT") && (LOBYTE(v34) = GetActionDefaultVKey(str), v34 != -1) )
|
|
465 {
|
|
466 pVirtualKeyCodesMapping[16] = GetActionDefaultVKey(str);
|
|
467 }
|
|
468 else
|
|
469 {
|
|
470 pVirtualKeyCodesMapping[16] = 'T';
|
|
471 }
|
|
472 pToggleTypes[16] = TOGGLE_OneTimePress;
|
|
473
|
|
474 ReadWindowsRegistryString("KEY_AUTONOTES", str, 0x20u, "DEFAULT");
|
|
475 if ( strcmp(str, "DEFAULT") && (LOBYTE(v36) = GetActionDefaultVKey(str), v36 != -1) )
|
|
476 {
|
|
477 pVirtualKeyCodesMapping[17] = GetActionDefaultVKey(str);
|
|
478 }
|
|
479 else
|
|
480 {
|
|
481 pVirtualKeyCodesMapping[17] = 'N';
|
|
482 }
|
|
483 pToggleTypes[17] = TOGGLE_OneTimePress;
|
|
484
|
|
485 ReadWindowsRegistryString("KEY_MAPBOOK", str, 0x20u, "DEFAULT");
|
|
486 if ( strcmp(str, "DEFAULT") && (LOBYTE(v38) = GetActionDefaultVKey(str), v38 != -1) )
|
|
487 {
|
|
488 pVirtualKeyCodesMapping[18] = GetActionDefaultVKey(str);
|
|
489 }
|
|
490 else
|
|
491 {
|
|
492 pVirtualKeyCodesMapping[18] = 'M';
|
|
493 }
|
|
494 pToggleTypes[18] = TOGGLE_OneTimePress;
|
|
495
|
|
496 ReadWindowsRegistryString("KEY_LOOKUP", str, 0x20u, "DEFAULT");
|
|
497 if ( strcmp(str, "DEFAULT") && (LOBYTE(v40) = GetActionDefaultVKey(str), v40 != -1) )
|
|
498 {
|
|
499 pVirtualKeyCodesMapping[20] = GetActionDefaultVKey(str);
|
|
500 }
|
|
501 else
|
|
502 {
|
|
503 pVirtualKeyCodesMapping[20] = VK_NEXT;
|
|
504 }
|
|
505 pToggleTypes[20] = TOGGLE_OneTimePress;
|
|
506
|
|
507 ReadWindowsRegistryString("KEY_LOOKDOWN", str, 0x20u, "DEFAULT");
|
|
508 if ( strcmp(str, "DEFAULT") && (LOBYTE(v42) = GetActionDefaultVKey(str), v42 != -1) )
|
|
509 {
|
|
510 pVirtualKeyCodesMapping[21] = GetActionDefaultVKey(str);
|
|
511 }
|
|
512 else
|
|
513 {
|
|
514 pVirtualKeyCodesMapping[21] = VK_DELETE;
|
|
515 }
|
|
516 pToggleTypes[21] = TOGGLE_OneTimePress;
|
|
517
|
|
518 ReadWindowsRegistryString("KEY_CENTERVIEWPT", str, 0x20u, "DEFAULT");
|
|
519 if ( strcmp(str, "DEFAULT") && (LOBYTE(v44) = GetActionDefaultVKey(str), v44 != -1) )
|
|
520 {
|
|
521 pVirtualKeyCodesMapping[22] = GetActionDefaultVKey(str);
|
|
522 }
|
|
523 else
|
|
524 {
|
|
525 pVirtualKeyCodesMapping[22] = VK_END;
|
|
526 }
|
|
527 pToggleTypes[22] = TOGGLE_OneTimePress;
|
|
528
|
|
529 ReadWindowsRegistryString("KEY_ZOOMIN", str, 0x20u, "DEFAULT");
|
|
530 if ( strcmp(str, "DEFAULT") && (LOBYTE(v46) = GetActionDefaultVKey(str), v46 != -1) )
|
|
531 {
|
|
532 pVirtualKeyCodesMapping[23] = GetActionDefaultVKey(str);
|
|
533 }
|
|
534 else
|
|
535 {
|
|
536 pVirtualKeyCodesMapping[23] = VK_ADD;
|
|
537 }
|
|
538 pToggleTypes[23] = TOGGLE_OneTimePress;
|
|
539
|
|
540 ReadWindowsRegistryString("KEY_ZOOMOUT", str, 0x20u, "DEFAULT");
|
|
541 if ( strcmp(str, "DEFAULT") && (LOBYTE(v48) = GetActionDefaultVKey(str), v48 != -1) )
|
|
542 {
|
|
543 pVirtualKeyCodesMapping[24] = GetActionDefaultVKey(str);
|
|
544 }
|
|
545 else
|
|
546 {
|
|
547 pVirtualKeyCodesMapping[24] = VK_SUBTRACT;
|
|
548 }
|
|
549 pToggleTypes[24] = TOGGLE_OneTimePress;
|
|
550
|
|
551 ReadWindowsRegistryString("KEY_FLYUP", str, 0x20u, "DEFAULT");
|
|
552 if ( strcmp(str, "DEFAULT") && (LOBYTE(v50) = GetActionDefaultVKey(str), v50 != -1) )
|
|
553 {
|
|
554 pVirtualKeyCodesMapping[25] = GetActionDefaultVKey(str);
|
|
555 }
|
|
556 else
|
|
557 {
|
|
558 pVirtualKeyCodesMapping[25] = VK_PRIOR;
|
|
559 }
|
|
560 pToggleTypes[25] = TOGGLE_Continuously;
|
|
561
|
|
562 ReadWindowsRegistryString("KEY_FLYDOWN", str, 0x20u, "DEFAULT");
|
|
563 if ( strcmp(str, "DEFAULT") && (LOBYTE(v52) = GetActionDefaultVKey(str), v52 != -1) )
|
|
564 {
|
|
565 pVirtualKeyCodesMapping[26] = GetActionDefaultVKey(str);
|
|
566 }
|
|
567 else
|
|
568 {
|
|
569 pVirtualKeyCodesMapping[26] = VK_INSERT;
|
|
570 }
|
|
571 pToggleTypes[26] = TOGGLE_Continuously;
|
|
572
|
|
573 ReadWindowsRegistryString("KEY_LAND", str, 0x20u, "DEFAULT");
|
|
574 if ( strcmp(str, "DEFAULT") && (LOBYTE(v54) = GetActionDefaultVKey(str), v54 != -1) )
|
|
575 {
|
|
576 pVirtualKeyCodesMapping[27] = GetActionDefaultVKey(str);
|
|
577 }
|
|
578 else
|
|
579 {
|
|
580 pVirtualKeyCodesMapping[27] = VK_HOME;
|
|
581 }
|
|
582 pToggleTypes[27] = TOGGLE_OneTimePress;
|
|
583
|
|
584 ReadWindowsRegistryString("KEY_ALWAYSRUN", str, 0x20u, "DEFAULT");
|
|
585 if ( strcmp(str, "DEFAULT") && (LOBYTE(v56) = GetActionDefaultVKey(str), v56 != -1) )
|
|
586 {
|
|
587 pVirtualKeyCodesMapping[19] = GetActionDefaultVKey(str);
|
|
588 }
|
|
589 else
|
|
590 {
|
|
591 pVirtualKeyCodesMapping[19] = 'U';
|
|
592 }
|
|
593 pToggleTypes[19] = TOGGLE_OneTimePress;
|
|
594
|
|
595 bAlwaysRun = ReadWindowsRegistryInt("valAlwaysRun", 0) != 0;
|
|
596 bFlipOnExit = ReadWindowsRegistryInt("FlipOnExit", 0) != 0;
|
|
597 ReadWindowsRegistryString("KEY_STEPLEFT", str, 0x20u, "DEFAULT");
|
|
598 if ( strcmp(str, "DEFAULT") && (LOBYTE(v58) = GetActionDefaultVKey(str), v58 != -1) )
|
|
599 {
|
|
600 pVirtualKeyCodesMapping[28] = GetActionDefaultVKey(str);
|
|
601 pToggleTypes[28] = TOGGLE_OneTimePress;
|
|
602 }
|
|
603 else
|
|
604 {
|
|
605 pToggleTypes[28] = TOGGLE_Continuously;
|
|
606 pVirtualKeyCodesMapping[28] = VK_OEM_4;
|
|
607 }
|
|
608
|
|
609 ReadWindowsRegistryString("KEY_STEPRIGHT", str, 0x20u, "DEFAULT");
|
|
610 if ( strcmp(str, "DEFAULT") && (LOBYTE(v60) = GetActionDefaultVKey(str), v60 != -1) )
|
|
611 {
|
|
612 pVirtualKeyCodesMapping[29] = GetActionDefaultVKey(str);
|
|
613 pToggleTypes[29] = TOGGLE_OneTimePress;
|
|
614 }
|
|
615 else
|
|
616 {
|
|
617 pToggleTypes[29] = TOGGLE_Continuously;
|
|
618 pVirtualKeyCodesMapping[29] = VK_OEM_6;
|
|
619 }
|
|
620 }
|
|
621
|
|
622 //----- (0045A960) --------------------------------------------------------
|
|
623 void KeyboardActionMapping::StoreMappings()
|
|
624 {
|
|
625 const char *v2; // eax@1
|
|
626 const char *v3; // eax@1
|
|
627 const char *v4; // eax@1
|
|
628 const char *v5; // eax@1
|
|
629 const char *v6; // eax@1
|
|
630 const char *v7; // eax@1
|
|
631 const char *v8; // eax@1
|
|
632 const char *v9; // eax@1
|
|
633 const char *v10; // eax@1
|
|
634 const char *v11; // eax@1
|
|
635 const char *v12; // eax@1
|
|
636 const char *v13; // eax@1
|
|
637 const char *v14; // eax@1
|
|
638 const char *v15; // eax@1
|
|
639 const char *v16; // eax@1
|
|
640 const char *v17; // eax@1
|
|
641 const char *v18; // eax@1
|
|
642 const char *v19; // eax@1
|
|
643 const char *v20; // eax@1
|
|
644 const char *v21; // eax@1
|
|
645 const char *v22; // eax@1
|
|
646 const char *v23; // eax@1
|
|
647 const char *v24; // eax@1
|
|
648 const char *v25; // eax@1
|
|
649 const char *v26; // eax@1
|
|
650 const char *v27; // eax@1
|
|
651 const char *v28; // eax@1
|
|
652 const char *v29; // eax@1
|
|
653
|
|
654 v2 = GetVKeyDisplayName(this->pVirtualKeyCodesMapping[0]);
|
|
655 WriteWindowsRegistryString("KEY_FORWARD", v2);
|
|
656 v3 = GetVKeyDisplayName(pVirtualKeyCodesMapping[1]);
|
|
657 WriteWindowsRegistryString("KEY_BACKWARD", v3);
|
|
658 v4 = GetVKeyDisplayName(pVirtualKeyCodesMapping[2]);
|
|
659 WriteWindowsRegistryString("KEY_LEFT", v4);
|
|
660 v5 = GetVKeyDisplayName(pVirtualKeyCodesMapping[3]);
|
|
661 WriteWindowsRegistryString("KEY_RIGHT", v5);
|
|
662 v6 = GetVKeyDisplayName(pVirtualKeyCodesMapping[8]);
|
|
663 WriteWindowsRegistryString("KEY_ATTACK", v6);
|
|
664 v7 = GetVKeyDisplayName(pVirtualKeyCodesMapping[7]);
|
|
665 WriteWindowsRegistryString("KEY_CASTREADY", v7);
|
|
666 v8 = GetVKeyDisplayName(pVirtualKeyCodesMapping[4]);
|
|
667 WriteWindowsRegistryString("KEY_YELL", v8);
|
|
668 v9 = GetVKeyDisplayName(pVirtualKeyCodesMapping[5]);
|
|
669 WriteWindowsRegistryString("KEY_JUMP", v9);
|
|
670 v10 = GetVKeyDisplayName(pVirtualKeyCodesMapping[6]);
|
|
671 WriteWindowsRegistryString("KEY_COMBAT", v10);
|
|
672 v11 = GetVKeyDisplayName(pVirtualKeyCodesMapping[9]);
|
|
673 WriteWindowsRegistryString("KEY_EVENTTRIGGER", v11);
|
|
674 v12 = GetVKeyDisplayName(pVirtualKeyCodesMapping[10]);
|
|
675 WriteWindowsRegistryString("KEY_CAST", v12);
|
|
676 v13 = GetVKeyDisplayName(pVirtualKeyCodesMapping[11]);
|
|
677 WriteWindowsRegistryString("KEY_PASS", v13);
|
|
678 v14 = GetVKeyDisplayName(pVirtualKeyCodesMapping[12]);
|
|
679 WriteWindowsRegistryString("KEY_CHARCYCLE", v14);
|
|
680 v15 = GetVKeyDisplayName(pVirtualKeyCodesMapping[13]);
|
|
681 WriteWindowsRegistryString("KEY_QUEST", v15);
|
|
682 v16 = GetVKeyDisplayName(pVirtualKeyCodesMapping[14]);
|
|
683 WriteWindowsRegistryString("KEY_QUICKREF", v16);
|
|
684 v17 = GetVKeyDisplayName(pVirtualKeyCodesMapping[15]);
|
|
685 WriteWindowsRegistryString("KEY_REST", v17);
|
|
686 v18 = GetVKeyDisplayName(pVirtualKeyCodesMapping[16]);
|
|
687 WriteWindowsRegistryString("KEY_TIMECAL", v18);
|
|
688 v19 = GetVKeyDisplayName(pVirtualKeyCodesMapping[17]);
|
|
689 WriteWindowsRegistryString("KEY_AUTONOTES", v19);
|
|
690 v20 = GetVKeyDisplayName(pVirtualKeyCodesMapping[18]);
|
|
691 WriteWindowsRegistryString("KEY_MAPBOOK", v20);
|
|
692 v21 = GetVKeyDisplayName(pVirtualKeyCodesMapping[20]);
|
|
693 WriteWindowsRegistryString("KEY_LOOKUP", v21);
|
|
694 v22 = GetVKeyDisplayName(pVirtualKeyCodesMapping[21]);
|
|
695 WriteWindowsRegistryString("KEY_LOOKDOWN", v22);
|
|
696 v23 = GetVKeyDisplayName(pVirtualKeyCodesMapping[22]);
|
|
697 WriteWindowsRegistryString("KEY_CENTERVIEWPT", v23);
|
|
698 v24 = GetVKeyDisplayName(pVirtualKeyCodesMapping[23]);
|
|
699 WriteWindowsRegistryString("KEY_ZOOMIN", v24);
|
|
700 v25 = GetVKeyDisplayName(pVirtualKeyCodesMapping[24]);
|
|
701 WriteWindowsRegistryString("KEY_ZOOMOUT", v25);
|
|
702 v26 = GetVKeyDisplayName(pVirtualKeyCodesMapping[25]);
|
|
703 WriteWindowsRegistryString("KEY_FLYUP", v26);
|
|
704 v27 = GetVKeyDisplayName(pVirtualKeyCodesMapping[26]);
|
|
705 WriteWindowsRegistryString("KEY_FLYDOWN", v27);
|
|
706 v28 = GetVKeyDisplayName(pVirtualKeyCodesMapping[27]);
|
|
707 WriteWindowsRegistryString("KEY_LAND", v28);
|
|
708 v29 = GetVKeyDisplayName(pVirtualKeyCodesMapping[19]);
|
|
709 WriteWindowsRegistryString("KEY_ALWAYSRUN", v29);
|
|
710 }
|
|
711
|
|
712 //----- (0045ABCA) --------------------------------------------------------
|
|
713 const unsigned __int8 KeyboardActionMapping::GetActionDefaultVKey(const char *Str)
|
|
714 {
|
|
715 unsigned __int8 result; // al@3
|
|
716
|
|
717 if ( !strcmp(Str, "UP") )
|
|
718 return VK_UP;
|
|
719 if ( !strcmp(Str, "DOWN") )
|
|
720 return VK_DOWN;
|
|
721 if (!strcmp(Str, "ÂËÅÂÎ") || !strcmp(Str, "LEFT"))
|
|
722 return VK_LEFT;
|
|
723 if (!strcmp(Str, "ÂÏÐÀÂÎ") || !strcmp(Str, "RIGHT"))
|
|
724 return VK_RIGHT;
|
|
725 if ( !strcmp(Str, "RETURN") )
|
|
726 return VK_RETURN;
|
|
727 if ( !strcmp(Str, "SPACE") )
|
|
728 return VK_SPACE;
|
|
729 if ( !strcmp(Str, "PAGE_DOWN") )
|
|
730 return VK_NEXT;
|
|
731 if ( !strcmp(Str, "PAGE_UP") )
|
|
732 return VK_PRIOR;
|
|
733 if ( !strcmp(Str, "TAB") )
|
|
734 return VK_TAB;
|
|
735 if ( !strcmp(Str, "SUBTRACT") )
|
|
736 return VK_SUBTRACT;
|
|
737 if ( !strcmp(Str, "ADD") )
|
|
738 return VK_ADD;
|
|
739 if ( !strcmp(Str, "END") )
|
|
740 return VK_END;
|
|
741 if ( !strcmp(Str, "DELETE") )
|
|
742 return VK_DELETE;
|
|
743 if ( !strcmp(Str, "HOME") )
|
|
744 return VK_HOME;
|
|
745 if ( !strcmp(Str, "INSERT") )
|
|
746 return VK_INSERT;
|
|
747 if ( strcmp(Str, "COMMA") )
|
|
748 {
|
|
749 if ( !strcmp(Str, "DECIMAL") )
|
|
750 return VK_DECIMAL;
|
|
751 if ( strcmp(Str, "SEMICOLON") )
|
|
752 {
|
|
753 if ( strcmp(Str, "PERIOD") )
|
|
754 {
|
|
755 if ( strcmp(Str, "SLASH") )
|
|
756 {
|
|
757 if ( strcmp(Str, "SQUOTE") )
|
|
758 {
|
|
759 if ( strcmp(Str, "BACKSLASH") )
|
|
760 {
|
|
761 if ( !strcmp(Str, "BACKSPACE") )
|
|
762 return VK_BACK;
|
|
763 if ( !strcmp(Str, "CONTROL") )
|
|
764 return VK_CONTROL;
|
|
765 if ( strlen(Str) != 1 || (result = *Str, (unsigned __int8)*Str < 0x41u) || result > 0x5Au )
|
|
766 result = -1;
|
|
767 }
|
|
768 else
|
|
769 {
|
|
770 result = -36;
|
|
771 }
|
|
772 }
|
|
773 else
|
|
774 {
|
|
775 result = -34;
|
|
776 }
|
|
777 }
|
|
778 else
|
|
779 {
|
|
780 result = -65;
|
|
781 }
|
|
782 }
|
|
783 else
|
|
784 {
|
|
785 result = -66;
|
|
786 }
|
|
787 }
|
|
788 else
|
|
789 {
|
|
790 result = -70;
|
|
791 }
|
|
792 }
|
|
793 else
|
|
794 {
|
|
795 result = -68;
|
|
796 }
|
|
797 return result;
|
|
798 }
|
|
799
|
|
800 //----- (0045AE2C) --------------------------------------------------------
|
|
801 const char *KeyboardActionMapping::GetVKeyDisplayName(signed int a1)
|
|
802 {
|
|
803 char *v3; // [sp-4h] [bp-8h]@2
|
|
804
|
|
805 static char static_sub_45AE2C_string_69ADE0[32];
|
|
806
|
|
807 if ( a1 == VK_UP )
|
|
808 {
|
|
809 v3 = "UP";
|
|
810 LABEL_53:
|
|
811 strcpy(static_sub_45AE2C_string_69ADE0, v3);
|
|
812 return static_sub_45AE2C_string_69ADE0;
|
|
813 }
|
|
814 if ( a1 == VK_DOWN )
|
|
815 {
|
|
816 v3 = "DOWN";
|
|
817 goto LABEL_53;
|
|
818 }
|
|
819 if ( a1 == VK_LEFT )
|
|
820 {
|
159
|
821 v3 = "LEFT";
|
0
|
822 goto LABEL_53;
|
|
823 }
|
|
824 if ( a1 == VK_RIGHT )
|
|
825 {
|
159
|
826 v3 = "RIGHT";
|
0
|
827 goto LABEL_53;
|
|
828 }
|
|
829 if ( a1 == VK_RETURN )
|
|
830 {
|
|
831 v3 = "RETURN";
|
|
832 goto LABEL_53;
|
|
833 }
|
|
834 if ( a1 == VK_SPACE )
|
|
835 {
|
|
836 v3 = "SPACE";
|
|
837 goto LABEL_53;
|
|
838 }
|
|
839 if ( a1 == VK_NEXT )
|
|
840 {
|
|
841 v3 = "PAGE_DOWN";
|
|
842 goto LABEL_53;
|
|
843 }
|
|
844 if ( a1 == VK_PRIOR )
|
|
845 {
|
|
846 v3 = "PAGE_UP";
|
|
847 goto LABEL_53;
|
|
848 }
|
|
849 if ( a1 == VK_TAB )
|
|
850 {
|
|
851 v3 = "TAB";
|
|
852 goto LABEL_53;
|
|
853 }
|
|
854 if ( a1 == 'm' )
|
|
855 {
|
|
856 v3 = "SUBTRACT";
|
|
857 goto LABEL_53;
|
|
858 }
|
|
859 if ( a1 == 'k' )
|
|
860 {
|
|
861 v3 = "ADD";
|
|
862 goto LABEL_53;
|
|
863 }
|
|
864 if ( a1 == VK_END )
|
|
865 {
|
|
866 v3 = "END";
|
|
867 goto LABEL_53;
|
|
868 }
|
|
869 if ( a1 == VK_DELETE )
|
|
870 {
|
|
871 v3 = "DELETE";
|
|
872 goto LABEL_53;
|
|
873 }
|
|
874 if ( a1 == VK_HOME )
|
|
875 {
|
|
876 v3 = "HOME";
|
|
877 goto LABEL_53;
|
|
878 }
|
|
879 if ( a1 == VK_INSERT )
|
|
880 {
|
|
881 v3 = "INSERT";
|
|
882 goto LABEL_53;
|
|
883 }
|
|
884 if ( a1 == VK_DECIMAL )
|
|
885 {
|
|
886 v3 = "DECIMAL";
|
|
887 goto LABEL_53;
|
|
888 }
|
|
889 if ( a1 == VK_OEM_COMMA )
|
|
890 {
|
|
891 v3 = "COMMA";
|
|
892 goto LABEL_53;
|
|
893 }
|
|
894 if ( a1 == VK_OEM_1 )
|
|
895 {
|
|
896 v3 = "SEMICOLON";
|
|
897 goto LABEL_53;
|
|
898 }
|
|
899 if ( a1 == VK_OEM_PERIOD )
|
|
900 {
|
|
901 v3 = "PERIOD";
|
|
902 goto LABEL_53;
|
|
903 }
|
|
904 if ( a1 == VK_OEM_2 )
|
|
905 {
|
|
906 v3 = "SLASH";
|
|
907 goto LABEL_53;
|
|
908 }
|
|
909 if ( a1 == VK_OEM_7 )
|
|
910 {
|
|
911 v3 = "SQUOTE";
|
|
912 goto LABEL_53;
|
|
913 }
|
|
914 if ( a1 == VK_OEM_5 )
|
|
915 {
|
|
916 v3 = "BACKSLASH";
|
|
917 goto LABEL_53;
|
|
918 }
|
|
919 if ( a1 == VK_CONTROL )
|
|
920 {
|
|
921 v3 = "CONTROL";
|
|
922 goto LABEL_53;
|
|
923 }
|
|
924 if ( a1 == VK_BACK )
|
|
925 {
|
|
926 v3 = "BACKSPACE";
|
|
927 goto LABEL_53;
|
|
928 }
|
|
929 if ( a1 < 65 || a1 > 90 )
|
|
930 {
|
|
931 v3 = "-ÍÅÒ -";
|
|
932 goto LABEL_53;
|
|
933 }
|
|
934 *(unsigned short *)static_sub_45AE2C_string_69ADE0 = (unsigned __int8)a1;
|
|
935 return static_sub_45AE2C_string_69ADE0;
|
|
936 }
|
|
937
|
|
938 //----- (0045AFD9) --------------------------------------------------------
|
|
939 Keyboard::Keyboard()
|
|
940 {
|
|
941 bUsingAsynKeyboard = false;
|
|
942
|
|
943 if (pVersion->pVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT &&
|
|
944 pVersion->pVersionInfo.dwMajorVersion == 4)
|
|
945 bUsingAsynKeyboard = false;
|
|
946 }
|
|
947
|
|
948 //----- (0045B019) --------------------------------------------------------
|
|
949 void Keyboard::EnterCriticalSection()
|
|
950 {
|
|
951 if (bUsingAsynKeyboard)
|
|
952 AsyncKeyboard::EnterCriticalSection();
|
|
953 }
|
|
954
|
|
955 //----- (0045B06E) --------------------------------------------------------
|
|
956 bool Keyboard::IsShiftHeld()
|
|
957 {
|
|
958 if (bUsingAsynKeyboard)
|
|
959 {
|
|
960 if ( pAsyncKeyboard->_45B4EC(0x2Au) )
|
|
961 {
|
140
|
962 return true;
|
0
|
963 }
|
140
|
964 return pAsyncKeyboard->_45B4EC(0x36u) != 0;
|
0
|
965 }
|
|
966 else
|
140
|
967 return GetAsyncKeyState(VK_SHIFT);
|
0
|
968 }
|
|
969
|
|
970 //----- (0045B0A9) --------------------------------------------------------
|
|
971 bool Keyboard::IsKeyBeingHeld(int vKey)
|
|
972 {
|
|
973 void *v2; // esi@2
|
|
974 char v3; // bl@2
|
163
|
975 bool result;
|
0
|
976
|
|
977 if (bUsingAsynKeyboard)
|
|
978 {
|
|
979 __debugbreak();
|
|
980 /*
|
|
981 v2 = pAsyncKeyboard;
|
|
982 EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard);
|
|
983 v3 = *((unsigned char *)v2 + (unsigned __int8)AsyncKeyboard::map_key(v2, vKey) + 265) >> 7;
|
|
984 LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard);
|
|
985 return v3;*/
|
|
986 }
|
|
987 else
|
163
|
988 //return (GetAsyncKeyState(vKey) & 0x8001) != 0;
|
|
989 result = GetAsyncKeyState(vKey);
|
|
990 return result;
|
0
|
991 }
|
|
992
|
|
993 //----- (0045B0CE) --------------------------------------------------------
|
|
994 bool Keyboard::WasKeyPressed(int vKey)
|
|
995 {
|
|
996 void *v2; // esi@2
|
|
997 char v3; // bl@2
|
|
998 bool result; // eax@2
|
|
999
|
163
|
1000 if ( this->bUsingAsynKeyboard )
|
0
|
1001 {
|
|
1002 __debugbreak();
|
|
1003 /*v2 = pAsyncKeyboard;
|
|
1004 EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard);
|
|
1005 v3 = *((unsigned char *)v2 + (unsigned __int8)AsyncKeyboard::map_key(v2, vKey) + 521) >> 7;
|
|
1006 LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard);
|
|
1007 LOBYTE(result) = v3;*/
|
|
1008 }
|
|
1009 else
|
|
1010 {
|
163
|
1011 result = GetAsyncKeyState(vKey);
|
|
1012 //LOBYTE(result) = result & 1;
|
0
|
1013 }
|
|
1014 return result;
|
|
1015 }
|
|
1016
|
|
1017 //----- (0045B10A) --------------------------------------------------------
|
|
1018 AsyncKeyboard::AsyncKeyboard()
|
|
1019 {
|
|
1020 *(unsigned int *)(this + 4) = 0;
|
|
1021 *(unsigned char *)(this + 8) = 0;
|
|
1022
|
|
1023 if (!Initialize())
|
|
1024 MessageBoxW(nullptr, L"Could not initialize asynchronos keyboard object", nullptr, 0);
|
|
1025 }
|
|
1026 // 4D86B8: using guessed type int (__stdcall *AsyncKeyboard_pvdtor)(char);
|
|
1027 // 4DBD94: using guessed type int dword_4DBD94;
|
|
1028
|
|
1029
|
|
1030 //----- (0045B15E) --------------------------------------------------------
|
|
1031 AsyncKeyboard::~AsyncKeyboard()
|
|
1032 {
|
|
1033 __debugbreak();
|
|
1034 /*
|
|
1035 void *v1; // esi@1
|
|
1036 char *v2; // edi@1
|
|
1037 int v3; // ecx@1
|
|
1038
|
|
1039 v1 = this;
|
|
1040 v2 = (char *)this + 1804;
|
|
1041 v3 = *((unsigned int *)this + 451);
|
|
1042 if ( v3 )
|
|
1043 (**(void (__stdcall ***)(unsigned int))v3)(1);
|
|
1044 *(unsigned int *)v2 = 0;
|
|
1045 return TerminateThread(*((HANDLE *)v1 + 1), 0x1F4u);*/
|
|
1046 }
|
|
1047 // 4D86B8: using guessed type int (__stdcall *AsyncKeyboard_pvdtor)(char);
|
|
1048
|
|
1049 //----- (0045B18E) --------------------------------------------------------
|
|
1050 bool AsyncKeyboard::Initialize()
|
|
1051 {
|
|
1052 _45B1B1();
|
|
1053 if (_45B229())
|
|
1054 return CreateDirectInputKeyboard() != 0;
|
|
1055 return false;
|
|
1056 }
|
|
1057
|
|
1058 //----- (0045B1B1) --------------------------------------------------------
|
|
1059 void AsyncKeyboard::_45B1B1()
|
|
1060 {
|
|
1061 void *v1; // esi@1
|
|
1062
|
|
1063 v1 = this;
|
|
1064 memset((char *)this + 9, 0, 0x100u);
|
|
1065 memset((char *)v1 + 265, 0, 0x100u);
|
|
1066 memset((char *)v1 + 521, 0, 0x100u);
|
|
1067 memset((char *)v1 + 780, 0, 0x400u);
|
|
1068 }
|
|
1069
|
|
1070 //----- (0045B1FD) --------------------------------------------------------
|
|
1071 void AsyncKeyboard::EnterCriticalSection()
|
|
1072 {
|
|
1073 __debugbreak();
|
|
1074 //EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard);
|
|
1075 }
|
|
1076
|
|
1077 //----- (0045B213) --------------------------------------------------------
|
|
1078 void AsyncKeyboard::LeaveCriticalSection()
|
|
1079 {
|
|
1080 __debugbreak();
|
|
1081 //LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard);
|
|
1082 }
|
|
1083
|
|
1084 //----- (0045B229) --------------------------------------------------------
|
|
1085 char AsyncKeyboard::_45B229()
|
|
1086 {
|
|
1087 __debugbreak();
|
|
1088 return 0;
|
|
1089 /*void *v1; // esi@1
|
|
1090 HANDLE v2; // eax@1
|
|
1091 char result; // al@2
|
|
1092 DWORD ThreadId; // [sp+0h] [bp-4h]@1
|
|
1093
|
|
1094 ThreadId = (DWORD)this;
|
|
1095 v1 = this;
|
|
1096 v2 = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)AsyncKeyboardThread, this, 4u, &ThreadId);
|
|
1097 *((unsigned int *)v1 + 1) = v2;
|
|
1098 if ( v2 )
|
|
1099 result = SetThreadPriority(v2, 15) != 0;
|
|
1100 else
|
|
1101 result = 0;
|
|
1102 return result;*/
|
|
1103 }
|
|
1104
|
|
1105 //----- (0045B260) --------------------------------------------------------
|
|
1106 char AsyncKeyboard::CreateDirectInputKeyboard()
|
|
1107 {
|
|
1108 __debugbreak();
|
|
1109 return 0;
|
|
1110 /*v1 = this;
|
|
1111 v2 = new DirectInputKeyboard;
|
|
1112 *((void **)v1 + 451) = v2;
|
|
1113
|
|
1114 return v2 != 0;*/
|
|
1115 }
|
|
1116
|
|
1117 //----- (0045B2A7) --------------------------------------------------------
|
|
1118 void AsyncKeyboard::Resume()
|
|
1119 {
|
|
1120 __debugbreak();
|
|
1121 /*void *v1; // esi@1
|
|
1122 std::string v2; // [sp-18h] [bp-24h]@2
|
|
1123 const char *v3; // [sp-8h] [bp-14h]@2
|
|
1124 int v4; // [sp-4h] [bp-10h]@2
|
|
1125 std::string *v5; // [sp+4h] [bp-8h]@2
|
|
1126 int a3; // [sp+Bh] [bp-1h]@2
|
|
1127
|
|
1128 v1 = this;
|
|
1129 if ( *((unsigned int *)this + 451) )
|
|
1130 {
|
|
1131 EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard);
|
|
1132 _45B1B1();
|
|
1133 DirectInputKeyboard::set_acquire(*((DirectInputKeyboard **)v1 + 451), (int *)1);
|
|
1134 ResumeThread(*((HANDLE *)v1 + 1));
|
|
1135 LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard);
|
|
1136 }
|
|
1137 else
|
|
1138 {
|
|
1139 MessageBoxW(nullptr, L"Invalid DI_Keyboard, bailing out of resume()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\KeyboardAsync.cpp:97", 0);
|
|
1140 }*/
|
|
1141 }
|
|
1142
|
|
1143 //----- (0045B329) --------------------------------------------------------
|
|
1144 void AsyncKeyboard::Suspend()
|
|
1145 {
|
|
1146 __debugbreak();
|
|
1147 /*void *v1; // esi@1
|
|
1148 std::string v2; // [sp-18h] [bp-24h]@2
|
|
1149 const char *v3; // [sp-8h] [bp-14h]@2
|
|
1150 int v4; // [sp-4h] [bp-10h]@2
|
|
1151 std::string *v5; // [sp+4h] [bp-8h]@2
|
|
1152 int a3; // [sp+Bh] [bp-1h]@2
|
|
1153
|
|
1154 v1 = this;
|
|
1155 if ( *((unsigned int *)this + 451) )
|
|
1156 {
|
|
1157 EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard);
|
|
1158 SuspendThread(*((HANDLE *)v1 + 1));
|
|
1159 DirectInputKeyboard::set_acquire(*((DirectInputKeyboard **)v1 + 451), 0);
|
|
1160 LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard);
|
|
1161 }
|
|
1162 else
|
|
1163 {
|
|
1164 MessageBoxW(nullptr, L"Invalid DI_Keyboard, bailing out of suspend()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\KeyboardAsync.cpp:115", 0);
|
|
1165 }*/
|
|
1166 }
|
|
1167
|
|
1168 //----- (0045B3A4) --------------------------------------------------------
|
|
1169 char AsyncKeyboard::_45B3A4()
|
|
1170 {
|
|
1171 __debugbreak();
|
|
1172 return 0;
|
|
1173 /**((unsigned char *)this + 8) = 1;
|
|
1174 Sleep(0x85u);
|
|
1175 return 1;*/
|
|
1176 }
|
|
1177
|
|
1178
|
|
1179 //----- (00465C53) --------------------------------------------------------
|
|
1180 void AsyncKeyboard::Release()
|
|
1181 {
|
|
1182 __debugbreak();
|
|
1183 /*if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) )
|
|
1184 {
|
|
1185 if ( pAsyncKeyboard )
|
|
1186 {
|
|
1187 pAsyncKeyboard->Suspend();
|
|
1188 if ( pAsyncKeyboard )
|
|
1189 (**(void (__stdcall ***)(int))pAsyncKeyboard)(1);
|
|
1190 }
|
|
1191 pAsyncKeyboard = 0;
|
|
1192 }*/
|
|
1193 }
|
|
1194
|
|
1195 //----- (0045B3B6) --------------------------------------------------------
|
|
1196 void AsyncKeyboard::Thread()
|
|
1197 {
|
|
1198 __debugbreak();
|
|
1199 /*void *v1; // esi@1
|
|
1200 signed int v2; // ecx@3
|
|
1201 int v3; // eax@3
|
|
1202 DWORD v4; // edx@6
|
|
1203 std::string v5; // [sp-18h] [bp-2Ch]@2
|
|
1204 const char *v6; // [sp-8h] [bp-1Ch]@2
|
|
1205 int v7; // [sp-4h] [bp-18h]@2
|
|
1206 DWORD v8; // [sp+Ch] [bp-8h]@2
|
|
1207 int a3; // [sp+13h] [bp-1h]@2
|
|
1208
|
|
1209 v1 = this;
|
|
1210 if ( *((unsigned int *)this + 451) )
|
|
1211 {
|
|
1212 ::EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard);
|
|
1213 v8 = timeGetTime();
|
|
1214 memcpy((char *)v1 + 9, (const void *)(*((unsigned int *)v1 + 451) + 29), 0x100u);
|
|
1215 (*((DirectInputKeyboard **)v1 + 451)->_43B8EC();
|
|
1216 memcpy((char *)v1 + 265, (const void *)(*((unsigned int *)v1 + 451) + 29), 0x100u);
|
|
1217 v2 = 0;
|
|
1218 v3 = (int)((char *)v1 + 780);
|
|
1219 do
|
|
1220 {
|
|
1221 if ( *((unsigned char *)v1 + v2 + 265) & 0x80 )
|
|
1222 {
|
|
1223 if ( v8 - *(unsigned int *)v3 > 0xC8 )
|
|
1224 {
|
|
1225 v4 = v8;
|
|
1226 *((unsigned char *)v1 + v2 + 521) |= 0x80u;
|
|
1227 *(unsigned int *)v3 = v4;
|
|
1228 }
|
|
1229 }
|
|
1230 ++v2;
|
|
1231 v3 += 4;
|
|
1232 }
|
|
1233 while ( v2 < 256 );
|
|
1234 ::LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard);
|
|
1235 }
|
|
1236 else
|
|
1237 {
|
|
1238 MessageBoxW(nullptr, L"Invalid DI_Keyboard, bailing out of update_keyboard_data()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\KeyboardAsync.cpp:169", 0);
|
|
1239 }*/
|
|
1240 }
|
|
1241
|
|
1242 //----- (0045B4EC) --------------------------------------------------------
|
|
1243 char AsyncKeyboard::_45B4EC(unsigned __int8 a2)
|
|
1244 {
|
|
1245 __debugbreak();
|
|
1246 return 0;
|
|
1247 /*void *v2; // esi@1
|
|
1248 char v3; // bl@1
|
|
1249
|
|
1250 v2 = this;
|
|
1251 EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard);
|
|
1252 v3 = *((unsigned char *)v2 + a2 + 265) >> 7;
|
|
1253 LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncKeyboard);
|
|
1254 return v3;*/
|
|
1255 }
|
|
1256
|
|
1257 //----- (0045B57D) --------------------------------------------------------
|
|
1258 char AsyncKeyboard::map_key(int key)
|
|
1259 {
|
|
1260 __debugbreak();
|
|
1261 return 0;
|
|
1262 /*char result; // al@2
|
|
1263 std::string v3; // [sp-18h] [bp-1Ch]@99
|
|
1264 const char *v4; // [sp-8h] [bp-Ch]@99
|
|
1265 int v5; // [sp-4h] [bp-8h]@99
|
|
1266 void *v6; // [sp+0h] [bp-4h]@1
|
|
1267
|
|
1268 v6 = this;
|
|
1269 switch ( key )
|
|
1270 {
|
|
1271 case 8:
|
|
1272 result = 14;
|
|
1273 break;
|
|
1274 case 9:
|
|
1275 result = 15;
|
|
1276 break;
|
|
1277 case 13:
|
|
1278 result = 28;
|
|
1279 break;
|
|
1280 case 16:
|
|
1281 case 161:
|
|
1282 result = 54;
|
|
1283 break;
|
|
1284 case 160:
|
|
1285 result = 42;
|
|
1286 break;
|
|
1287 case 17:
|
|
1288 case 163:
|
|
1289 result = -99;
|
|
1290 break;
|
|
1291 case 162:
|
|
1292 result = 29;
|
|
1293 break;
|
|
1294 case 18:
|
|
1295 result = -72;
|
|
1296 break;
|
|
1297 case 20:
|
|
1298 result = 58;
|
|
1299 break;
|
|
1300 case 21:
|
|
1301 result = 112;
|
|
1302 break;
|
|
1303 case 25:
|
|
1304 result = -108;
|
|
1305 break;
|
|
1306 case 27:
|
|
1307 result = 1;
|
|
1308 break;
|
|
1309 case 28:
|
|
1310 result = 121;
|
|
1311 break;
|
|
1312 case 29:
|
|
1313 result = 123;
|
|
1314 break;
|
|
1315 case 32:
|
|
1316 result = 57;
|
|
1317 break;
|
|
1318 case 33:
|
|
1319 result = -55;
|
|
1320 break;
|
|
1321 case 34:
|
|
1322 result = -47;
|
|
1323 break;
|
|
1324 case 35:
|
|
1325 result = -49;
|
|
1326 break;
|
|
1327 case 36:
|
|
1328 result = -57;
|
|
1329 break;
|
|
1330 case 37:
|
|
1331 result = -53;
|
|
1332 break;
|
|
1333 case 38:
|
|
1334 result = -56;
|
|
1335 break;
|
|
1336 case 39:
|
|
1337 result = -51;
|
|
1338 break;
|
|
1339 case 40:
|
|
1340 result = -48;
|
|
1341 break;
|
|
1342 case 42:
|
|
1343 result = -73;
|
|
1344 break;
|
|
1345 case 45:
|
|
1346 result = -46;
|
|
1347 break;
|
|
1348 case 46:
|
|
1349 result = -45;
|
|
1350 break;
|
|
1351 case 48:
|
|
1352 result = 11;
|
|
1353 break;
|
|
1354 case 49:
|
|
1355 result = 2;
|
|
1356 break;
|
|
1357 case 50:
|
|
1358 result = 3;
|
|
1359 break;
|
|
1360 case 51:
|
|
1361 result = 4;
|
|
1362 break;
|
|
1363 case 52:
|
|
1364 result = 5;
|
|
1365 break;
|
|
1366 case 53:
|
|
1367 result = 6;
|
|
1368 break;
|
|
1369 case 54:
|
|
1370 result = 7;
|
|
1371 break;
|
|
1372 case 55:
|
|
1373 result = 8;
|
|
1374 break;
|
|
1375 case 56:
|
|
1376 result = 9;
|
|
1377 break;
|
|
1378 case 57:
|
|
1379 result = 10;
|
|
1380 break;
|
|
1381 case 65:
|
|
1382 result = 30;
|
|
1383 break;
|
|
1384 case 66:
|
|
1385 result = 48;
|
|
1386 break;
|
|
1387 case 67:
|
|
1388 result = 46;
|
|
1389 break;
|
|
1390 case 68:
|
|
1391 result = 32;
|
|
1392 break;
|
|
1393 case 69:
|
|
1394 result = 18;
|
|
1395 break;
|
|
1396 case 70:
|
|
1397 result = 33;
|
|
1398 break;
|
|
1399 case 71:
|
|
1400 result = 34;
|
|
1401 break;
|
|
1402 case 72:
|
|
1403 result = 35;
|
|
1404 break;
|
|
1405 case 73:
|
|
1406 result = 23;
|
|
1407 break;
|
|
1408 case 74:
|
|
1409 result = 36;
|
|
1410 break;
|
|
1411 case 75:
|
|
1412 result = 37;
|
|
1413 break;
|
|
1414 case 76:
|
|
1415 result = 38;
|
|
1416 break;
|
|
1417 case 77:
|
|
1418 result = 50;
|
|
1419 break;
|
|
1420 case 78:
|
|
1421 result = 49;
|
|
1422 break;
|
|
1423 case 79:
|
|
1424 result = 24;
|
|
1425 break;
|
|
1426 case 80:
|
|
1427 result = 25;
|
|
1428 break;
|
|
1429 case 81:
|
|
1430 result = 16;
|
|
1431 break;
|
|
1432 case 82:
|
|
1433 result = 19;
|
|
1434 break;
|
|
1435 case 83:
|
|
1436 result = 31;
|
|
1437 break;
|
|
1438 case 84:
|
|
1439 result = 20;
|
|
1440 break;
|
|
1441 case 85:
|
|
1442 result = 22;
|
|
1443 break;
|
|
1444 case 86:
|
|
1445 result = 47;
|
|
1446 break;
|
|
1447 case 87:
|
|
1448 result = 17;
|
|
1449 break;
|
|
1450 case 88:
|
|
1451 result = 45;
|
|
1452 break;
|
|
1453 case 89:
|
|
1454 result = 21;
|
|
1455 break;
|
|
1456 case 90:
|
|
1457 result = 44;
|
|
1458 break;
|
|
1459 case 91:
|
|
1460 result = -37;
|
|
1461 break;
|
|
1462 case 92:
|
|
1463 result = -36;
|
|
1464 break;
|
|
1465 case 93:
|
|
1466 result = -35;
|
|
1467 break;
|
|
1468 case 96:
|
|
1469 result = 82;
|
|
1470 break;
|
|
1471 case 97:
|
|
1472 result = 79;
|
|
1473 break;
|
|
1474 case 98:
|
|
1475 result = 80;
|
|
1476 break;
|
|
1477 case 99:
|
|
1478 result = 81;
|
|
1479 break;
|
|
1480 case 100:
|
|
1481 result = 75;
|
|
1482 break;
|
|
1483 case 101:
|
|
1484 result = 76;
|
|
1485 break;
|
|
1486 case 102:
|
|
1487 result = 77;
|
|
1488 break;
|
|
1489 case 103:
|
|
1490 result = 71;
|
|
1491 break;
|
|
1492 case 104:
|
|
1493 result = 72;
|
|
1494 break;
|
|
1495 case 105:
|
|
1496 result = 73;
|
|
1497 break;
|
|
1498 case 106:
|
|
1499 result = 55;
|
|
1500 break;
|
|
1501 case 107:
|
|
1502 result = 78;
|
|
1503 break;
|
|
1504 case 109:
|
|
1505 result = 74;
|
|
1506 break;
|
|
1507 case 110:
|
|
1508 result = 83;
|
|
1509 break;
|
|
1510 case 111:
|
|
1511 result = -75;
|
|
1512 break;
|
|
1513 case 112:
|
|
1514 result = 59;
|
|
1515 break;
|
|
1516 case 113:
|
|
1517 result = 60;
|
|
1518 break;
|
|
1519 case 114:
|
|
1520 result = 61;
|
|
1521 break;
|
|
1522 case 115:
|
|
1523 result = 62;
|
|
1524 break;
|
|
1525 case 116:
|
|
1526 result = 63;
|
|
1527 break;
|
|
1528 case 117:
|
|
1529 result = 64;
|
|
1530 break;
|
|
1531 case 118:
|
|
1532 result = 65;
|
|
1533 break;
|
|
1534 case 119:
|
|
1535 result = 66;
|
|
1536 break;
|
|
1537 case 120:
|
|
1538 result = 67;
|
|
1539 break;
|
|
1540 case 121:
|
|
1541 result = 68;
|
|
1542 break;
|
|
1543 case 122:
|
|
1544 result = 87;
|
|
1545 break;
|
|
1546 case 123:
|
|
1547 result = 88;
|
|
1548 break;
|
|
1549 case 124:
|
|
1550 result = 100;
|
|
1551 break;
|
|
1552 case 125:
|
|
1553 result = 101;
|
|
1554 break;
|
|
1555 case 126:
|
|
1556 result = 102;
|
|
1557 break;
|
|
1558 case 144:
|
|
1559 result = 69;
|
|
1560 break;
|
|
1561 case 145:
|
|
1562 result = 70;
|
|
1563 break;
|
|
1564 default:
|
|
1565 MessageBoxW(nullptr, L"Uknown key detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\KeyboardAsync.cpp:999", 0);
|
|
1566 goto LABEL_100;
|
|
1567 case 1:
|
|
1568 case 2:
|
|
1569 case 3:
|
|
1570 case 4:
|
|
1571 case 12:
|
|
1572 case 19:
|
|
1573 case 23:
|
|
1574 case 24:
|
|
1575 case 30:
|
|
1576 case 31:
|
|
1577 case 41:
|
|
1578 case 43:
|
|
1579 case 44:
|
|
1580 case 47:
|
|
1581 case 108:
|
|
1582 case 127:
|
|
1583 case 128:
|
|
1584 case 129:
|
|
1585 case 130:
|
|
1586 case 131:
|
|
1587 case 132:
|
|
1588 case 133:
|
|
1589 case 134:
|
|
1590 case 135:
|
|
1591 LABEL_100:
|
|
1592 result = -1;
|
|
1593 break;
|
|
1594 }
|
|
1595 return result;*/
|
|
1596 }
|
|
1597
|
|
1598 //----- (0045BA60) --------------------------------------------------------
|
|
1599 int __stdcall AsyncKeyboard::ThreadStarter(AsyncKeyboard *pInstance)
|
|
1600 {
|
|
1601 __debugbreak();
|
|
1602 return 0;
|
|
1603 /*while ( 1 )
|
|
1604 {
|
|
1605 while ( !pAsyncKeyboard )
|
|
1606 ;
|
|
1607 if ( *((unsigned char *)pAsyncKeyboard + 8) )
|
|
1608 ExitThread(0);
|
|
1609 pAsyncKeyboard->Thread();
|
|
1610 Sleep(0x21u);
|
|
1611 }*/
|
|
1612 }
|
|
1613
|
|
1614
|
|
1615
|
|
1616
|
|
1617
|
|
1618
|
|
1619
|
|
1620
|
|
1621 /*
|
|
1622 //----- (0043B76D) --------------------------------------------------------
|
|
1623 DirectInputKeyboard *__thiscall DirectInputKeyboard::DirectInputKeyboard(DirectInputKeyboard *this)
|
|
1624 {
|
|
1625 DirectInputKeyboard *v1; // esi@1
|
|
1626 HRESULT v2; // eax@5
|
|
1627 unsigned int uVersion; // [sp-18h] [bp-20h]@3
|
|
1628 IDirectInput **ppDirectInput; // [sp-14h] [bp-1Ch]@3
|
|
1629 int v6; // [sp-10h] [bp-18h]@3
|
|
1630 const char *v7; // [sp-Ch] [bp-14h]@3
|
|
1631 int v8; // [sp-8h] [bp-10h]@3
|
|
1632 unsigned int v9; // [sp-4h] [bp-Ch]@3
|
|
1633 CheckHRESULT_stru0 v10; // [sp+4h] [bp-4h]@5
|
|
1634
|
|
1635 v1 = this;
|
|
1636 this->field_8 = 0;
|
|
1637 LOBYTE(this->field_1C) = 0;
|
|
1638 this->vdestructor_ptr = &pDirectInputKeyboard_pvdtor;
|
|
1639 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 )
|
|
1640 {
|
|
1641 v9 = 1;
|
|
1642 v8 = 28;
|
|
1643 v7 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp";
|
|
1644 v6 = 0;
|
|
1645 ppDirectInput = &this->pDirectInput;
|
|
1646 uVersion = 0x500u;
|
|
1647 }
|
|
1648 else
|
|
1649 {
|
|
1650 v9 = 1;
|
|
1651 v8 = 26;
|
|
1652 v7 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp";
|
|
1653 v6 = 0;
|
|
1654 ppDirectInput = &this->pDirectInput;
|
|
1655 uVersion = 0x300u;
|
|
1656 }
|
|
1657 v2 = DirectInputCreateA(hInstance, uVersion, ppDirectInput, v6);
|
|
1658 CheckHRESULT(&v10, v2, v7, v8, v9);
|
|
1659 DirectInputKeyboard::CreateDevice(v1);
|
|
1660 DirectInputKeyboard::43B87B(v1);
|
|
1661 return v1;
|
|
1662 }
|
|
1663 // 4C8880: using guessed type int __stdcall DirectInputCreateA(int, int, int, int);
|
|
1664
|
|
1665 //----- (0043B7E3) --------------------------------------------------------
|
|
1666 void __thiscall DirectInputKeyboard::vdtor(DirectInputKeyboard *this, bool a2)
|
|
1667 {
|
|
1668 void *v2; // esi@1
|
|
1669
|
|
1670 v2 = this;
|
|
1671 DirectInputKeyboard::dtor(this);
|
|
1672 if ( a2 & 1 )
|
|
1673 free(v2);
|
|
1674 }
|
|
1675
|
|
1676 //----- (0043B7FF) --------------------------------------------------------
|
|
1677 void __thiscall DirectInputKeyboard::dtor(DirectInputKeyboard *this)
|
|
1678 {
|
|
1679 DirectInputKeyboard *v1; // esi@1
|
|
1680 int v2; // eax@1
|
|
1681
|
|
1682 v1 = this;
|
|
1683 v2 = this->field_8;
|
|
1684 this->vdestructor_ptr = &pDirectInputKeyboard_pvdtor;
|
|
1685 if ( v2 )
|
|
1686 {
|
|
1687 (*(void (__stdcall **)(int))(*(int *)v2 + 32))(v2);
|
|
1688 (*(void (__stdcall **)(int))(*(int *)v1->field_8 + 8))(v1->field_8);
|
|
1689 v1->field_8 = 0;
|
|
1690 }
|
|
1691 v1->pDirectInput->lpVtbl->Release(v1->pDirectInput);
|
|
1692 v1->pDirectInput = 0;
|
|
1693 }
|
|
1694
|
|
1695 //----- (0043B831) --------------------------------------------------------
|
|
1696 void __thiscall DirectInputKeyboard::CreateDevice(DirectInputKeyboard *this)
|
|
1697 {
|
|
1698 DirectInputKeyboard *v1; // esi@1
|
|
1699 HRESULT v2; // eax@1
|
|
1700 int v3; // [sp+4h] [bp-4h]@1
|
|
1701
|
|
1702 v1 = this;
|
|
1703 v2 = ((int (__stdcall *)(IDirectInput *, signed int, int (__stdcall *)(int, int), DirectInputKeyboard *, signed int))this->pDirectInput->lpVtbl->field_10)(
|
|
1704 this->pDirectInput,
|
|
1705 3,
|
|
1706 DirectInputKeyboard_enumerator_43B9B9,
|
|
1707 this,
|
|
1708 1);
|
|
1709 CheckHRESULT((CheckHRESULT_stru0 *)&v3, v2, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp", 52, 1u);
|
|
1710 if ( !LOBYTE(v1->field_1C) )
|
|
1711 {
|
|
1712 v3 = (int)"Error: No keyboard found";
|
|
1713 _CxxThrowException((int)&v3, (int)&dword_4DBD94);
|
|
1714 }
|
|
1715 }
|
|
1716 // 43B9B9: using guessed type int __stdcall DirectInputKeyboard_enumerator_43B9B9(int, int);
|
|
1717 // 4DBD94: using guessed type int dword_4DBD94;
|
|
1718
|
|
1719 //----- (0043B87B) --------------------------------------------------------
|
|
1720 void __thiscall DirectInputKeyboard::43B87B(DirectInputKeyboard *ecx0)
|
|
1721 {
|
|
1722 char *v1; // esi@1
|
|
1723 HRESULT v2; // eax@1
|
|
1724 HRESULT v3; // eax@1
|
|
1725 HRESULT v4; // eax@1
|
|
1726 unsigned int v5; // [sp+0h] [bp-Ch]@0
|
|
1727 char this; // [sp+8h] [bp-4h]@1
|
|
1728
|
|
1729 v1 = (char *)&ecx0->field_8;
|
|
1730 v2 = ((int (__stdcall *)(IDirectInput *, int *, int *, int, int))ecx0->pDirectInput->lpVtbl->field_C)(
|
|
1731 ecx0->pDirectInput,
|
|
1732 &ecx0->field_C,
|
|
1733 &ecx0->field_8,
|
|
1734 0,
|
|
1735 "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp");
|
|
1736 CheckHRESULT((CheckHRESULT_stru0 *)&this, v2, (const char *)0x3C, 1, v5);
|
|
1737 v3 = (*(int (__stdcall **)(int, int))(**(int **)v1 + 44))(*(int *)v1, dword_4C9890);
|
|
1738 CheckHRESULT((CheckHRESULT_stru0 *)&this, v3, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp", 63, 1u);
|
|
1739 v4 = (*(int (__stdcall **)(int, HWND, signed int))(**(int **)v1 + 52))(*(int *)v1, hWnd, 6);
|
|
1740 CheckHRESULT((CheckHRESULT_stru0 *)&this, v4, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp", 64, 1u);
|
|
1741 (*(void (__cdecl **)(int))(**(int **)v1 + 28))(*(int *)v1);
|
|
1742 }
|
|
1743 // 4C9890: using guessed type int dword_4C9890[10];
|
|
1744
|
|
1745 //----- (0043B8EC) --------------------------------------------------------
|
|
1746 char __thiscall DirectInputKeyboard::43B8EC(DirectInputKeyboard *this)
|
|
1747 {
|
|
1748 DirectInputKeyboard *v1; // esi@1
|
|
1749 int v2; // eax@1
|
|
1750 char result; // al@2
|
|
1751 char *v4; // ebx@3
|
|
1752 int v5; // esi@5
|
|
1753 HRESULT v6; // eax@5
|
|
1754 std::string v7; // [sp-18h] [bp-2Ch]@2
|
|
1755 int v8; // [sp-Ch] [bp-20h]@5
|
|
1756 const char *v9; // [sp-8h] [bp-1Ch]@2
|
|
1757 int v10; // [sp-4h] [bp-18h]@2
|
|
1758 std::string *v13; // [sp+Ch] [bp-8h]@2
|
|
1759 int a3; // [sp+13h] [bp-1h]@2
|
|
1760
|
|
1761 v1 = this;
|
|
1762 v2 = this->field_8;
|
|
1763 if ( v2 )
|
|
1764 {
|
|
1765 v4 = (char *)&this->field_1C + 1;
|
|
1766 if ( (*(int (__stdcall **)(int, signed int, char *))(*(int *)v2 + 36))(v2, 256, (char *)&this->field_1C + 1) == -2147024866 )
|
|
1767 {
|
|
1768 if ( !(*(int (__stdcall **)(int))(*(int *)v1->field_8 + 28))(v1->field_8) )
|
|
1769 {
|
|
1770 v5 = v1->field_8;
|
|
1771 v10 = 1;
|
|
1772 v9 = (const char *)79;
|
|
1773 v8 = (int)"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp";
|
|
1774 v6 = (*(int (__stdcall **)(int, signed int, char *))(*(int *)v5 + 36))(v5, 256, v4);
|
|
1775 CheckHRESULT((CheckHRESULT_stru0 *)&v13, v6, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp", 79, 1u);
|
|
1776 }
|
|
1777 }
|
|
1778 result = 1;
|
|
1779 }
|
|
1780 else
|
|
1781 {
|
|
1782 MessageBoxW(nullptr, L"Invalid Device pointer, bailing out of update_data()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp:72", 0);
|
|
1783 result = 0;
|
|
1784 }
|
|
1785 return result;
|
|
1786 }
|
|
1787
|
|
1788 //----- (0043B96E) --------------------------------------------------------
|
|
1789 char __thiscall DirectInputKeyboard::set_acquire(DirectInputKeyboard *this, int *a2)
|
|
1790 {
|
|
1791 int v2; // eax@1
|
|
1792 char result; // al@2
|
|
1793 int v4; // ecx@3
|
|
1794 std::string v5; // [sp-18h] [bp-1Ch]@2
|
|
1795 const char *v6; // [sp-8h] [bp-Ch]@2
|
|
1796 int v7; // [sp-4h] [bp-8h]@2
|
|
1797 DirectInputKeyboard *v8; // [sp+0h] [bp-4h]@1
|
|
1798
|
|
1799 v8 = this;
|
|
1800 v2 = this->field_8;
|
|
1801 if ( v2 )
|
|
1802 {
|
|
1803 v4 = *(int *)v2;
|
|
1804 v7 = v2;
|
|
1805 if ( (char)a2 )
|
|
1806 (*(void (__stdcall **)(int))(v4 + 28))(v7);
|
|
1807 else
|
|
1808 (*(void (__stdcall **)(int))(v4 + 32))(v7);
|
|
1809 result = 1;
|
|
1810 }
|
|
1811 else
|
|
1812 {
|
|
1813 MessageBoxW(nullptr, L"Invalid Device pointer, bailing out of set_acquire()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputKeyboard.cpp:89", 0);
|
|
1814 result = 0;
|
|
1815 }
|
|
1816 return result;
|
|
1817 }
|
|
1818
|
|
1819 //----- (0043B9B9) --------------------------------------------------------
|
|
1820 signed int __stdcall DirectInputKeyboard_enumerator_43B9B9(int a1, int a2)
|
|
1821 {
|
|
1822 signed int result; // eax@2
|
|
1823
|
|
1824 if ( *(char *)(a1 + 36) & 3 )
|
|
1825 {
|
|
1826 *(int *)(a2 + 12) = *(int *)(a1 + 4);
|
|
1827 *(int *)(a2 + 16) = *(int *)(a1 + 8);
|
|
1828 *(int *)(a2 + 20) = *(int *)(a1 + 12);
|
|
1829 *(int *)(a2 + 24) = *(int *)(a1 + 16);
|
|
1830 *(char *)(a2 + 28) = 1;
|
|
1831 result = 0;
|
|
1832 }
|
|
1833 else
|
|
1834 {
|
|
1835 result = 1;
|
|
1836 }
|
|
1837 return result;
|
|
1838 }
|
|
1839 // 43B9B9: using guessed type int __stdcall DirectInputKeyboard_enumerator_43B9B9(int, int);
|
|
1840 */ |