annotate Keyboard.cpp @ 800:e6bab3f2c1be

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