0
|
1 #include "OSAPI.h"
|
|
2
|
|
3 #include "Mouse.h"
|
|
4 #include "Items.h"
|
|
5 #include "Party.h"
|
|
6 #include "LOD.h"
|
|
7 #include "Game.h"
|
|
8 #include "Texture.h"
|
|
9
|
|
10
|
|
11
|
|
12
|
|
13
|
|
14
|
|
15
|
|
16 Mouse *pMouse;
|
|
17 AsyncMouse *pAsyncMouse;
|
|
18
|
|
19
|
|
20
|
|
21
|
|
22
|
|
23 //----- (00469860) --------------------------------------------------------
|
|
24 void Mouse::GetClickPos(unsigned int *pX, unsigned int *pY)
|
|
25 {
|
|
26 unsigned int v3; // eax@2
|
|
27
|
|
28 if (pAsyncMouse)
|
|
29 {
|
|
30 *pX = *((int *)pAsyncMouse + 6);
|
|
31 v3 = *((int *)pAsyncMouse + 7);
|
|
32 }
|
|
33 else
|
|
34 {
|
|
35 *pX = this->uMouseClickX;
|
|
36 v3 = this->uMouseClickY;
|
|
37 }
|
|
38 *pY = v3;
|
|
39 }
|
|
40
|
|
41 //----- (004698A6) --------------------------------------------------------
|
|
42 void Mouse::RemoveHoldingItem()
|
|
43 {
|
|
44 pParty->pPickedItem.Reset();
|
|
45 if (strcmpi(pCurrentCursorName, "MICON2"))
|
|
46 SetCursorBitmap("MICON1");
|
|
47 }
|
|
48
|
|
49 //----- (004698D8) --------------------------------------------------------
|
|
50 void Mouse::SetCursorBitmapFromItemID(unsigned int uItemID)
|
|
51 {
|
|
52 pMouse->SetCursorBitmap(pItemsTable->pItems[uItemID].pIconName);
|
|
53 }
|
|
54
|
|
55 //----- (004698F6) --------------------------------------------------------
|
|
56 void Mouse::SetCurrentCursorBitmap()
|
|
57 {
|
|
58 SetCursorBitmap(pCurrentCursorName);
|
|
59 }
|
|
60
|
|
61 //----- (00469903) --------------------------------------------------------
|
|
62 void Mouse::SetCursorBitmap(const char *pName)
|
|
63 {
|
|
64 Mouse *v2; // esi@1
|
|
65 HCURSOR v3; // eax@10
|
|
66 int v4; // ecx@10
|
|
67 double v5; // st7@11
|
|
68 float v6; // ST04_4@12
|
|
69 LONG v7; // eax@14
|
|
70 LONG v8; // eax@17
|
|
71 unsigned int v9; // eax@21
|
|
72 float v10; // [sp+4h] [bp-18h]@11
|
|
73 struct tagPOINT Point; // [sp+14h] [bp-8h]@20
|
|
74
|
|
75 v2 = this;
|
|
76 if ( !this->bInitialized || !pName )
|
|
77 return;
|
|
78 if ( _strcmpi("MICON2", pName) )
|
|
79 pGame->uFlags2 &= 0xFFFFFFEFu;
|
|
80 else
|
|
81 pGame->uFlags2 |= 0x10u;
|
|
82 if ( _strcmpi(v2->pCurrentCursorName, pName) )
|
|
83 strcpy(v2->pCurrentCursorName, pName);
|
|
84 ClearCursor();
|
|
85 if ( _strnicmp(pName, "MICON1", 5u) )
|
|
86 {
|
|
87 v9 = pIcons_LOD->LoadTexture(pName, TEXTURE_16BIT_PALETTE);
|
|
88 v2->uCursorTextureID = v9;
|
|
89 v2->uCursorTextureID_2 = v9;
|
|
90 v2->AllocCursorSystemMem();
|
|
91 v2->field_C = 0;
|
|
92 v2->field_14 = 1;
|
|
93 v2->bActive = 1;
|
|
94 if ( !areWeLoadingTexture )
|
|
95 {
|
|
96 if (uCursorTextureID != -1)
|
|
97 pIcons_LOD->pTextures[uCursorTextureID].Release();
|
|
98 pIcons_LOD->_40F9C5();
|
|
99 }
|
|
100 return;
|
|
101 }
|
|
102 v2->bActive = 0;
|
|
103 v2->field_C = 1;
|
|
104 if ( !strcmp(pName, "MICON1") )
|
|
105 {
|
|
106 v3 = LoadCursorA(GetModuleHandleW(nullptr), "Arrow");
|
|
107 SetClassLongA(hWnd, GCL_HCURSOR, (LONG)v3);
|
|
108 v4 = (int)pAsyncMouse;
|
|
109 if (pAsyncMouse)
|
|
110 {
|
|
111 v10 = 0.0;
|
|
112 v5 = 0.0;
|
|
113 LABEL_12:
|
|
114 v6 = v5;
|
|
115 pAsyncMouse->SetHotspot(v6, v10);
|
|
116 goto LABEL_18;
|
|
117 }
|
|
118 goto LABEL_20;
|
|
119 }
|
|
120 if ( !strcmp(pName, "MICON2") )
|
|
121 {
|
|
122 v7 = (LONG)LoadCursorA(GetModuleHandleW(nullptr), "Target");
|
|
123 SetClassLongA(hWnd, -12, v7);
|
|
124 v4 = (int)pAsyncMouse;
|
|
125 if (pAsyncMouse)
|
|
126 {
|
|
127 v10 = 14.0;
|
|
128 v5 = 14.0;
|
|
129 goto LABEL_12;
|
|
130 }
|
|
131 LABEL_20:
|
|
132 GetCursorPos(&Point);
|
|
133 SetCursorPos(Point.x, Point.y);
|
|
134 return;
|
|
135 }
|
|
136 if ( !strcmp(pName, "MICON3") )
|
|
137 {
|
|
138 v8 = (LONG)LoadCursorA(0, (LPCSTR)IDC_WAIT);
|
|
139 SetClassLongA(hWnd, -12, v8);
|
|
140 }
|
|
141 LABEL_18:
|
|
142 if ( !pAsyncMouse || (pAsyncMouse->LoadCursor(pName), !pAsyncMouse) )
|
|
143 goto LABEL_20;
|
|
144 }
|
|
145 // 506128: using guessed type int areWeLoadingTexture;
|
|
146
|
|
147 //----- (00469AE4) --------------------------------------------------------
|
|
148 LONG Mouse::_469AE4()
|
|
149 {
|
|
150 Mouse *v1; // esi@1
|
|
151 LONG v2; // ecx@2
|
|
152 LONG result; // eax@2
|
|
153 struct tagPOINT Point; // [sp+Ch] [bp-8h]@2
|
|
154
|
|
155 v1 = this;
|
|
156 this->field_8 = 1;
|
|
157 if (pAsyncMouse)
|
|
158 {
|
|
159 v2 = *((int *)pAsyncMouse + 6);
|
|
160 Point.x = *((int *)pAsyncMouse + 6);
|
|
161 result = *((int *)pAsyncMouse + 7);
|
|
162 }
|
|
163 else
|
|
164 {
|
|
165 GetCursorPos(&Point);
|
|
166 if ( pRenderer->bWindowMode )
|
|
167 ScreenToClient(hWnd, &Point);
|
|
168 result = Point.y;
|
|
169 v2 = Point.x;
|
|
170 }
|
|
171 v1->uMouseClickX = v2;
|
|
172 v1->uMouseClickY = result;
|
|
173 if ( pRenderer->bWindowMode )
|
|
174 goto LABEL_16;
|
|
175 if (pAsyncMouse)
|
|
176 goto LABEL_24;
|
|
177 if ( v2 < 0 )
|
|
178 v2 = 0;
|
|
179 if ( result < 0 )
|
|
180 result = 0;
|
|
181 if ( v2 > 639 )
|
|
182 v2 = 639;
|
|
183 if ( result > 479 )
|
|
184 {
|
|
185 result = 479;
|
|
186 LABEL_16:
|
|
187 if (pAsyncMouse)
|
|
188 goto LABEL_24;
|
|
189 if ( pRenderer->bWindowMode && (v2 < 0 || result < 0 || v2 > 639 || result > 479) )
|
|
190 goto LABEL_23;
|
|
191 }
|
|
192 if ( v1->field_C )
|
|
193 LABEL_23:
|
|
194 v1->bActive = 0;
|
|
195 LABEL_24:
|
|
196 v1->field_8 = 0;
|
|
197 return result;
|
|
198 }
|
|
199
|
|
200 //----- (00469BA3) --------------------------------------------------------
|
|
201 void Mouse::ClearCursor()
|
|
202 {
|
|
203 Mouse *v1; // esi@1
|
|
204 void *v2; // eax@1
|
|
205 void **v3; // esi@5
|
|
206
|
|
207 v1 = this;
|
|
208 v2 = this->pCursorBitmap_sysmem;
|
|
209 this->bActive = 0;
|
|
210 if ( v2 )
|
|
211 {
|
|
212 free(v2);
|
|
213 v1->pCursorBitmap_sysmem = 0;
|
|
214 }
|
|
215 if ( v1->pCursorBitmap2_sysmem )
|
|
216 {
|
|
217 free(v1->pCursorBitmap2_sysmem);
|
|
218 v1->pCursorBitmap2_sysmem = 0;
|
|
219 }
|
|
220 v3 = &v1->ptr_90;
|
|
221 if ( *v3 )
|
|
222 free(*v3);
|
|
223 *v3 = 0;
|
|
224 }
|
|
225
|
|
226 //----- (00469BE6) --------------------------------------------------------
|
|
227 void Mouse::AllocCursorSystemMem()
|
|
228 {
|
|
229 bActive = 0;
|
|
230 if (!pCursorBitmap_sysmem)
|
|
231 pCursorBitmap_sysmem = (unsigned __int16 *)DoAllocCursorMem();
|
|
232 if (!pCursorBitmap2_sysmem)
|
|
233 pCursorBitmap2_sysmem = (unsigned __int8 *)DoAllocCursorMem();
|
|
234 }
|
|
235
|
|
236 //----- (00469C0D) --------------------------------------------------------
|
|
237 void *Mouse::DoAllocCursorMem()
|
|
238 {
|
|
239 return malloc(4 * (this->uCursorTextureID != -1 ? pIcons_LOD->pTextures[this->uCursorTextureID].uTextureWidth : 24)
|
|
240 * (this->uCursorTextureID != -1 ? pIcons_LOD->pTextures[this->uCursorTextureID].uTextureHeight : 26));
|
|
241 }
|
|
242
|
|
243 //----- (00469C39) --------------------------------------------------------
|
|
244 POINT *Mouse::GetCursorPos(POINT *a2)
|
|
245 {
|
|
246 void *v2; // edx@1
|
|
247 POINT *result; // eax@1
|
|
248 unsigned int v4; // ecx@2
|
|
249 unsigned int v5; // edx@3
|
|
250
|
|
251 v2 = pAsyncMouse;
|
|
252 result = a2;
|
|
253 if (pAsyncMouse)
|
|
254 {
|
|
255 a2->x = *((int *)pAsyncMouse + 6);
|
|
256 v4 = *((int *)v2 + 7);
|
|
257 }
|
|
258 else
|
|
259 {
|
|
260 v5 = this->uMouseClickX;
|
|
261 v4 = this->uMouseClickY;
|
|
262 a2->x = v5;
|
|
263 }
|
|
264 a2->y = v4;
|
|
265 return result;
|
|
266 }
|
|
267
|
|
268 //----- (00469C65) --------------------------------------------------------
|
|
269 void Mouse::Initialize(HWND hWnd)
|
|
270 {
|
|
271 this->hWnd = hWnd;
|
|
272 this->bActive = 0;
|
|
273 this->bInitialized = 1;
|
|
274 this->pCursorBitmapPos.x = 0;
|
|
275 this->pCursorBitmapPos.y = 0;
|
|
276 this->uMouseClickX = 0;
|
|
277 this->uMouseClickY = 0;
|
|
278 this->pCursorBitmap_sysmem = 0;
|
|
279 this->field_34 = 0;
|
|
280 this->pCursorBitmap2_sysmem = 0;
|
|
281
|
|
282 SetCursorBitmap("MICON3");
|
|
283 SetCursorBitmap("MICON2");
|
|
284 SetCursorBitmap("MICON1");
|
|
285 }
|
|
286
|
762
|
287 // inlined
|
|
288 //----- (0045FE00) mm6 chinese --------------------------------------------
|
|
289 void Mouse::SetActive(bool active)
|
|
290 {
|
|
291 bActive = active;
|
|
292 }
|
|
293
|
0
|
294 //----- (00469CC2) --------------------------------------------------------
|
|
295 void Mouse::Deactivate()
|
|
296 {
|
|
297 if (bInitialized)
|
762
|
298 SetActive(false);
|
0
|
299 }
|
|
300
|
|
301 //----- (00469CCD) --------------------------------------------------------
|
|
302 void Mouse::DrawCursor()
|
|
303 {
|
|
304 Mouse *v1; // esi@1
|
|
305 char v11; // zf@6
|
|
306 signed int v3; // eax@6
|
|
307 signed int v4; // ecx@6
|
|
308 Vec4_int_ *v5; // edx@21
|
|
309 int v6; // edi@21
|
|
310 int v7; // ebx@21
|
|
311 int v8; // eax@29
|
|
312 unsigned int v9; // eax@31
|
|
313
|
|
314 v1 = this;
|
|
315 if ( this->bInitialized )
|
|
316 {
|
|
317 if ( !this->field_8 && this->bActive && !this->field_C )
|
|
318 pMouse->_469AE4();
|
|
319 v11 = v1->field_C == 0;
|
|
320 v3 = v1->uMouseClickX;
|
|
321 v4 = v1->uMouseClickY;
|
|
322 v1->field_F4 = 1;
|
|
323 if ( !v11 )
|
|
324 goto LABEL_12;
|
|
325 if ( pRenderer->bWindowMode )
|
|
326 {
|
|
327 if ( v3 < 0 || v4 < 0 || v3 > 639 || v4 > 479 )
|
|
328 {
|
|
329 LABEL_12:
|
|
330 v1->field_F4 = 0;
|
|
331 return;
|
|
332 }
|
|
333 }
|
|
334 else
|
|
335 {
|
|
336 if ( v3 < 0 )
|
|
337 v3 = 0;
|
|
338 if ( v4 < 0 )
|
|
339 v4 = 0;
|
|
340 if ( v3 > 639 )
|
|
341 v3 = 639;
|
|
342 if ( v4 > 479 )
|
|
343 v4 = 479;
|
|
344 }
|
|
345 v5 = &v1->pCursorBitmapRect;
|
|
346 v6 = v3 + v1->uCursorBitmapPitch;
|
|
347 v7 = v4 + v1->field_5C[0];
|
|
348 v1->pCursorBitmapRect.y = v4;
|
|
349 v1->pCursorBitmapRect.x = v3;
|
|
350 v1->pCursorBitmapRect.z = v6;
|
|
351 v1->pCursorBitmapRect.w = v7;
|
|
352 if ( v3 < 0 )
|
|
353 v5->x = 0;
|
|
354 if ( v4 < 0 )
|
|
355 v1->pCursorBitmapRect.y = 0;
|
|
356 if ( v6 > 640 )
|
|
357 v1->pCursorBitmapRect.z = 640;
|
|
358 if ( v7 > 480 )
|
|
359 v1->pCursorBitmapRect.w = 480;
|
|
360 v8 = v1->pCursorBitmapRect.z;
|
|
361 v1->bActive = 0;
|
|
362 v1->uCursorBitmapWidth = v8 - v5->x;
|
|
363 v11 = v1->field_14 == 0;
|
|
364 v1->uCursorBitmapHeight = v1->pCursorBitmapRect.w - v1->pCursorBitmapRect.y;
|
|
365 if ( !v11 )
|
|
366 {
|
|
367 if ( pMouse->ptr_90 )
|
|
368 v9 = 2 * pMouse->uCursorBitmapPitch;
|
|
369 else
|
|
370 v9 = 0;
|
|
371 pRenderer->_4A6DF5(
|
|
372 v1->pCursorBitmap_sysmem,
|
|
373 v9,
|
|
374 &v1->pCursorBitmapPos,
|
|
375 pRenderer->pTargetSurface,
|
|
376 pRenderer->uTargetSurfacePitch,
|
|
377 &v1->pCursorBitmapRect);
|
|
378 v1->field_14 = 0;
|
|
379 }
|
|
380 }
|
|
381 }
|
|
382
|
|
383 //----- (00469E1C) --------------------------------------------------------
|
|
384 void Mouse::_469E1C()
|
|
385 {
|
|
386 bActive = true;
|
|
387 }
|
|
388
|
|
389 //----- (00469E24) --------------------------------------------------------
|
|
390 void Mouse::_469E24()
|
|
391 {
|
|
392 if (pCursorBitmap3_sysmembits_16bit)
|
|
393 {
|
|
394 free(pCursorBitmap3_sysmembits_16bit);
|
|
395 pCursorBitmap3_sysmembits_16bit = 0;
|
|
396 }
|
|
397 }
|
|
398
|
|
399 //----- (00469E3B) --------------------------------------------------------
|
|
400 void Mouse::DrawCursorToTarget()
|
|
401 {
|
|
402 if (!pCursorBitmap3_sysmembits_16bit)
|
|
403 return;
|
|
404
|
|
405 auto pSrc = pCursorBitmap3_sysmembits_16bit;
|
|
406 for (uint y = field_44; y < field_4C; ++y)
|
|
407 for (uint x = field_40; x < field_48; ++x)
|
|
408 pRenderer->pTargetSurface[y * pRenderer->uTargetSurfacePitch + x] = *pSrc++;
|
|
409 }
|
|
410
|
|
411 //----- (00469EA4) --------------------------------------------------------
|
|
412 void Mouse::_469EA4()
|
|
413 {
|
|
414 Mouse *v1; // esi@1
|
|
415 unsigned int v2; // eax@2
|
|
416 Texture *v3; // edi@2
|
|
417 unsigned int v4; // ecx@3
|
|
418 unsigned int v5; // eax@3
|
|
419 unsigned int v6; // ebx@5
|
|
420 int v7; // ecx@15
|
|
421 int v8; // ecx@25
|
|
422 int v9; // ebx@26
|
|
423 unsigned int v10; // eax@26
|
|
424 int v11; // edx@27
|
|
425 unsigned __int16 *v12; // edx@29
|
|
426 unsigned __int16 *v13; // ebx@29
|
|
427 unsigned int a2; // [sp+Ch] [bp-1Ch]@5
|
|
428 unsigned int v15; // [sp+10h] [bp-18h]@5
|
|
429 unsigned int v16; // [sp+14h] [bp-14h]@25
|
|
430 unsigned __int16 *v17; // [sp+18h] [bp-10h]@25
|
|
431 int v18; // [sp+1Ch] [bp-Ch]@27
|
|
432 int v19; // [sp+20h] [bp-8h]@15
|
|
433 unsigned __int16 *v20; // [sp+20h] [bp-8h]@28
|
|
434 int v21; // [sp+24h] [bp-4h]@12
|
|
435 unsigned __int16 *v22; // [sp+24h] [bp-4h]@25
|
|
436
|
|
437 v1 = this;
|
|
438 if ( pParty->pPickedItem.uItemID )
|
|
439 {
|
|
440 v2 = pIcons_LOD->LoadTexture(
|
|
441 pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName,
|
|
442 TEXTURE_16BIT_PALETTE);
|
|
443 v3 = (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0);
|
|
444 if (pAsyncMouse)
|
|
445 {
|
|
446 v4 = *((int *)pAsyncMouse + 6);
|
|
447 v5 = *((int *)pAsyncMouse + 7);
|
|
448 }
|
|
449 else
|
|
450 {
|
|
451 v4 = pMouse->uMouseClickX;
|
|
452 v5 = pMouse->uMouseClickY;
|
|
453 }
|
|
454 v6 = v5;
|
|
455 a2 = v4;
|
|
456 v15 = v5;
|
|
457 if ( (signed int)v4 <= 639 && (signed int)v5 <= 479 )
|
|
458 {
|
|
459 if ( (v4 & 0x80000000u) != 0 )
|
|
460 a2 = 0;
|
|
461 if ( (v5 & 0x80000000u) != 0 )
|
|
462 {
|
|
463 v6 = 0;
|
|
464 v15 = 0;
|
|
465 }
|
|
466 if ( (signed int)(v3->uTextureWidth + a2) <= 640 )
|
|
467 v21 = v3->uTextureWidth;
|
|
468 else
|
|
469 v21 = 640 - a2;
|
|
470 if ( (signed int)(v3->uTextureHeight + v6) <= 480 )
|
|
471 {
|
|
472 v19 = v3->uTextureHeight;
|
|
473 v7 = v3->uTextureHeight;
|
|
474 }
|
|
475 else
|
|
476 {
|
|
477 v7 = 480 - v6;
|
|
478 v19 = 480 - v6;
|
|
479 }
|
|
480 if ( !v1->pCursorBitmap3_sysmembits_16bit
|
|
481 || a2 != v1->field_40
|
|
482 || v6 != v1->field_44
|
|
483 || a2 + v21 != v1->field_48
|
|
484 || v6 + v7 != v1->field_4C )
|
|
485 {
|
|
486 if ( v1->pCursorBitmap3_sysmembits_16bit )
|
|
487 free(v1->pCursorBitmap3_sysmembits_16bit);
|
|
488 v1->pCursorBitmap3_sysmembits_16bit = (unsigned __int16 *)operator new(2 * v3->uTextureHeight
|
|
489 * v3->uTextureWidth);
|
|
490 v1->field_40 = a2;
|
|
491 v1->field_48 = a2 + v21;
|
|
492 v1->field_44 = v6;
|
|
493 v1->field_4C = v6 + v19;
|
|
494 }
|
|
495 v8 = v1->field_44;
|
|
496 v22 = v1->pCursorBitmap3_sysmembits_16bit;
|
|
497 v17 = pRenderer->pTargetSurface;
|
|
498 v16 = pRenderer->uTargetSurfacePitch;
|
|
499 if ( v8 < v1->field_4C )
|
|
500 {
|
|
501 v9 = v1->field_48;
|
|
502 v10 = pRenderer->uTargetSurfacePitch * v8;
|
|
503 do
|
|
504 {
|
|
505 v11 = v1->field_40;
|
|
506 v18 = v1->field_40;
|
|
507 if ( v11 < v9 )
|
|
508 {
|
|
509 v20 = &v17[v10 + v11];
|
|
510 do
|
|
511 {
|
|
512 v12 = v20;
|
|
513 v13 = v22;
|
|
514 ++v18;
|
|
515 ++v20;
|
|
516 ++v22;
|
|
517 *v13 = *v12;
|
|
518 v9 = v1->field_48;
|
|
519 }
|
|
520 while ( v18 < v9 );
|
|
521 }
|
|
522 v10 += v16;
|
|
523 ++v8;
|
|
524 }
|
|
525 while ( v8 < v1->field_4C );
|
|
526 v6 = v15;
|
|
527 }
|
315
|
528 if (pParty->pPickedItem.Broken())
|
|
529 pRenderer->DrawTransparentRedShade(a2, v6, v3);
|
|
530 else if (!pParty->pPickedItem.Identified())
|
|
531 pRenderer->DrawTransparentGreenShade(a2, v6, v3);
|
0
|
532 else
|
315
|
533 pRenderer->DrawTextureTransparent(a2, v6, v3);
|
0
|
534 }
|
|
535 }
|
|
536 else
|
|
537 {
|
|
538 if ( this->pCursorBitmap3_sysmembits_16bit )
|
|
539 {
|
|
540 free(this->pCursorBitmap3_sysmembits_16bit);
|
|
541 v1->pCursorBitmap3_sysmembits_16bit = 0;
|
|
542 }
|
|
543 }
|
|
544 }
|
|
545
|
|
546 //----- (0046A080) --------------------------------------------------------
|
|
547 void Mouse::Activate(int bActive)
|
|
548 {
|
|
549 bActive = bActive;
|
|
550 }
|
|
551
|
|
552 //----- (0046A08A) --------------------------------------------------------
|
|
553 void Mouse::SetMouseClick(int x, int y)
|
|
554 {
|
|
555 uMouseClickX = x;
|
|
556 uMouseClickY = y;
|
|
557 }
|
|
558
|
|
559
|
|
560 //----- (00409E3D) --------------------------------------------------------
|
|
561 void AsyncMouse::_409E3D(char a2)
|
|
562 {
|
|
563 if ( *((unsigned char *)this + 128) & 1 )
|
|
564 *((unsigned char *)this + 103) = 1;
|
|
565 else
|
|
566 *((unsigned char *)this + 103) = 0;
|
|
567 if ( a2 )
|
|
568 *((unsigned int *)this + 32) |= 1u;
|
|
569 else
|
|
570 *((unsigned int *)this + 32) &= 0xFFFFFFFEu;
|
|
571 }
|
|
572
|
|
573 //----- (00465C2C) --------------------------------------------------------
|
|
574 void AsyncMouse::Release()
|
|
575 {
|
|
576 if (pAsyncMouse)
|
|
577 {
|
|
578 pAsyncMouse->Suspend();
|
|
579 if (pAsyncMouse)
|
|
580 (**(void (__stdcall ***)(int))pAsyncMouse)(1);
|
|
581 }
|
|
582 pAsyncMouse = 0;
|
|
583 }
|
|
584
|
|
585
|
|
586
|
|
587
|
|
588 //----- (0046ACA9) --------------------------------------------------------
|
|
589 AsyncMouse::AsyncMouse(IDirectDrawSurface *a2)
|
|
590 {
|
|
591 IDirectDrawSurface *v2; // eax@1
|
|
592 void *v3; // esi@1
|
|
593 char *v4; // edi@1
|
|
594 double v5; // ST14_8@3
|
|
595 double v6; // ST14_8@3
|
|
596
|
|
597 v2 = a2;
|
|
598 v3 = this;
|
|
599 *((int *)this + 16) = -1;
|
|
600 *((int *)this + 3) = (int)v2;
|
|
601 LOBYTE(v2) = BYTE3(a2);
|
|
602 v4 = (char *)this + 104;
|
|
603 *((int *)this + 1) = 0;
|
|
604 *((char *)this + 20) = 0;
|
|
605 *((int *)this + 17) = 0;
|
|
606 *((int *)this + 18) = 0;
|
|
607 *((char *)this + 88) = 1;
|
|
608 *((char *)this + 91) = 0;
|
|
609 *((char *)this + 93) = 0;
|
|
610 *((char *)this + 94) = 0;
|
|
611 *((char *)this + 95) = 0;
|
|
612 *((char *)this + 96) = 0;
|
|
613 *((char *)this + 97) = 0;
|
|
614 *((char *)this + 98) = 0;
|
|
615 *((char *)this + 99) = 0;
|
|
616 *((char *)this + 100) = 0;
|
|
617 *((char *)this + 101) = 0;
|
|
618 *((char *)this + 102) = 0;
|
|
619 *((char *)this + 104) = (char)v2;
|
|
620 *((int *)this + 27) = (int)AsyncMouse::unk_46BD09(0, 0);
|
|
621 *((int *)v4 + 2) = 0;
|
|
622 *((char *)v3 + 116) = BYTE3(a2);
|
|
623 *((int *)v3 + 30) = (int)AsyncMouse::unk_46BD09(0, 0);
|
|
624 *((int *)v3 + 31) = 0;
|
|
625 *((int *)v3 + 32) = 0;
|
|
626 *((int *)v3 + 33) = 0;
|
|
627 *(int *)v3 = 5080880;
|
|
628 if ( !Initialize(this) )
|
|
629 {
|
|
630 MessageBoxW(nullptr, L"Could not initialize CMouseAsync object", nullptr, 0);
|
|
631 }
|
|
632 *((int *)v3 + 12) = 0;
|
|
633 *((int *)v3 + 13) = 0;
|
|
634 *((int *)v3 + 14) = 0;
|
|
635 *((int *)v3 + 15) = 0;
|
|
636 v5 = (float)0.0 + 6.7553994e15;
|
|
637 *((int *)v3 + 10) = LODWORD(v5);
|
|
638 v6 = (float)0.0 + 6.7553994e15;
|
|
639 a2 = (IDirectDrawSurface *)LODWORD(v6);
|
|
640 *((int *)v3 + 32) |= 1u;
|
|
641 *((int *)v3 + 11) = LODWORD(v6);
|
|
642 *((char *)v3 + 103) = 1;
|
|
643 }
|
|
644 // 4DBD94: using guessed type int dword_4DBD94;
|
|
645
|
|
646
|
|
647
|
|
648 //----- (0046ADE2) --------------------------------------------------------
|
|
649 AsyncMouse::~AsyncMouse()
|
|
650 {
|
|
651 void *v1; // esi@1
|
|
652 char *v2; // edi@1
|
|
653 int v3; // ecx@1
|
|
654
|
|
655 v1 = this;
|
|
656 //*(int *)this = AsyncMouse_pvdtor;
|
|
657 v2 = (char *)this + 132;
|
|
658 v3 = *((int *)this + 33);
|
|
659 if ( v3 )
|
|
660 (**(void (__stdcall ***)(int))v3)(1);
|
|
661 *(int *)v2 = 0;
|
|
662 TerminateThread(*((HANDLE *)v1 + 4), 0xFAu);
|
|
663 SetWindowPos(hWnd, (HWND)0xFFFFFFFE, uWindowX, uWindowY, 640, 480, 0);
|
|
664 //AsyncMouse::dtor_sub_46BC73((int)((char *)v1 + 116));
|
|
665 //AsyncMouse::dtor_sub_46BC73((int)((char *)v1 + 104));
|
|
666 }
|
|
667 // 4D8730: using guessed type int (__stdcall *AsyncMouse_pvdtor[2])(char);
|
|
668
|
|
669
|
|
670
|
|
671
|
|
672
|
|
673
|
|
674
|
|
675
|
|
676
|
|
677
|
|
678
|
|
679
|
|
680
|
|
681 //----- (0046AE6E) --------------------------------------------------------
|
|
682 char AsyncMouse::Initialize(LPVOID lpParameter)
|
|
683 {
|
|
684 void *v1; // esi@1
|
|
685 char result; // al@2
|
|
686
|
|
687 v1 = lpParameter;
|
|
688 if ( LoadCursorImage() && _46B072() )
|
|
689 result = CreateDisrectInputMouse() != 0;
|
|
690 else
|
|
691 result = 0;
|
|
692 return result;
|
|
693 }
|
|
694
|
|
695 //----- (0046AE97) --------------------------------------------------------
|
|
696 char AsyncMouse::LoadCursor(const char *pContainer)
|
|
697 {
|
|
698 __debugbreak();
|
|
699 return 0;
|
|
700 /*
|
|
701 void *v2; // esi@1
|
|
702 int v3; // eax@1
|
|
703 HRESULT v4; // eax@1
|
|
704 char result; // al@3
|
|
705 HRESULT a2; // [sp+8h] [bp-B0h]@1
|
|
706 int v7; // [sp+58h] [bp-60h]@1
|
|
707 char v9; // [sp+B4h] [bp-4h]@1
|
|
708
|
|
709 v2 = this;
|
|
710 EnterCriticalSection(&pGame->pThreadWardInstance->cs2);
|
|
711 v3 = *((int *)v2 + 1);
|
|
712 a2 = 100;
|
|
713 v7 = 0;
|
|
714 v4 = (*(int (__stdcall **)(int, int, int, int, signed int, HRESULT *))(*(int *)v3 + 20))(
|
|
715 v3,
|
|
716 0,
|
|
717 0,
|
|
718 0,
|
|
719 1024,
|
|
720 &a2);
|
|
721 ErrHR(v4, "DirectInput", __FUNCTION__, __FILE__, __LINE__);
|
|
722
|
|
723 Texture thisa; // [sp+6Ch] [bp-4Ch]@1
|
|
724 //Texture::Texture(&thisa);
|
|
725
|
|
726 if ( pIcons_LOD->LoadTextureFromLOD(&thisa, pContainer, TEXTURE_16BIT_PALETTE) != -1
|
|
727 && DrawCursor(&thisa, *((IDirectDrawSurface4 **)v2 + 1), 0) )
|
|
728 {
|
|
729 thisa.Release();
|
|
730 LeaveCriticalSection(&pGame->pThreadWardInstance->cs2);
|
|
731 result = 1;
|
|
732 }
|
|
733 else
|
|
734 {
|
|
735 result = 0;
|
|
736 }
|
|
737 return result;*/
|
|
738 }
|
|
739
|
|
740 //----- (0046AF50) --------------------------------------------------------
|
|
741 char AsyncMouse::LoadCursorImage()
|
|
742 {
|
|
743 void *v1; // ebx@1
|
|
744 int v2; // eax@2
|
|
745 int v3; // esi@4
|
|
746 char result; // al@5
|
|
747 //const char *v5; // eax@6
|
|
748 //std::string v6; // [sp-18h] [bp-12Ch]@9
|
|
749 const char *v7; // [sp-8h] [bp-11Ch]@9
|
|
750 int v8; // [sp-4h] [bp-118h]@9
|
|
751 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-108h]@1
|
|
752 int v10; // [sp+88h] [bp-8Ch]@2
|
|
753 int v11; // [sp+8Ch] [bp-88h]@2
|
|
754 int v12; // [sp+90h] [bp-84h]@2
|
|
755 int v13; // [sp+94h] [bp-80h]@2
|
|
756 char v14; // [sp+D0h] [bp-44h]@2
|
|
757 int v15; // [sp+F0h] [bp-24h]@2
|
|
758 int v16; // [sp+104h] [bp-10h]@4
|
|
759 int v17; // [sp+108h] [bp-Ch]@4
|
|
760 std::string *v18; // [sp+10Ch] [bp-8h]@9
|
|
761 int a3; // [sp+113h] [bp-1h]@9
|
|
762
|
|
763 v1 = this;
|
|
764 memset(&Dst, 0, 0x7Cu);
|
|
765 Dst.dwSize = 124;
|
|
766 if ( pRenderer->pDirectDraw4->GetDisplayMode(&Dst)
|
|
767 || (memset(&v10, 0, 0x7Cu),
|
|
768 v10 = 124,
|
|
769 v11 = 4103,
|
|
770 v15 = 2112,
|
|
771 v12 = 32,
|
|
772 v13 = 32,
|
|
773 v2 = *((int *)v1 + 3),
|
|
774 memcpy(&v14, &Dst.ddpfPixelFormat, 0x20u),
|
|
775 (*(int (__stdcall **)(int, int *, char *, int))(**(int **)v2 + 24))(
|
|
776 *(int *)v2,
|
|
777 &v10,
|
|
778 (char *)v1 + 4,
|
|
779 0))
|
|
780 || (*(int (__stdcall **)(int, int *, char *, int))(***((int ***)v1 + 3) + 24))(
|
|
781 **((int **)v1 + 3),
|
|
782 &v10,
|
|
783 (char *)v1 + 8,
|
|
784 0)
|
|
785 || (v3 = *((int *)v1 + 1),
|
|
786 v16 = 0,
|
|
787 v17 = 0,
|
|
788 (*(int (__stdcall **)(int, signed int, int *))(*(int *)v3 + 116))(v3, 8, &v16)) )
|
|
789 {
|
|
790 result = 0;
|
|
791 return false;
|
|
792 }
|
|
793 else
|
|
794 {
|
|
795 if ( !LoadCursor("micon1") )
|
|
796 {
|
|
797 MessageBoxW(nullptr, L"Could not load async mouse cursor image", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\MouseAsync.cpp:182", 0);
|
|
798 }
|
|
799 result = 1;
|
|
800 return true;
|
|
801 }
|
|
802 return result;
|
|
803 }
|
|
804 // 4D86F0: using guessed type int dword_4D86F0;
|
|
805
|
|
806 //----- (0046B072) --------------------------------------------------------
|
|
807 char AsyncMouse::_46B072()
|
|
808 {
|
|
809 DWORD v1; // esi@1
|
|
810 HANDLE v2; // eax@1
|
|
811 char result; // al@2
|
|
812 DWORD ThreadId; // [sp+0h] [bp-4h]@1
|
|
813
|
|
814 ThreadId = (DWORD)this;
|
|
815 v1 = (DWORD)this;
|
|
816 v2 = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)AsyncMouseThread, this, 4u, &ThreadId);
|
|
817 *(int *)(v1 + 16) = (int)v2;
|
|
818 if ( v2 )
|
|
819 result = SetThreadPriority(v2, 15) != 0;
|
|
820 else
|
|
821 result = 0;
|
|
822 return result;
|
|
823 }
|
|
824
|
|
825 //----- (0046B0A9) --------------------------------------------------------
|
|
826 char AsyncMouse::CreateDisrectInputMouse()
|
|
827 {
|
|
828 __debugbreak();
|
|
829 /*
|
|
830 void *v1; // esi@1
|
|
831 DirectInputMouse *v2; // ecx@1
|
|
832 DirectInputMouse *v3; // eax@2
|
|
833
|
|
834 v1 = this;
|
|
835 v2 = (DirectInputMouse *)operator new(0x2Cu);
|
|
836 if ( v2 )
|
|
837 v3 = DirectInputMouse::DirectInputMouse(v2);
|
|
838 else
|
|
839 v3 = 0;
|
|
840 *((int *)v1 + 33) = v3;
|
|
841 return v3 != 0;*/
|
|
842 return 0;
|
|
843 }
|
|
844
|
|
845 //----- (0046B0ED) --------------------------------------------------------
|
|
846 int AsyncMouse::_46B0ED()
|
|
847 {
|
|
848 __debugbreak();
|
|
849 /*
|
|
850 int v1; // esi@1
|
|
851 int v2; // ecx@1
|
|
852 int result; // eax@2
|
|
853
|
|
854 v1 = this + 132;
|
|
855 v2 = *(int *)(this + 132);
|
|
856 if ( v2 )
|
|
857 result = (**(int (__stdcall ***)(int))v2)(1);
|
|
858 *(int *)v1 = 0;
|
|
859 return result;*/
|
|
860 return 0;
|
|
861 }
|
|
862 // 46B0ED: using guessed type int __thiscall AsyncMouse__46B0ED(int);
|
|
863
|
|
864 //----- (0046B105) --------------------------------------------------------
|
|
865 void AsyncMouse::Resume()
|
|
866 {
|
|
867 __debugbreak();
|
|
868 /*
|
|
869 void *v1; // esi@1
|
|
870
|
|
871 v1 = this;
|
|
872 EnterCriticalSection(&pGame->pThreadWardInstance->cs3);
|
|
873 AsyncMouse::CreateDisrectInputMouse(v1);
|
|
874 AsyncMouse::Clip();
|
|
875 ResumeThread(*((HANDLE *)v1 + 4));
|
|
876 *((char *)v1 + 88) = 0;
|
|
877 LeaveCriticalSection(&pGame->pThreadWardInstance->cs3);*/
|
|
878 }
|
|
879
|
|
880 //----- (0046B14F) --------------------------------------------------------
|
|
881 void AsyncMouse::Suspend()
|
|
882 {
|
|
883 void *v1; // esi@1
|
194
|
884 //Vis *v2; // eax@3
|
0
|
885 std::string v3; // [sp-18h] [bp-24h]@2
|
|
886 const char *v4; // [sp-8h] [bp-14h]@2
|
|
887 int v5; // [sp-4h] [bp-10h]@2
|
|
888 std::string *v6; // [sp+4h] [bp-8h]@2
|
|
889 int a3; // [sp+Bh] [bp-1h]@2
|
|
890
|
|
891 v1 = this;
|
|
892 if ( *((int *)this + 33) )
|
|
893 {
|
194
|
894 //v2 = pGame->pVisInstance;
|
|
895 if (pGame->pVisInstance)
|
|
896 pGame->pVisInstance->default_list.uNumPointers = 0;
|
|
897
|
0
|
898 EnterCriticalSection(&pGame->pThreadWardInstance->cs3);
|
|
899 SuspendThread(*((HANDLE *)v1 + 4));
|
|
900 _46B0ED();
|
|
901 LeaveCriticalSection(&pGame->pThreadWardInstance->cs3);
|
|
902 }
|
|
903 else
|
|
904 {
|
|
905 MessageBoxW(nullptr, L"DI_Mouse pointer invalid; bailing out from suspend()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\MouseAsync.cpp:233", 0);
|
|
906 }
|
|
907 }
|
|
908 // 46B0ED: using guessed type int __thiscall AsyncMouse__46B0ED(int);
|
|
909
|
|
910 //----- (0046B1DD) --------------------------------------------------------
|
|
911 char AsyncMouse::_46B1DD()
|
|
912 {
|
|
913 *((char *)this + 20) = 1;
|
|
914 Sleep(118);
|
|
915 return 1;
|
|
916 }
|
|
917
|
|
918 //----- (0046B1EC) --------------------------------------------------------
|
|
919 bool AsyncMouse::DrawCursor(Texture *a1, IDirectDrawSurface4 *a2, int a3)
|
|
920 {
|
|
921 __debugbreak();
|
|
922 /*
|
|
923 bool result; // eax@1
|
|
924 unsigned __int16 *v5; // ebx@2
|
|
925 unsigned __int8 *v6; // edx@2
|
|
926 int v7; // esi@2
|
|
927 int v8; // ecx@2
|
|
928 LPVOID v9; // edi@2
|
|
929 int v10; // ecx@5
|
|
930 DDSURFACEDESC2 Dst; // [sp+0h] [bp-84h]@1
|
|
931 __int32 v12; // [sp+7Ch] [bp-8h]@3
|
|
932 int v13; // [sp+80h] [bp-4h]@3
|
|
933
|
|
934 Dst.dwSize = 124;
|
168
|
935 result = pRenderer->LockSurface_DDraw4(a2, &Dst, DDLOCK_WAIT);
|
0
|
936 if ( result )
|
|
937 {
|
|
938 v5 = a1->pPalette16;
|
710
|
939 v6 = a1->pLevelOfDetail0_prolly_alpha_mask;
|
0
|
940 v7 = a1->uTextureWidth;
|
|
941 v8 = a1->uTextureHeight;
|
|
942 v9 = Dst.lpSurface;
|
|
943 if ( v8 > 0 )
|
|
944 {
|
|
945 v12 = 2 * (Dst.lPitch / 2 - v7);
|
|
946 v13 = v8;
|
|
947 do
|
|
948 {
|
|
949 if ( v7 > 0 )
|
|
950 {
|
|
951 v10 = v7;
|
|
952 do
|
|
953 {
|
|
954 if ( v5[*v6] )
|
|
955 *(short *)v9 = v5[*v6];
|
|
956 v9 = (char *)v9 + 2;
|
|
957 ++v6;
|
|
958 --v10;
|
|
959 }
|
|
960 while ( v10 );
|
|
961 }
|
|
962 v9 = (char *)v9 + v12;
|
|
963 --v13;
|
|
964 }
|
|
965 while ( v13 );
|
|
966 }
|
|
967 result = a2->Unlock(
|
|
968 v6,
|
|
969 a2,
|
|
970 a3);
|
|
971 }
|
|
972 LOBYTE(result) = 1;
|
|
973 return result;*/
|
|
974 return 0;
|
|
975 }
|
|
976
|
|
977 //----- (0046B289) --------------------------------------------------------
|
|
978 bool AsyncMouse::_46B289(int a2, char a3)
|
|
979 {
|
|
980 char v3; // dl@1
|
|
981 bool result; // eax@33
|
|
982 char v5; // [sp+2h] [bp-2h]@1
|
|
983 char v6; // [sp+3h] [bp-1h]@1
|
|
984
|
|
985 v3 = *((char *)this + 93);
|
|
986 v6 = *((char *)this + 94);
|
|
987 v5 = *((char *)this + 95);
|
|
988 if ( a3 & 1 )
|
|
989 {
|
|
990 *((char *)this + 93) = 1;
|
|
991 }
|
|
992 else
|
|
993 {
|
|
994 if ( v3 )
|
|
995 *((char *)this + 99) = 1;
|
|
996 else
|
|
997 *((char *)this + 99) = 0;
|
|
998 *((char *)this + 93) = 0;
|
|
999 }
|
|
1000 if ( a3 & 2 )
|
|
1001 {
|
|
1002 *((char *)this + 94) = 1;
|
|
1003 }
|
|
1004 else
|
|
1005 {
|
|
1006 if ( v6 )
|
|
1007 *((char *)this + 100) = 1;
|
|
1008 else
|
|
1009 *((char *)this + 100) = 0;
|
|
1010 *((char *)this + 94) = 0;
|
|
1011 }
|
|
1012 if ( a3 & 4 )
|
|
1013 {
|
|
1014 *((char *)this + 95) = 1;
|
|
1015 }
|
|
1016 else
|
|
1017 {
|
|
1018 if ( v5 )
|
|
1019 *((char *)this + 101) = 1;
|
|
1020 else
|
|
1021 *((char *)this + 101) = 0;
|
|
1022 *((char *)this + 95) = 0;
|
|
1023 }
|
|
1024 *((char *)this + 96) = v3 != *((char *)this + 93);
|
|
1025 *((char *)this + 97) = v6 != *((char *)this + 94);
|
|
1026 *((char *)this + 98) = v5 != *((char *)this + 95);
|
|
1027 if ( *((char *)this + 99) && *((char *)this + 96) || *((char *)this + 100) && *((char *)this + 97) )
|
|
1028 *((char *)this + 102) = 1;
|
|
1029 LOBYTE(result) = 1;
|
|
1030 return result;
|
|
1031 }
|
|
1032
|
|
1033 //----- (0046B342) --------------------------------------------------------
|
|
1034 void AsyncMouse::SetHotspot(float hotspotx, float hotspoty)
|
|
1035 {
|
|
1036 double v3; // ST00_8@1
|
|
1037 double v4; // ST00_8@1
|
|
1038
|
|
1039 v3 = hotspotx + 6.7553994e15;
|
|
1040 *(int *)(this + 40) = LODWORD(v3);
|
|
1041 v4 = hotspoty + 6.7553994e15;
|
|
1042 *(int *)(this + 44) = LODWORD(v4);
|
|
1043 }
|
|
1044
|
|
1045 //----- (0046B37C) --------------------------------------------------------
|
|
1046 int AsyncMouse::UpdateData(int a2)
|
|
1047 {
|
|
1048 __debugbreak();
|
|
1049 /*
|
|
1050 void *v2; // edi@1
|
|
1051 int result; // eax@2
|
|
1052 int v4; // eax@3
|
|
1053 int v5; // esi@3
|
|
1054 std::string v6; // [sp-18h] [bp-28h]@2
|
|
1055 const char *v7; // [sp-8h] [bp-18h]@2
|
|
1056 int v8; // [sp-4h] [bp-14h]@2
|
|
1057 std::string *v9; // [sp+8h] [bp-8h]@2
|
|
1058 int a3; // [sp+Fh] [bp-1h]@2
|
|
1059
|
|
1060 v2 = this;
|
|
1061 if ( *((int *)this + 33) )
|
|
1062 {
|
|
1063 EnterCriticalSection(&pGame->pThreadWardInstance->cs3);
|
|
1064 DirectInputMouse::_43BB89(*((DirectInputMouse **)v2 + 33));
|
|
1065 v4 = *((int *)v2 + 33);
|
|
1066 v5 = v4 + 32;
|
|
1067 _46B289(v4 + 32, *(int *)(v4 + 40));
|
|
1068 LeaveCriticalSection(&pGame->pThreadWardInstance->cs3);
|
|
1069 result = a2;
|
|
1070 *(int *)a2 = *(int *)v5;
|
|
1071 *(int *)(a2 + 4) = *(int *)(v5 + 4);
|
|
1072 }
|
|
1073 else
|
|
1074 {
|
|
1075 MessageBoxW(nullptr, L"DI_Mouse pointer invalid bailing out from update_mouse_data()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\MouseAsync.cpp:446", 0);
|
|
1076 result = a2;
|
|
1077 *(int *)a2 = 0;
|
|
1078 *(int *)(a2 + 4) = 0;
|
|
1079 }
|
|
1080 return result;*/
|
|
1081 return 0;
|
|
1082 }
|
|
1083
|
|
1084 //----- (0046B420) --------------------------------------------------------
|
|
1085 char AsyncMouse::Thread()
|
|
1086 {
|
|
1087 void *v1; // esi@1
|
|
1088 char result; // al@2
|
|
1089 int v3; // eax@3
|
|
1090 int v4; // ecx@3
|
|
1091 int v5; // eax@3
|
|
1092 int v6; // ecx@3
|
|
1093 int v7; // [sp+4h] [bp-8h]@3
|
|
1094 int v8; // [sp+8h] [bp-4h]@3
|
|
1095
|
|
1096 v1 = this;
|
|
1097 if ( *((char *)this + 20) )
|
|
1098 {
|
|
1099 result = 0;
|
|
1100 }
|
|
1101 else
|
|
1102 {
|
|
1103 UpdateData((int)&v7);
|
|
1104 _46BA8D(v7, v8);
|
|
1105 _46B958(v7 - *((int *)v1 + 10), v8 - *((int *)v1 + 11));
|
|
1106 _46B492((int)&v7);
|
|
1107 _46B5D5((int)&v7);
|
|
1108 v3 = v7;
|
|
1109 v4 = v8;
|
|
1110 *((int *)v1 + 6) = v7;
|
|
1111 v5 = v3 - *((int *)v1 + 10);
|
|
1112 *((int *)v1 + 7) = v4;
|
|
1113 v6 = v4 - *((int *)v1 + 11);
|
|
1114 *((int *)v1 + 8) = v5;
|
|
1115 result = 1;
|
|
1116 *((int *)v1 + 9) = v6;
|
|
1117 }
|
|
1118 return result;
|
|
1119 }
|
|
1120
|
|
1121 //----- (0046B492) --------------------------------------------------------
|
|
1122 void AsyncMouse::_46B492(int a2)
|
|
1123 {
|
|
1124 __debugbreak();
|
|
1125 /*
|
|
1126 void *v2; // edi@1
|
|
1127 int v3; // esi@3
|
|
1128 int v4; // eax@5
|
|
1129 int v5; // ecx@5
|
|
1130 int v6; // eax@8
|
|
1131 int v7; // ecx@8
|
|
1132 int v8; // eax@11
|
|
1133 int v9; // esi@11
|
|
1134 int v10; // [sp+Ch] [bp-1Ch]@5
|
|
1135 int v11; // [sp+10h] [bp-18h]@5
|
|
1136 int v12; // [sp+14h] [bp-14h]@5
|
|
1137 int v13; // [sp+18h] [bp-10h]@5
|
|
1138 int v14; // [sp+24h] [bp-4h]@5
|
|
1139
|
|
1140 v2 = this;
|
|
1141 EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse);
|
|
1142 if ( *((int *)v2 + 28) > 0x80u )
|
|
1143 _46BCAB((char *)v2 + 104);
|
|
1144 v3 = a2;
|
|
1145 if ( *((char *)v2 + 93) && *((char *)v2 + 96) )
|
|
1146 {
|
|
1147 v4 = *(int *)a2;
|
|
1148 v5 = *(int *)(a2 + 4);
|
|
1149 v13 = 1;
|
|
1150 v10 = 5080884;
|
|
1151 v11 = v4;
|
|
1152 v12 = v5;
|
|
1153 v14 = 0;
|
|
1154 AsyncMouse::unk_46BCD2((char *)v2 + 104, (int)&a2, *((int *)v2 + 27), (int)&v10);
|
|
1155 v14 = -1;
|
|
1156 }
|
|
1157 if ( *((char *)v2 + 94) && *((char *)v2 + 97) )
|
|
1158 {
|
|
1159 v6 = *(int *)v3;
|
|
1160 v7 = *(int *)(v3 + 4);
|
|
1161 v13 = 2;
|
|
1162 v10 = 5080884;
|
|
1163 v11 = v6;
|
|
1164 v12 = v7;
|
|
1165 v14 = 1;
|
|
1166 AsyncMouse::unk_46BCD2((char *)v2 + 104, (int)&a2, *((int *)v2 + 27), (int)&v10);
|
|
1167 v14 = -1;
|
|
1168 }
|
|
1169 if ( *((char *)v2 + 95) && *((char *)v2 + 98) )
|
|
1170 {
|
|
1171 v8 = *(int *)v3;
|
|
1172 v9 = *(int *)(v3 + 4);
|
|
1173 v13 = 4;
|
|
1174 v10 = 5080884;
|
|
1175 v11 = v8;
|
|
1176 v12 = v9;
|
|
1177 v14 = 2;
|
|
1178 AsyncMouse::unk_46BCD2((char *)v2 + 104, (int)&a2, *((int *)v2 + 27), (int)&v10);
|
|
1179 }
|
|
1180 LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse);*/
|
|
1181 }
|
|
1182
|
|
1183 //----- (0046B5D5) --------------------------------------------------------
|
|
1184 void AsyncMouse::_46B5D5(int a2)
|
|
1185 {
|
|
1186 __debugbreak();
|
|
1187 /*
|
|
1188 void *v2; // esi@1
|
|
1189 DWORD v3; // eax@3
|
|
1190 char v4; // zf@3
|
|
1191 int v5; // edi@3
|
|
1192 int v6; // eax@6
|
|
1193 int v7; // ecx@6
|
|
1194 int v8; // eax@11
|
|
1195 int v9; // ecx@11
|
|
1196 int v10; // eax@16
|
|
1197 int v11; // edi@16
|
|
1198 int (__stdcall **v12)(char); // [sp+Ch] [bp-20h]@6
|
|
1199 int v13; // [sp+10h] [bp-1Ch]@6
|
|
1200 int v14; // [sp+14h] [bp-18h]@6
|
|
1201 int v15; // [sp+18h] [bp-14h]@6
|
|
1202 DWORD v16; // [sp+1Ch] [bp-10h]@3
|
|
1203 int v17; // [sp+28h] [bp-4h]@6
|
|
1204
|
|
1205 v2 = this;
|
|
1206 EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse);
|
|
1207 if ( *((int *)v2 + 31) > 0x80u )
|
|
1208 _46BCAB((char *)v2 + 116);
|
|
1209 v3 = timeGetTime();
|
|
1210 v4 = *((char *)v2 + 93) == 0;
|
|
1211 v5 = a2;
|
|
1212 v16 = v3;
|
|
1213 if ( !v4 && *((char *)v2 + 96) )
|
|
1214 {
|
|
1215 if ( v3 - *((int *)v2 + 19) < 0xFA )
|
|
1216 {
|
|
1217 v6 = *(int *)a2;
|
|
1218 v7 = *(int *)(a2 + 4);
|
|
1219 v15 = 1;
|
|
1220 v12 = &AsyncMouse::unk::vdtor_ptr;
|
|
1221 v13 = v6;
|
|
1222 v14 = v7;
|
|
1223 v17 = 0;
|
|
1224 AsyncMouse::unk_46BCD2((char *)v2 + 116, (int)&a2, *((int *)v2 + 30), (int)&v12);
|
|
1225 v17 = -1;
|
|
1226 v3 = v16;
|
|
1227 }
|
|
1228 *((int *)v2 + 19) = v3;
|
|
1229 }
|
|
1230 if ( *((char *)v2 + 94) && *((char *)v2 + 97) )
|
|
1231 {
|
|
1232 if ( v3 - *((int *)v2 + 20) < 0xFA )
|
|
1233 {
|
|
1234 v8 = *(int *)v5;
|
|
1235 v9 = *(int *)(v5 + 4);
|
|
1236 v15 = 2;
|
|
1237 //v12 = &AsyncMouse::unk::vdtor_ptr;
|
|
1238 v13 = v8;
|
|
1239 v14 = v9;
|
|
1240 v17 = 1;
|
|
1241 AsyncMouse::unk_46BCD2((char *)v2 + 116, (int)&a2, *((int *)v2 + 30), (int)&v12);
|
|
1242 v17 = -1;
|
|
1243 v3 = v16;
|
|
1244 }
|
|
1245 *((int *)v2 + 20) = v3;
|
|
1246 }
|
|
1247 if ( *((char *)v2 + 95) && *((char *)v2 + 98) )
|
|
1248 {
|
|
1249 if ( v3 - *((int *)v2 + 21) < 0xFA )
|
|
1250 {
|
|
1251 v10 = *(int *)v5;
|
|
1252 v11 = *(int *)(v5 + 4);
|
|
1253 v15 = 4;
|
|
1254 //v12 = &AsyncMouse::unk::vdtor_ptr;
|
|
1255 v13 = v10;
|
|
1256 v14 = v11;
|
|
1257 v17 = 2;
|
|
1258 AsyncMouse::unk_46BCD2((char *)v2 + 116, (int)&a2, *((int *)v2 + 30), (int)&v12);
|
|
1259 v3 = v16;
|
|
1260 }
|
|
1261 *((int *)v2 + 21) = v3;
|
|
1262 }
|
|
1263 LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse);*/
|
|
1264 }
|
|
1265
|
|
1266 //----- (0046B736) --------------------------------------------------------
|
|
1267 void AsyncMouse::_46B736_consume_click_lists(char a2)
|
|
1268 {
|
|
1269 __debugbreak();
|
|
1270 /*
|
|
1271 void *v2; // esi@1
|
|
1272
|
|
1273 v2 = this;
|
|
1274 _46B76F();
|
|
1275 _46B879();
|
|
1276 if ( a2 )
|
|
1277 {
|
|
1278 _46BCAB((char *)v2 + 104);
|
|
1279 _46BCAB((char *)v2 + 116);
|
|
1280 }
|
|
1281 if ( *((char *)v2 + 102) )
|
|
1282 {
|
|
1283 back_to_game();
|
|
1284 *((char *)v2 + 102) = 0;
|
|
1285 }*/
|
|
1286 }
|
|
1287
|
|
1288 //----- (0046B76F) --------------------------------------------------------
|
|
1289 void AsyncMouse::_46B76F()
|
|
1290 {
|
|
1291 __debugbreak();
|
|
1292 /*
|
|
1293 char *v0; // ebx@1
|
|
1294 int v1; // eax@1
|
|
1295 int v2; // edi@1
|
|
1296 int v3; // eax@2
|
|
1297 unsigned int *v4; // esi@2
|
|
1298 unsigned int v5; // ST08_4@7
|
|
1299 unsigned int v6; // ST04_4@7
|
|
1300 float v7; // ST00_4@7
|
|
1301 unsigned int v8; // ST08_4@9
|
|
1302 unsigned int v9; // ST04_4@9
|
|
1303 float v10; // ST00_4@9
|
|
1304
|
|
1305 EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse);
|
|
1306 v0 = (char *)pAsyncMouse + 108;
|
|
1307 v1 = *((int *)pAsyncMouse + 27);
|
|
1308 v2 = *(int *)v1;
|
|
1309 if ( *(int *)v1 != v1 )
|
|
1310 {
|
|
1311 do
|
|
1312 {
|
|
1313 v3 = *(int *)(v2 + 20);
|
|
1314 v4 = (unsigned int *)(v2 + 12);
|
|
1315 if ( v3 & 1 )
|
|
1316 {
|
|
1317 pGame->PickMouse(512.0, *v4, *(int *)(v2 + 16), 0, &a3, &a4);
|
|
1318 if ( GetCurrentMenuID() == 6 )
|
|
1319 sub_41CD4F(0x29u);
|
|
1320 UI_OnMouseLeftClick((int *)(v2 + 12));
|
|
1321 }
|
|
1322 else
|
|
1323 {
|
|
1324 if ( v3 & 2 )
|
|
1325 {
|
|
1326 v5 = *(int *)(v2 + 16);
|
|
1327 v6 = *v4;
|
|
1328 v7 = GetPickDepth();
|
|
1329 pGame->PickMouse(v7, v6, v5, 0, &stru_F93E30, &a5);
|
|
1330 sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62((Vec2_int_ *)(v2 + 12));
|
|
1331 }
|
|
1332 else
|
|
1333 {
|
|
1334 if ( v3 & 4 )
|
|
1335 {
|
|
1336 v8 = *(int *)(v2 + 16);
|
|
1337 v9 = *v4;
|
|
1338 v10 = GetPickDepth();
|
|
1339 pGame->PickMouse(v10, v9, v8, 1, &a3, &a5);
|
|
1340 }
|
|
1341 }
|
|
1342 }
|
|
1343 v2 = *(int *)v2;
|
|
1344 }
|
|
1345 while ( v2 != *(int *)v0 );
|
|
1346 }
|
|
1347 LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse);*/
|
|
1348 }
|
|
1349
|
|
1350 //----- (0046B879) --------------------------------------------------------
|
|
1351 void AsyncMouse::_46B879()
|
|
1352 {
|
|
1353 __debugbreak();
|
|
1354 /*
|
|
1355 char *v0; // ebx@1
|
|
1356 int v1; // eax@1
|
|
1357 int v2; // edi@1
|
|
1358 int v3; // eax@2
|
|
1359 unsigned int *v4; // esi@2
|
|
1360 unsigned int v5; // ST08_4@5
|
|
1361 unsigned int v6; // ST04_4@5
|
|
1362 float v7; // ST00_4@5
|
|
1363
|
|
1364 EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse);
|
|
1365 v0 = (char *)pAsyncMouse + 120;
|
|
1366 v1 = *((int *)pAsyncMouse + 30);
|
|
1367 v2 = *(int *)v1;
|
|
1368 if ( *(int *)v1 != v1 )
|
|
1369 {
|
|
1370 do
|
|
1371 {
|
|
1372 v3 = *(int *)(v2 + 20);
|
|
1373 v4 = (unsigned int *)(v2 + 12);
|
|
1374 if ( v3 & 1 )
|
|
1375 {
|
|
1376 pGame->PickMouse(512.0, *v4, *(int *)(v2 + 16), 0, &a3, &a4);
|
|
1377 sub_4178C4();
|
|
1378 }
|
|
1379 else
|
|
1380 {
|
|
1381 if ( v3 & 2 )
|
|
1382 {
|
|
1383 v5 = *(int *)(v2 + 16);
|
|
1384 v6 = *v4;
|
|
1385 v7 = GetPickDepth();
|
|
1386 pGame->PickMouse(v7, v6, v5, 0, &stru_F93E30, &a4);
|
|
1387 sub_4178E1();
|
|
1388 }
|
|
1389 else
|
|
1390 {
|
|
1391 if ( v3 & 4 )
|
|
1392 nullsub_1();
|
|
1393 }
|
|
1394 }
|
|
1395 v2 = *(int *)v2;
|
|
1396 }
|
|
1397 while ( v2 != *(int *)v0 );
|
|
1398 }
|
|
1399 LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse);*/
|
|
1400 }
|
|
1401
|
|
1402 //----- (0046B944) --------------------------------------------------------
|
|
1403 int AsyncMouse::_46B944()
|
|
1404 {
|
|
1405 __debugbreak();
|
|
1406 /*
|
|
1407 void *v1; // esi@1
|
|
1408
|
|
1409 v1 = this;
|
|
1410 _46BCAB((char *)this + 104);
|
|
1411 return _46BCAB((char *)v1 + 116);*/
|
|
1412 return 0;
|
|
1413 }
|
|
1414 // 46BCAB: using guessed type int __thiscall AsyncMouse__46BCAB(int);
|
|
1415
|
|
1416 //----- (0046B958) --------------------------------------------------------
|
|
1417 char AsyncMouse::_46B958(int a2, int a3)
|
|
1418 {
|
|
1419 __debugbreak();
|
|
1420 /*
|
|
1421 void *v3; // esi@1
|
|
1422 char result; // al@3
|
|
1423 int v5; // edx@6
|
|
1424 int v6; // eax@6
|
|
1425 int v7; // eax@12
|
|
1426 int v8; // edi@13
|
|
1427 int v9; // eax@19
|
|
1428 struct IDirectDrawSurface4 *v10; // ST08_4@21
|
|
1429 DDBLTFX v11; // [sp+4h] [bp-74h]@21
|
|
1430 RECT v12; // [sp+68h] [bp-10h]@19
|
|
1431
|
|
1432 v3 = this;
|
|
1433 if ( pRenderer->pFrontBuffer4 && !pRenderer->pFrontBuffer4->IsLost() )
|
|
1434 {
|
|
1435 EnterCriticalSection(&pGame->pThreadWardInstance->cs2);
|
|
1436 if ( *((char *)v3 + 88) )
|
|
1437 pRenderer->pFrontBuffer4->BltFast(
|
|
1438 *((int *)v3 + 8),
|
|
1439 *((int *)v3 + 9),
|
|
1440 (LPDIRECTDRAWSURFACE4)*((int *)v3 + 2),
|
|
1441 (LPRECT)((char *)v3 + 48),
|
|
1442 16u);
|
|
1443 v5 = 640 - a2;
|
|
1444 v6 = 640 - a2;
|
|
1445 if ( 640 - a2 >= 31 )
|
|
1446 v6 = 31;
|
|
1447 if ( v6 >= 0 )
|
|
1448 {
|
|
1449 if ( v5 >= 31 )
|
|
1450 v5 = 31;
|
|
1451 }
|
|
1452 else
|
|
1453 {
|
|
1454 v5 = 0;
|
|
1455 }
|
|
1456 v7 = 480 - a3;
|
|
1457 if ( 480 - a3 >= 31 )
|
|
1458 v8 = 31;
|
|
1459 else
|
|
1460 v8 = 480 - a3;
|
|
1461 if ( v8 >= 0 )
|
|
1462 {
|
|
1463 if ( v7 >= 31 )
|
|
1464 v7 = 31;
|
|
1465 }
|
|
1466 else
|
|
1467 {
|
|
1468 v7 = 0;
|
|
1469 }
|
|
1470 *((int *)v3 + 13) = 0;
|
|
1471 *((int *)v3 + 14) = v5;
|
|
1472 v12.right = a2 + v5;
|
|
1473 *((int *)v3 + 12) = 0;
|
|
1474 *((int *)v3 + 15) = v7;
|
|
1475 v12.left = a2;
|
|
1476 v12.bottom = a3 + v7;
|
|
1477 v9 = *((int *)v3 + 2);
|
|
1478 v12.top = a3;
|
|
1479 (*(void (__stdcall **)(int, int, int, IDirectDrawSurface4 *, RECT *, signed int))(*(int *)v9 + 28))(
|
|
1480 v9,
|
|
1481 0,
|
|
1482 0,
|
|
1483 pRenderer->pFrontBuffer4,
|
|
1484 &v12,
|
|
1485 16);
|
|
1486 if ( !*((char *)v3 + 90) || *((char *)v3 + 128) & 1 )
|
|
1487 {
|
|
1488 v10 = (struct IDirectDrawSurface4 *)*((int *)v3 + 1);
|
|
1489 v11.dwSize = 100;
|
|
1490 v11.dwDDFX = 8;
|
|
1491 pRenderer->pFrontBuffer4->Blt(
|
|
1492 &v12,
|
|
1493 v10,
|
|
1494 (LPRECT)((char *)v3 + 48),
|
|
1495 16812032u,
|
|
1496 &v11);
|
|
1497 }
|
|
1498 *((char *)v3 + 88) = 1;
|
|
1499 LeaveCriticalSection(&pGame->pThreadWardInstance->cs2);
|
|
1500 result = 1;
|
|
1501 }
|
|
1502 else
|
|
1503 {
|
|
1504 result = 0;
|
|
1505 }
|
|
1506 return result;*/
|
|
1507 return 0;
|
|
1508 }
|
|
1509
|
|
1510 //----- (0046BA8D) --------------------------------------------------------
|
|
1511 char AsyncMouse::_46BA8D(int a2, int a3)
|
|
1512 {
|
|
1513 __debugbreak();
|
|
1514 /*
|
|
1515 void *v3; // esi@1
|
|
1516 DWORD v4; // eax@1
|
|
1517
|
|
1518 v3 = this;
|
|
1519 v4 = timeGetTime();
|
|
1520 if ( v4 - *((int *)v3 + 16) <= 0x32 )
|
|
1521 {
|
|
1522 *((char *)v3 + 91) = *((char *)v3 + 90) == 1;
|
|
1523 *((char *)v3 + 90) = 0;
|
|
1524 }
|
|
1525 else
|
|
1526 {
|
|
1527 if ( *((char *)v3 + 90) )
|
|
1528 *((char *)v3 + 91) = 0;
|
|
1529 else
|
|
1530 *((char *)v3 + 91) = 1;
|
|
1531 *((char *)v3 + 90) = 1;
|
|
1532 }
|
|
1533 if ( a2 != *((int *)v3 + 17) || a3 != *((int *)v3 + 18) )
|
|
1534 {
|
|
1535 *((int *)v3 + 16) = v4;
|
|
1536 *((int *)v3 + 17) = a2;
|
|
1537 *((int *)v3 + 18) = a3;
|
|
1538 }
|
|
1539 return *((char *)v3 + 90);*/
|
|
1540 return 0;
|
|
1541 }
|
|
1542
|
|
1543 //----- (0046BAEC) --------------------------------------------------------
|
|
1544 void AsyncMouse::_46BAEC()
|
|
1545 {
|
|
1546 void *v1; // esi@1
|
|
1547
|
|
1548 v1 = this;
|
|
1549 EnterCriticalSection(&pGame->pThreadWardInstance->cs2);
|
|
1550 *((char *)v1 + 88) = 0;
|
|
1551 }
|
|
1552
|
|
1553 //----- (0046BB0A) --------------------------------------------------------
|
|
1554 void AsyncMouse::_46BB0A()
|
|
1555 {
|
|
1556 __debugbreak();
|
|
1557 /*
|
|
1558 void *v1; // esi@1
|
|
1559 int v2; // eax@1
|
|
1560 int v3; // edx@1
|
|
1561 int v4; // ecx@1
|
|
1562 int v5; // edx@1
|
|
1563 int v6; // eax@1
|
|
1564 char v7; // zf@1
|
|
1565 struct IDirectDrawSurface4 *v8; // ST08_4@8
|
|
1566 int v9; // [sp+8h] [bp-74h]@8
|
|
1567 int v10; // [sp+Ch] [bp-70h]@8
|
|
1568 int v11; // [sp+6Ch] [bp-10h]@1
|
|
1569 int v12; // [sp+70h] [bp-Ch]@1
|
|
1570 int v13; // [sp+74h] [bp-8h]@1
|
|
1571 int v14; // [sp+78h] [bp-4h]@1
|
|
1572
|
|
1573 v1 = this;
|
|
1574 v2 = *((int *)this + 17) - *((int *)this + 10);
|
|
1575 v3 = *((int *)this + 14);
|
|
1576 v4 = *((int *)this + 18) - *((int *)this + 11);
|
|
1577 v11 = v2;
|
|
1578 v5 = v2 + v3;
|
|
1579 v6 = *((int *)v1 + 15);
|
|
1580 v12 = v4;
|
|
1581 v7 = *((char *)v1 + 90) == 0;
|
|
1582 v13 = v5;
|
|
1583 v14 = v4 + v6;
|
|
1584 if ( v7 || *((char *)v1 + 128) & 1 )
|
|
1585 {
|
|
1586 if ( *((char *)v1 + 88) )
|
|
1587 pRenderer->pFrontBuffer4->BltFast(
|
|
1588 *((int *)v1 + 8),
|
|
1589 *((int *)v1 + 9),
|
|
1590 (LPDIRECTDRAWSURFACE4)*((int *)v1 + 2),
|
|
1591 (LPRECT)((char *)v1 + 48),
|
|
1592 16u);
|
|
1593 (*(void (__stdcall **)(int, int, int, IDirectDrawSurface4 *, int *, signed int))(**((int **)v1 + 2) + 28))(
|
|
1594 *((int *)v1 + 2),
|
|
1595 0,
|
|
1596 0,
|
|
1597 pRenderer->pFrontBuffer4,
|
|
1598 &v11,
|
|
1599 16);
|
|
1600 }
|
|
1601 if ( *((char *)v1 + 90) && !(*((char *)v1 + 128) & 1) )
|
|
1602 {
|
|
1603 v8 = (struct IDirectDrawSurface4 *)*((int *)v1 + 1);
|
|
1604 v9 = 100;
|
|
1605 v10 = 8;
|
|
1606 pRenderer->pFrontBuffer4->Blt(
|
|
1607 (LPRECT)&v11,
|
|
1608 v8,
|
|
1609 (LPRECT)((char *)v1 + 48),
|
|
1610 16812032u,
|
|
1611 (LPDDBLTFX)&v9);
|
|
1612 }
|
|
1613 LeaveCriticalSection(&pGame->pThreadWardInstance->cs2);*/
|
|
1614 }
|
|
1615
|
|
1616 //----- (0046BBD0) --------------------------------------------------------
|
|
1617 void *AsyncMouse::Clip()
|
|
1618 {
|
|
1619 __debugbreak();
|
|
1620 /*
|
|
1621 void *result; // eax@1
|
|
1622 std::string v1; // [sp-18h] [bp-30h]@2
|
|
1623 const char *v2; // [sp-8h] [bp-20h]@2
|
|
1624 int v3; // [sp-4h] [bp-1Ch]@2
|
|
1625 RECT Rect; // [sp+0h] [bp-18h]@1
|
|
1626 std::string *v5; // [sp+10h] [bp-8h]@2
|
|
1627 int a3; // [sp+17h] [bp-1h]@2
|
|
1628
|
|
1629 SetWindowPos(hWnd, HWND_MESSAGE|0x2, 320, 240, 640, 480, 0);
|
|
1630 Rect.left = 325;
|
|
1631 Rect.top = 245;
|
|
1632 Rect.right = 326;
|
|
1633 Rect.bottom = 246;
|
|
1634 result = (void *)ClipCursor(&Rect);
|
|
1635 if ( !result )
|
|
1636 {
|
|
1637 MessageBoxW(nullptr, L"Could not clip cursor to screen!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\MouseAsync.cpp:827", 0);
|
|
1638 }
|
|
1639 return result;*/
|
|
1640 return 0;
|
|
1641 }
|
|
1642
|
|
1643 //----- (0046BC4E) --------------------------------------------------------
|
|
1644 void __stdcall AsyncMouse::AsyncMouseThread(int a1)
|
|
1645 {
|
|
1646 __debugbreak();
|
|
1647 /*
|
|
1648 while ( 1 )
|
|
1649 {
|
|
1650 while ( !pAsyncMouse )
|
|
1651 Sleep(1);
|
|
1652 if ( !AsyncMouse::Thread(pAsyncMouse) )
|
|
1653 ExitThread(0);
|
|
1654 Sleep(18);
|
|
1655 }*/
|
|
1656 }
|
|
1657
|
|
1658 //----- (0046BC73) --------------------------------------------------------
|
|
1659 void AsyncMouse::dtor_sub_46BC73()
|
|
1660 {
|
|
1661 __debugbreak();
|
|
1662 /*
|
|
1663 int v1; // edi@1
|
|
1664 void **v2; // ebx@1
|
|
1665 void *v3; // esi@1
|
|
1666 void *v4; // eax@2
|
|
1667 int v5; // [sp+0h] [bp-4h]@1
|
|
1668
|
|
1669 v5 = this;
|
|
1670 v1 = this;
|
|
1671 v2 = *(void ***)(this + 4);
|
|
1672 v3 = *v2;
|
|
1673 while ( v3 != v2 )
|
|
1674 {
|
|
1675 v4 = v3;
|
|
1676 v3 = *(void **)v3;
|
|
1677 AsyncMouse::unk_46BD2D((void *)v1, (int)&v5, v4);
|
|
1678 }
|
|
1679 free(*(void **)(v1 + 4));
|
|
1680 *(int *)(v1 + 4) = 0;
|
|
1681 *(int *)(v1 + 8) = 0;*/
|
|
1682 }
|
|
1683
|
|
1684 //----- (0046BCAB) --------------------------------------------------------
|
|
1685 int AsyncMouse::_46BCAB()
|
|
1686 {
|
|
1687 __debugbreak();
|
|
1688 /*
|
|
1689 void *v1; // ebx@1
|
|
1690 void **v2; // edi@1
|
|
1691 void *v3; // esi@1
|
|
1692 void *v4; // eax@2
|
|
1693 int result; // eax@2
|
|
1694 int v6; // [sp+0h] [bp-4h]@1
|
|
1695
|
|
1696 v6 = this;
|
|
1697 v1 = (void *)this;
|
|
1698 v2 = *(void ***)(this + 4);
|
|
1699 v3 = *v2;
|
|
1700 while ( v3 != v2 )
|
|
1701 {
|
|
1702 v4 = v3;
|
|
1703 v3 = *(void **)v3;
|
|
1704 result = AsyncMouse::unk_46BD2D(v1, (int)&v6, v4);
|
|
1705 }
|
|
1706 return result;*/
|
|
1707 return 0;
|
|
1708 }
|
|
1709 // 46BCAB: using guessed type int __thiscall AsyncMouse__46BCAB(int);
|
|
1710
|
|
1711 //----- (0046BCD2) --------------------------------------------------------
|
|
1712 int AsyncMouse::unk_46BCD2(int a2, int a3, int a4)
|
|
1713 {
|
|
1714 __debugbreak();
|
|
1715 /*
|
|
1716 void *v4; // edi@1
|
|
1717 void *v5; // eax@1
|
|
1718 void *v6; // esi@1
|
|
1719 int result; // eax@1
|
|
1720
|
|
1721 v4 = this;
|
|
1722 v5 = AsyncMouse::unk_46BD09((void *)a3, *(void **)(a3 + 4));
|
|
1723 v6 = v5;
|
|
1724 *(int *)(a3 + 4) = v5;
|
|
1725 **((int **)v5 + 1) = v5;
|
|
1726 AsyncMouse::unk_46BD66((char *)v5 + 8, a4);
|
|
1727 result = a2;
|
|
1728 ++*((int *)v4 + 2);
|
|
1729 *(int *)a2 = v6;
|
|
1730 return result;*/
|
|
1731 return 0;
|
|
1732 }
|
|
1733 // 46BD66: using guessed type int __fastcall AsyncMouse__unk__46BD66(int, int);
|
|
1734
|
|
1735 //----- (0046BD09) --------------------------------------------------------
|
|
1736 void *AsyncMouse::unk_46BD09(void *a1, void *a2)
|
|
1737 {
|
|
1738 __debugbreak();
|
|
1739 /*
|
|
1740 void *result; // eax@1
|
|
1741 void *v3; // ecx@1
|
|
1742 void *v4; // ecx@3
|
|
1743
|
|
1744 result = operator new(0x18u);
|
|
1745 v3 = a1;
|
|
1746 if ( !a1 )
|
|
1747 v3 = result;
|
|
1748 *(int *)result = v3;
|
|
1749 v4 = a2;
|
|
1750 if ( !a2 )
|
|
1751 v4 = result;
|
|
1752 *((int *)result + 1) = v4;
|
|
1753 return result;*/
|
|
1754 return 0;
|
|
1755 }
|
|
1756
|
|
1757 //----- (0046BD2D) --------------------------------------------------------
|
|
1758 int AsyncMouse::unk_46BD2D(int a2, void *a3)
|
|
1759 {
|
|
1760 __debugbreak();
|
|
1761 /*
|
|
1762 void *v3; // edi@1
|
|
1763 int v4; // ebx@1
|
|
1764 int result; // eax@1
|
|
1765
|
|
1766 v3 = this;
|
|
1767 v4 = *(int *)a3;
|
|
1768 **((int **)a3 + 1) = *(int *)a3;
|
|
1769 *(int *)(*(int *)a3 + 4) = *((int *)a3 + 1);
|
|
1770 (**((void (__stdcall ***)(int))a3 + 2))(0);
|
|
1771 free(a3);
|
|
1772 result = a2;
|
|
1773 --*((int *)v3 + 2);
|
|
1774 *(int *)a2 = v4;
|
|
1775 return result;*/
|
|
1776 return 0;
|
|
1777 }
|
|
1778
|
|
1779 //----- (0046BD66) --------------------------------------------------------
|
|
1780 int AsyncMouse::unk_46BD66(int a1, int a2)
|
|
1781 {
|
|
1782 int result; // eax@2
|
|
1783
|
|
1784 if ( a1 )
|
|
1785 {
|
|
1786 *(int *)(a1 + 4) = *(int *)(a2 + 4);
|
|
1787 *(int *)(a1 + 8) = *(int *)(a2 + 8);
|
|
1788 result = *(int *)(a2 + 12);
|
|
1789 *(int *)(a1 + 12) = result;
|
|
1790 //*(int *)a1 = &AsyncMouse::unk::vdtor_ptr;
|
|
1791 }
|
|
1792 return result;
|
|
1793 }
|
|
1794 // 46BD66: using guessed type int __fastcall AsyncMouse__unk__46BD66(int, int);
|
|
1795 // 4D8734: using guessed type int (__stdcall *AsyncMouse__unk__vdtor_ptr)(char);
|
|
1796
|
|
1797
|
|
1798
|
|
1799
|
|
1800
|
|
1801
|
|
1802
|
|
1803
|
|
1804
|
|
1805
|
|
1806
|
|
1807
|
|
1808
|
|
1809
|
|
1810
|
|
1811
|
|
1812
|
|
1813
|
|
1814
|
|
1815 /*
|
|
1816 //----- (0043B9FF) --------------------------------------------------------
|
|
1817 DirectInputMouse *__thiscall DirectInputMouse::DirectInputMouse(DirectInputMouse *this)
|
|
1818 {
|
|
1819 DirectInputMouse *v1; // esi@1
|
|
1820 HRESULT v2; // eax@5
|
|
1821 signed int v4; // [sp-18h] [bp-24h]@3
|
|
1822 char *v5; // [sp-14h] [bp-20h]@3
|
|
1823 int v6; // [sp-10h] [bp-1Ch]@3
|
|
1824 const char *v7; // [sp-Ch] [bp-18h]@3
|
|
1825 int v8; // [sp-8h] [bp-14h]@3
|
|
1826 unsigned int v9; // [sp-4h] [bp-10h]@3
|
|
1827 CheckHRESULT_stru0 v10; // [sp+8h] [bp-4h]@5
|
|
1828
|
|
1829 v1 = this;
|
|
1830 this->field_8 = 0;
|
|
1831 LOBYTE(this->field_1C) = 0;
|
|
1832 this->field_28 = 0;
|
|
1833 this->vdestructor_ptr = (int)&DirectInputMouse_pvdtor;
|
|
1834 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 )
|
|
1835 {
|
|
1836 v9 = 1;
|
|
1837 v8 = 30;
|
|
1838 v7 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputMouse.cpp";
|
|
1839 v6 = 0;
|
|
1840 v5 = (char *)&this->pDirectInput;
|
|
1841 v4 = 1280;
|
|
1842 }
|
|
1843 else
|
|
1844 {
|
|
1845 v9 = 1;
|
|
1846 v8 = 28;
|
|
1847 v7 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputMouse.cpp";
|
|
1848 v6 = 0;
|
|
1849 v5 = (char *)&this->pDirectInput;
|
|
1850 v4 = 768;
|
|
1851 }
|
|
1852 v2 = DirectInputCreateA(hInstance, v4, v5, v6);
|
|
1853 CheckHRESULT(&v10, v2, v7, v8, v9);
|
|
1854 DirectInputMouse::CreateDevice(v1);
|
|
1855 DirectInputMouse::43BB18(v1);
|
|
1856 v1->field_20 = 0;
|
|
1857 v1->field_24 = 0;
|
|
1858 return v1;
|
|
1859 }
|
|
1860 // 4C8880: using guessed type int __stdcall DirectInputCreateA(int, int, int, int);
|
|
1861 // 4D8608: using guessed type int (__stdcall *DirectInputMouse_pvdtor)(char);
|
|
1862
|
|
1863 //----- (0043BA80) --------------------------------------------------------
|
|
1864 void *__thiscall DirectInputMouse::vdtor(void *this, bool a2)
|
|
1865 {
|
|
1866 void *v2; // esi@1
|
|
1867
|
|
1868 v2 = this;
|
|
1869 DirectInputMouse::dtor(this);
|
|
1870 if ( a2 & 1 )
|
|
1871 free(v2);
|
|
1872 return v2;
|
|
1873 }
|
|
1874
|
|
1875 //----- (0043BA9C) --------------------------------------------------------
|
|
1876 int __thiscall DirectInputMouse::dtor(void *this)
|
|
1877 {
|
|
1878 void *v1; // esi@1
|
|
1879 int v2; // eax@1
|
|
1880 int result; // eax@3
|
|
1881
|
|
1882 v1 = this;
|
|
1883 v2 = *((int *)this + 2);
|
|
1884 *(int *)this = &DirectInputMouse_pvdtor;
|
|
1885 if ( v2 )
|
|
1886 {
|
|
1887 (*(void (__stdcall **)(int))(*(int *)v2 + 32))(v2);
|
|
1888 (*(void (__stdcall **)(int))(**((int **)v1 + 2) + 8))(*((int *)v1 + 2));
|
|
1889 *((int *)v1 + 2) = 0;
|
|
1890 }
|
|
1891 result = (*(int (__stdcall **)(int))(**((int **)v1 + 1) + 8))(*((int *)v1 + 1));
|
|
1892 *((int *)v1 + 1) = 0;
|
|
1893 return result;
|
|
1894 }
|
|
1895 // 4D8608: using guessed type int (__stdcall *DirectInputMouse_pvdtor)(char);
|
|
1896
|
|
1897 //----- (0043BACE) --------------------------------------------------------
|
|
1898 void __thiscall DirectInputMouse::CreateDevice(DirectInputMouse *this)
|
|
1899 {
|
|
1900 DirectInputMouse *v1; // esi@1
|
|
1901 HRESULT v2; // eax@1
|
|
1902 CheckHRESULT_stru0 v3; // [sp+4h] [bp-4h]@1
|
|
1903
|
|
1904 v1 = this;
|
|
1905 v2 = ((int (__stdcall *)(int, int, int, int, int))this->pDirectInput->lpVtbl->field_10)(
|
|
1906 this->pDirectInput,
|
|
1907 2,
|
|
1908 DirectInputMouse_enumerator,
|
|
1909 this,
|
|
1910 1);
|
|
1911 CheckHRESULT(&v3, v2, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputMouse.cpp", 57, 1u);
|
|
1912 if ( !LOBYTE(v1->field_1C) )
|
|
1913 {
|
|
1914 v3.vdestructor_ptr = (void (__thiscall ***)(CheckHRESULT_stru0 *, bool))"Error: No mouse found";
|
|
1915 _CxxThrowException((int)&v3, (int)&dword_4DBD94);
|
|
1916 }
|
|
1917 }
|
|
1918 // 43BC61: using guessed type int __stdcall DirectInputMouse_enumerator(int, int);
|
|
1919 // 4DBD94: using guessed type int dword_4DBD94;
|
|
1920
|
|
1921 //----- (0043BB18) --------------------------------------------------------
|
|
1922 int __thiscall DirectInputMouse::43BB18(DirectInputMouse *this)
|
|
1923 {
|
|
1924 char *v1; // esi@1
|
|
1925 HRESULT v2; // eax@1
|
|
1926 HRESULT v3; // eax@1
|
|
1927 HRESULT v4; // eax@1
|
|
1928 unsigned int v6; // [sp+0h] [bp-Ch]@0
|
|
1929 CheckHRESULT_stru0 v7; // [sp+8h] [bp-4h]@1
|
|
1930
|
|
1931 v1 = (char *)&this->field_8;
|
|
1932 v2 = ((int (__stdcall *)(int, int, int, int, int))this->pDirectInput->lpVtbl->field_C)(
|
|
1933 this->pDirectInput,
|
|
1934 &this->field_C,
|
|
1935 &this->field_8,
|
|
1936 0,
|
|
1937 "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputMouse.cpp");
|
|
1938 CheckHRESULT(&v7, v2, (const char *)0x40, 1, v6);
|
|
1939 v3 = (*(int (__stdcall **)(int, int))(**(int **)v1 + 44))(*(int *)v1, dword_4C9920);
|
|
1940 CheckHRESULT(&v7, v3, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputMouse.cpp", 65, 1u);
|
|
1941 v4 = (*(int (__stdcall **)(int, int, int))(**(int **)v1 + 52))(*(int *)v1, hWnd, 6);
|
|
1942 CheckHRESULT(&v7, v4, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputMouse.cpp", 66, 1u);
|
|
1943 return (*(int (__cdecl **)(int))(**(int **)v1 + 28))(*(int *)v1);
|
|
1944 }
|
|
1945 // 4C9920: using guessed type int dword_4C9920[16];
|
|
1946
|
|
1947 //----- (0043BB89) --------------------------------------------------------
|
|
1948 bool __thiscall DirectInputMouse::43BB89(DirectInputMouse *this)
|
|
1949 {
|
|
1950 DirectInputMouse *v1; // esi@1
|
|
1951 bool result; // eax@1
|
|
1952 HRESULT v3; // eax@5
|
|
1953 __int32 v4; // ecx@6
|
|
1954 __int32 v5; // eax@6
|
|
1955 __int32 v6; // edx@6
|
|
1956 int v7; // ecx@12
|
|
1957 bool v8; // ecx@12
|
|
1958 signed int v9; // edx@12
|
|
1959 HRESULT a2; // [sp+4h] [bp-14h]@3
|
|
1960 int v11; // [sp+8h] [bp-10h]@12
|
|
1961 char v12; // [sp+10h] [bp-8h]@18
|
|
1962 char v13; // [sp+11h] [bp-7h]@20
|
|
1963 char v14; // [sp+12h] [bp-6h]@22
|
|
1964 char v15; // [sp+13h] [bp-5h]@24
|
|
1965 char v18; // [sp+14h] [bp-4h]@5
|
|
1966
|
|
1967 v1 = this;
|
|
1968 result = this->field_8;
|
|
1969 if ( result )
|
|
1970 {
|
|
1971 if ( (*(int (__stdcall **)(bool, signed int, HRESULT *))(*(int *)result + 36))(result, 16, &a2) == -2147024866
|
|
1972 && !(*(int (__stdcall **)(int))(*(int *)v1->field_8 + 28))(v1->field_8) )
|
|
1973 {
|
|
1974 v3 = (*(int (__stdcall **)(int, signed int, HRESULT *))(*(int *)v1->field_8 + 36))(v1->field_8, 16, &a2);
|
|
1975 CheckHRESULT((CheckHRESULT_stru0 *)&v18, v3, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\DirectInputMouse.cpp", 80, 1u);
|
|
1976 }
|
|
1977 v4 = v1->field_20 + a2;
|
|
1978 v5 = 640;
|
|
1979 v6 = v1->field_20 + a2;
|
|
1980 if ( v4 >= 640 )
|
|
1981 v6 = 640;
|
|
1982 if ( v6 >= 0 )
|
|
1983 {
|
|
1984 if ( v4 < 640 )
|
|
1985 v5 = v1->field_20 + a2;
|
|
1986 }
|
|
1987 else
|
|
1988 {
|
|
1989 v5 = 0;
|
|
1990 }
|
|
1991 v7 = v11;
|
|
1992 v1->field_20 = v5;
|
|
1993 v8 = v1->field_24 + v7;
|
|
1994 result = 480;
|
|
1995 v9 = v8;
|
|
1996 if ( v8 >= 480 )
|
|
1997 v9 = 480;
|
|
1998 if ( v9 >= 0 )
|
|
1999 {
|
|
2000 if ( v8 < 480 )
|
|
2001 result = v8;
|
|
2002 }
|
|
2003 else
|
|
2004 {
|
|
2005 result = 0;
|
|
2006 }
|
|
2007 v1->field_28 = 0;
|
|
2008 v1->field_24 = result;
|
|
2009 if ( v12 & 0x80 )
|
|
2010 v1->field_28 = 1;
|
|
2011 if ( v13 & 0x80 )
|
|
2012 v1->field_28 |= 2u;
|
|
2013 if ( v14 & 0x80 )
|
|
2014 v1->field_28 |= 4u;
|
|
2015 if ( v15 & 0x80 )
|
|
2016 v1->field_28 |= 8u;
|
|
2017 LOBYTE(result) = 1;
|
|
2018 }
|
|
2019 else
|
|
2020 {
|
|
2021 LOBYTE(result) = 0;
|
|
2022 }
|
|
2023 return result;
|
|
2024 }
|
|
2025
|
|
2026 //----- (0043BC61) --------------------------------------------------------
|
|
2027 signed int __stdcall DirectInputMouse_enumerator(int a1, int a2)
|
|
2028 {
|
|
2029 signed int result; // eax@2
|
|
2030
|
|
2031 if ( *(char *)(a1 + 36) & 2 )
|
|
2032 {
|
|
2033 *(int *)(a2 + 12) = *(int *)(a1 + 4);
|
|
2034 *(int *)(a2 + 16) = *(int *)(a1 + 8);
|
|
2035 *(int *)(a2 + 20) = *(int *)(a1 + 12);
|
|
2036 *(int *)(a2 + 24) = *(int *)(a1 + 16);
|
|
2037 *(char *)(a2 + 28) = 1;
|
|
2038 result = 0;
|
|
2039 }
|
|
2040 else
|
|
2041 {
|
|
2042 result = 1;
|
|
2043 }
|
|
2044 return result;
|
|
2045 }
|
|
2046 // 43BC61: using guessed type int __stdcall DirectInputMouse_enumerator(int, int);
|
|
2047 */ |