comparison mm7_4.cpp @ 731:de482c901171

Moved unused CPU detection stuff to a separate file.
author Nomad
date Fri, 22 Mar 2013 11:18:51 +0200
parents 79ad0526166c
children 2f4e33c1ed24
comparison
equal deleted inserted replaced
730:79ad0526166c 731:de482c901171
2573 char *v24; // [sp+48h] [bp-10h]@2 2573 char *v24; // [sp+48h] [bp-10h]@2
2574 int v25; // [sp+4Ch] [bp-Ch]@2 2574 int v25; // [sp+4Ch] [bp-Ch]@2
2575 float v26; // [sp+50h] [bp-8h]@3 2575 float v26; // [sp+50h] [bp-8h]@3
2576 float v27; // [sp+54h] [bp-4h]@3 2576 float v27; // [sp+54h] [bp-4h]@3
2577 2577
2578 __debugbreak();
2578 v22 = 0; 2579 v22 = 0;
2579 v1 = this->pMemBlocks[1]->pAlignedBlock; 2580 v1 = this->pMemBlocks[1]->pAlignedBlock;
2580 v2 = this->pMemBlocks[6]->pAlignedBlock; 2581 v2 = this->pMemBlocks[6]->pAlignedBlock;
2581 if ( this->field_8C > 0 ) 2582 if ( this->field_8C > 0 )
2582 { 2583 {
5453 5454
5454 5455
5455 5456
5456 5457
5457 5458
5458 //----- (004AC1C9) --------------------------------------------------------
5459 int __thiscall sub_4AC1C9(unsigned int _this, Vec4_int_ *a2)
5460 {
5461 unsigned int v2; // esi@1
5462 __int16 v3; // di@1
5463 signed int v4; // ebx@1
5464 int v5; // ecx@3
5465 Vec4_int_ *v6; // eax@10
5466 Vec4_int_ *v7; // esi@14
5467 int result; // eax@16
5468 char *v9; // esi@16
5469 Vec4_int_ a1; // [sp+Ch] [bp-34h]@10
5470 Vec4_int_ v11; // [sp+1Ch] [bp-24h]@14
5471 Vec4_int_ Dst; // [sp+2Ch] [bp-14h]@1
5472 int v13; // [sp+3Ch] [bp-4h]@1
5473
5474 v2 = _this;
5475 v3 = sub_4382BC(_this);
5476 v13 = sub_4383ED();
5477 v4 = 0;
5478 memset(&Dst, 0, 0x10u);
5479 if ( v3 < 0 )
5480 goto LABEL_19;
5481 if ( (signed int)v2 > 0 )
5482 {
5483 if ( (signed int)v2 > 150 )
5484 {
5485 v5 = (int)a2;
5486 }
5487 else
5488 {
5489 v5 = 4000 * v2;
5490 v4 = 1;
5491 }
5492 }
5493 else
5494 {
5495 v5 = 4000 * dword_4F031C[(unsigned __int16)v3];
5496 }
5497 if ( v13 & 0x10 && !v4 )
5498 {
5499 if ( v2 )
5500 v6 = sub_4AC4FD_get_cpu_clocks_rdtsc(v5, &a1);
5501 else
5502 v6 = sub_4AC33A_get_cpu_clocks_QPC(v5, &a1);
5503 goto LABEL_14;
5504 }
5505 if ( (unsigned __int16)v3 < 3u )
5506 {
5507 LABEL_19:
5508 v7 = &Dst;
5509 goto LABEL_16;
5510 }
5511 v6 = sub_4AC277(v5, &a1);
5512 LABEL_14:
5513 v11.x = v6->x;
5514 v11.y = v6->y;
5515 v11.z = v6->z;
5516 v11.w = v6->w;
5517 v7 = &v11;
5518 LABEL_16:
5519 result = (int)a2;
5520 a2->x = v7->x;
5521 v9 = (char *)&v7->y;
5522 a2->y = *(int *)v9;
5523 v9 += 4;
5524 a2->z = *(int *)v9;
5525 a2->w = *((int *)v9 + 1);
5526 return result;
5527 }
5528 // 4F031C: using guessed type int dword_4F031C[];
5529
5530 //----- (004AC277) --------------------------------------------------------
5531 Vec4_int_ *__thiscall sub_4AC277(unsigned int _this, Vec4_int_ *a2)
5532 {
5533 __debugbreak();
5534 return 0;
5535 /*signed int v2; // esi@1
5536 signed __int16 v4; // bx@3
5537 int v10; // esi@8
5538 int v11; // eax@10
5539 Vec4_int_ *result; // eax@13
5540 Vec4_int_ Dst; // [sp+8h] [bp-30h]@1
5541 LARGE_INTEGER Frequency; // [sp+18h] [bp-20h]@1
5542 LARGE_INTEGER PerformanceCount; // [sp+20h] [bp-18h]@3
5543 LARGE_INTEGER v16; // [sp+28h] [bp-10h]@5
5544 int v17; // [sp+30h] [bp-8h]@1
5545 int v18; // [sp+34h] [bp-4h]@2
5546
5547 v17 = _this;
5548 v2 = -1;
5549 memset(&Dst, 0, 0x10u);
5550 if ( QueryPerformanceFrequency(&Frequency) )
5551 {
5552 v18 = 10;
5553 do
5554 {
5555 QueryPerformanceCounter(&PerformanceCount);
5556 _EAX = -2147483648;
5557 v4 = 4000;
5558 do
5559 {
5560 __asm { bsf ecx, eax }
5561 --v4;
5562 }
5563 while ( v4 );
5564 QueryPerformanceCounter(&v16);
5565 if ( (signed int)v16.s.LowPart - (signed int)PerformanceCount.s.LowPart < (unsigned int)v2 )
5566 v2 = v16.s.LowPart - PerformanceCount.s.LowPart;
5567 --v18;
5568 }
5569 while ( v18 );
5570 v10 = 100000 * v2 / (Frequency.s.LowPart / 0xA);
5571 if ( v10 % Frequency.s.LowPart > Frequency.s.LowPart >> 1 )
5572 ++v10;
5573 v11 = v17 / (unsigned int)v10;
5574 Dst.z = v17 / (unsigned int)v10;
5575 if ( v17 % (unsigned int)v10 > (unsigned int)v10 >> 1 )
5576 ++v11;
5577 Dst.x = v17;
5578 Dst.y = v10;
5579 Dst.w = v11;
5580 }
5581 result = a2;
5582 a2->x = Dst.x;
5583 a2->y = Dst.y;
5584 a2->z = Dst.z;
5585 a2->w = Dst.w;
5586 return result;*/
5587 }
5588
5589 //----- (004AC33A) --------------------------------------------------------
5590 Vec4_int_ *__thiscall sub_4AC33A_get_cpu_clocks_QPC(int _this, Vec4_int_ *a1)
5591 {
5592 __debugbreak();
5593 return 0;
5594 /*int v2; // esi@1
5595 int v3; // ebx@1
5596 unsigned __int64 v4; // qax@4
5597 unsigned __int64 v5; // qax@7
5598 DWORD v6; // edi@7
5599 DWORD v7; // eax@7
5600 unsigned int v8; // ecx@10
5601 unsigned __int64 v9; // qax@10
5602 unsigned int v10; // edi@10
5603 int v11; // eax@14
5604 unsigned int v12; // ecx@19
5605 Vec4_int_ *result; // eax@24
5606 int Dst; // [sp+Ch] [bp-4Ch]@1
5607 int v15; // [sp+10h] [bp-48h]@23
5608 int v16; // [sp+14h] [bp-44h]@21
5609 int v17; // [sp+18h] [bp-40h]@21
5610 LARGE_INTEGER Frequency; // [sp+1Ch] [bp-3Ch]@1
5611 LARGE_INTEGER PerformanceCount; // [sp+24h] [bp-34h]@2
5612 LARGE_INTEGER v20; // [sp+2Ch] [bp-2Ch]@2
5613 int v21; // [sp+34h] [bp-24h]@2
5614 int v22; // [sp+38h] [bp-20h]@2
5615 int v23; // [sp+3Ch] [bp-1Ch]@4
5616 int v24; // [sp+40h] [bp-18h]@7
5617 int nPriority; // [sp+44h] [bp-14h]@2
5618 unsigned int v26; // [sp+48h] [bp-10h]@1
5619 unsigned int v27; // [sp+4Ch] [bp-Ch]@1
5620 HANDLE hThread; // [sp+50h] [bp-8h]@1
5621 int v29; // [sp+54h] [bp-4h]@1
5622
5623 v2 = 0;
5624 v3 = 0;
5625 v29 = 0;
5626 v27 = 0;
5627 v26 = 0;
5628 hThread = GetCurrentThread();
5629 memset(&Dst, 0, 0x10u);
5630 if ( QueryPerformanceFrequency(&Frequency) )
5631 {
5632 do
5633 {
5634 ++v29;
5635 v22 = v2;
5636 v21 = v3;
5637 QueryPerformanceCounter(&PerformanceCount);
5638 v20 = PerformanceCount;
5639 nPriority = GetThreadPriority(hThread);
5640 if ( nPriority != 2147483647 )
5641 SetThreadPriority(hThread, 15);
5642 while ( v20.s.LowPart - PerformanceCount.s.LowPart < 0x32 )
5643 {
5644 QueryPerformanceCounter(&v20);
5645 v4 = __rdtsc();
5646 v23 = v4;
5647 }
5648 PerformanceCount = v20;
5649 do
5650 {
5651 QueryPerformanceCounter(&v20);
5652 v5 = __rdtsc();
5653 v24 = v5;
5654 v6 = v20.s.LowPart;
5655 v7 = PerformanceCount.s.LowPart;
5656 }
5657 while ( v20.s.LowPart - PerformanceCount.s.LowPart < 0x3E8 );
5658 if ( nPriority != 2147483647 )
5659 {
5660 SetThreadPriority(hThread, nPriority);
5661 v7 = PerformanceCount.s.LowPart;
5662 v6 = v20.s.LowPart;
5663 }
5664 v8 = v24 - v23;
5665 v27 += v24 - v23;
5666 v9 = (100000 * v6 - 100000 * v7) / (Frequency.s.LowPart / 0xA);
5667 v10 = v9;
5668 v26 += v9;
5669 if ( v9 % Frequency.s.LowPart > Frequency.s.LowPart >> 1 )
5670 v10 = v9 + 1;
5671 v3 = v8 / v10;
5672 if ( v8 % v10 > v10 >> 1 )
5673 v3 = v8 / v10 + 1;
5674 v2 = v21;
5675 v11 = v3 + v22 + v21;
5676 }
5677 while ( v29 < 3
5678 || v29 < 20
5679 && ((unsigned int)(3 * v3 - v11) > 3 || (unsigned int)(3 * v21 - v11) > 3 || (unsigned int)(3 * v22 - v11) > 3) );
5680 v12 = 10 * v27 / v26;
5681 if ( 100 * v27 / v26 - 10 * v12 >= 6 )
5682 ++v12;
5683 v16 = v27 / v26;
5684 v17 = v27 / v26;
5685 if ( v12 - 10 * v27 / v26 >= 6 )
5686 v17 = v27 / v26 + 1;
5687 v15 = v26;
5688 Dst = v27;
5689 }
5690 result = a1;
5691 a1->x = Dst;
5692 a1->y = v15;
5693 a1->z = v16;
5694 a1->w = v17;
5695 return result;*/
5696 }
5697
5698 //----- (004AC4FD) --------------------------------------------------------
5699 Vec4_int_ *__thiscall sub_4AC4FD_get_cpu_clocks_rdtsc(int _this, Vec4_int_ *a1)
5700 {
5701 __debugbreak();
5702 return 0;
5703 /*int v2; // eax@1
5704 int v3; // eax@4
5705 bool v4; // eax@5
5706 unsigned __int64 v5; // kr00_8@8
5707 int v6; // edi@9
5708 int v7; // eax@9
5709 bool v8; // eax@10
5710 unsigned __int64 v9; // kr08_8@13
5711 unsigned int v10; // eax@15
5712 Vec4_int_ *result; // eax@17
5713 int Dst; // [sp+Ch] [bp-2Ch]@1
5714 int v13; // [sp+10h] [bp-28h]@17
5715 int v14; // [sp+14h] [bp-24h]@15
5716 int v15; // [sp+18h] [bp-20h]@17
5717 unsigned int v16; // [sp+1Ch] [bp-1Ch]@8
5718 unsigned int v17; // [sp+20h] [bp-18h]@8
5719 unsigned int v18; // [sp+24h] [bp-14h]@13
5720 int nPriority; // [sp+28h] [bp-10h]@1
5721 __int64 v20; // [sp+2Ch] [bp-Ch]@1
5722 int v21; // [sp+34h] [bp-4h]@3
5723
5724 HIDWORD(v20) = GetCurrentThread();
5725 memset(&Dst, 0, 0x10u);
5726 v2 = GetThreadPriority(HIDWORD(v20));
5727 nPriority = v2;
5728 if ( v2 != 0x7FFFFFFF )
5729 SetThreadPriority(HIDWORD(v20), v2 + 1);
5730 __outbyte(0x70u, 0);
5731 v21 = __inbyte(0x71u);
5732 do
5733 {
5734 __outbyte(0x70u, 0);
5735 LODWORD(v20) = __inbyte(0x71u);
5736 v3 = v20 - v21;
5737 if ( (signed int)v20 >= v21 )
5738 v4 = v3 > 0;
5739 else
5740 v4 = v3 + 10;
5741 }
5742 while ( !v4 );
5743 v5 = __rdtsc();
5744 v16 = HIDWORD(v5);
5745 v17 = v5;
5746 do
5747 {
5748 __outbyte(0x70u, 0);
5749 v21 = __inbyte(0x71u);
5750 v6 = v21;
5751 v7 = v21 - v20;
5752 if ( v21 >= (signed int)v20 )
5753 v8 = v7 > 0;
5754 else
5755 v8 = v7 + 10;
5756 }
5757 while ( !v8 );
5758 v9 = __rdtsc();
5759 v18 = HIDWORD(v9);
5760 v21 = v9;
5761 if ( nPriority != 0x7FFFFFFF )
5762 SetThreadPriority(HIDWORD(v20), nPriority);
5763 nPriority = v21;
5764 *(__int64 *)((char *)&v20 + 4) = __PAIR__(v18, v21) - __PAIR__(v16, v17);
5765 Dst = HIDWORD(v20);
5766 v10 = HIDWORD(v20) / 0xF4240;
5767 v14 = HIDWORD(v20) / 0xF4240;
5768 if ( HIDWORD(v20) / 0x186A0 - 10 * HIDWORD(v20) / 0xF4240 >= 6 )
5769 ++v10;
5770 v15 = v10;
5771 result = a1;
5772 v13 = 1000000 * v6 - 1000000 * v20;
5773 a1->x = Dst;
5774 a1->y = v13;
5775 a1->z = v14;
5776 a1->w = v15;
5777 return result;*/
5778 }
5779 5459
5780 5460
5781 5461
5782 //----- (004AD504) -------------------------------------------------------- 5462 //----- (004AD504) --------------------------------------------------------
5783 int __fastcall sub_4AD504(signed int sFaceID) 5463 int __fastcall sub_4AD504(signed int sFaceID)