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