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