Mercurial > mm7
diff 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 |
line wrap: on
line diff
--- a/mm7_4.cpp Fri Mar 22 10:52:19 2013 +0200 +++ b/mm7_4.cpp Fri Mar 22 11:18:51 2013 +0200 @@ -2575,6 +2575,7 @@ float v26; // [sp+50h] [bp-8h]@3 float v27; // [sp+54h] [bp-4h]@3 + __debugbreak(); v22 = 0; v1 = this->pMemBlocks[1]->pAlignedBlock; v2 = this->pMemBlocks[6]->pAlignedBlock; @@ -5455,327 +5456,6 @@ -//----- (004AC1C9) -------------------------------------------------------- -int __thiscall sub_4AC1C9(unsigned int _this, Vec4_int_ *a2) -{ - unsigned int v2; // esi@1 - __int16 v3; // di@1 - signed int v4; // ebx@1 - int v5; // ecx@3 - Vec4_int_ *v6; // eax@10 - Vec4_int_ *v7; // esi@14 - int result; // eax@16 - char *v9; // esi@16 - Vec4_int_ a1; // [sp+Ch] [bp-34h]@10 - Vec4_int_ v11; // [sp+1Ch] [bp-24h]@14 - Vec4_int_ Dst; // [sp+2Ch] [bp-14h]@1 - int v13; // [sp+3Ch] [bp-4h]@1 - - v2 = _this; - v3 = sub_4382BC(_this); - v13 = sub_4383ED(); - v4 = 0; - memset(&Dst, 0, 0x10u); - if ( v3 < 0 ) - goto LABEL_19; - if ( (signed int)v2 > 0 ) - { - if ( (signed int)v2 > 150 ) - { - v5 = (int)a2; - } - else - { - v5 = 4000 * v2; - v4 = 1; - } - } - else - { - v5 = 4000 * dword_4F031C[(unsigned __int16)v3]; - } - if ( v13 & 0x10 && !v4 ) - { - if ( v2 ) - v6 = sub_4AC4FD_get_cpu_clocks_rdtsc(v5, &a1); - else - v6 = sub_4AC33A_get_cpu_clocks_QPC(v5, &a1); - goto LABEL_14; - } - if ( (unsigned __int16)v3 < 3u ) - { -LABEL_19: - v7 = &Dst; - goto LABEL_16; - } - v6 = sub_4AC277(v5, &a1); -LABEL_14: - v11.x = v6->x; - v11.y = v6->y; - v11.z = v6->z; - v11.w = v6->w; - v7 = &v11; -LABEL_16: - result = (int)a2; - a2->x = v7->x; - v9 = (char *)&v7->y; - a2->y = *(int *)v9; - v9 += 4; - a2->z = *(int *)v9; - a2->w = *((int *)v9 + 1); - return result; -} -// 4F031C: using guessed type int dword_4F031C[]; - -//----- (004AC277) -------------------------------------------------------- -Vec4_int_ *__thiscall sub_4AC277(unsigned int _this, Vec4_int_ *a2) -{ - __debugbreak(); - return 0; - /*signed int v2; // esi@1 - signed __int16 v4; // bx@3 - int v10; // esi@8 - int v11; // eax@10 - Vec4_int_ *result; // eax@13 - Vec4_int_ Dst; // [sp+8h] [bp-30h]@1 - LARGE_INTEGER Frequency; // [sp+18h] [bp-20h]@1 - LARGE_INTEGER PerformanceCount; // [sp+20h] [bp-18h]@3 - LARGE_INTEGER v16; // [sp+28h] [bp-10h]@5 - int v17; // [sp+30h] [bp-8h]@1 - int v18; // [sp+34h] [bp-4h]@2 - - v17 = _this; - v2 = -1; - memset(&Dst, 0, 0x10u); - if ( QueryPerformanceFrequency(&Frequency) ) - { - v18 = 10; - do - { - QueryPerformanceCounter(&PerformanceCount); - _EAX = -2147483648; - v4 = 4000; - do - { - __asm { bsf ecx, eax } - --v4; - } - while ( v4 ); - QueryPerformanceCounter(&v16); - if ( (signed int)v16.s.LowPart - (signed int)PerformanceCount.s.LowPart < (unsigned int)v2 ) - v2 = v16.s.LowPart - PerformanceCount.s.LowPart; - --v18; - } - while ( v18 ); - v10 = 100000 * v2 / (Frequency.s.LowPart / 0xA); - if ( v10 % Frequency.s.LowPart > Frequency.s.LowPart >> 1 ) - ++v10; - v11 = v17 / (unsigned int)v10; - Dst.z = v17 / (unsigned int)v10; - if ( v17 % (unsigned int)v10 > (unsigned int)v10 >> 1 ) - ++v11; - Dst.x = v17; - Dst.y = v10; - Dst.w = v11; - } - result = a2; - a2->x = Dst.x; - a2->y = Dst.y; - a2->z = Dst.z; - a2->w = Dst.w; - return result;*/ -} - -//----- (004AC33A) -------------------------------------------------------- -Vec4_int_ *__thiscall sub_4AC33A_get_cpu_clocks_QPC(int _this, Vec4_int_ *a1) -{ - __debugbreak(); - return 0; - /*int v2; // esi@1 - int v3; // ebx@1 - unsigned __int64 v4; // qax@4 - unsigned __int64 v5; // qax@7 - DWORD v6; // edi@7 - DWORD v7; // eax@7 - unsigned int v8; // ecx@10 - unsigned __int64 v9; // qax@10 - unsigned int v10; // edi@10 - int v11; // eax@14 - unsigned int v12; // ecx@19 - Vec4_int_ *result; // eax@24 - int Dst; // [sp+Ch] [bp-4Ch]@1 - int v15; // [sp+10h] [bp-48h]@23 - int v16; // [sp+14h] [bp-44h]@21 - int v17; // [sp+18h] [bp-40h]@21 - LARGE_INTEGER Frequency; // [sp+1Ch] [bp-3Ch]@1 - LARGE_INTEGER PerformanceCount; // [sp+24h] [bp-34h]@2 - LARGE_INTEGER v20; // [sp+2Ch] [bp-2Ch]@2 - int v21; // [sp+34h] [bp-24h]@2 - int v22; // [sp+38h] [bp-20h]@2 - int v23; // [sp+3Ch] [bp-1Ch]@4 - int v24; // [sp+40h] [bp-18h]@7 - int nPriority; // [sp+44h] [bp-14h]@2 - unsigned int v26; // [sp+48h] [bp-10h]@1 - unsigned int v27; // [sp+4Ch] [bp-Ch]@1 - HANDLE hThread; // [sp+50h] [bp-8h]@1 - int v29; // [sp+54h] [bp-4h]@1 - - v2 = 0; - v3 = 0; - v29 = 0; - v27 = 0; - v26 = 0; - hThread = GetCurrentThread(); - memset(&Dst, 0, 0x10u); - if ( QueryPerformanceFrequency(&Frequency) ) - { - do - { - ++v29; - v22 = v2; - v21 = v3; - QueryPerformanceCounter(&PerformanceCount); - v20 = PerformanceCount; - nPriority = GetThreadPriority(hThread); - if ( nPriority != 2147483647 ) - SetThreadPriority(hThread, 15); - while ( v20.s.LowPart - PerformanceCount.s.LowPart < 0x32 ) - { - QueryPerformanceCounter(&v20); - v4 = __rdtsc(); - v23 = v4; - } - PerformanceCount = v20; - do - { - QueryPerformanceCounter(&v20); - v5 = __rdtsc(); - v24 = v5; - v6 = v20.s.LowPart; - v7 = PerformanceCount.s.LowPart; - } - while ( v20.s.LowPart - PerformanceCount.s.LowPart < 0x3E8 ); - if ( nPriority != 2147483647 ) - { - SetThreadPriority(hThread, nPriority); - v7 = PerformanceCount.s.LowPart; - v6 = v20.s.LowPart; - } - v8 = v24 - v23; - v27 += v24 - v23; - v9 = (100000 * v6 - 100000 * v7) / (Frequency.s.LowPart / 0xA); - v10 = v9; - v26 += v9; - if ( v9 % Frequency.s.LowPart > Frequency.s.LowPart >> 1 ) - v10 = v9 + 1; - v3 = v8 / v10; - if ( v8 % v10 > v10 >> 1 ) - v3 = v8 / v10 + 1; - v2 = v21; - v11 = v3 + v22 + v21; - } - while ( v29 < 3 - || v29 < 20 - && ((unsigned int)(3 * v3 - v11) > 3 || (unsigned int)(3 * v21 - v11) > 3 || (unsigned int)(3 * v22 - v11) > 3) ); - v12 = 10 * v27 / v26; - if ( 100 * v27 / v26 - 10 * v12 >= 6 ) - ++v12; - v16 = v27 / v26; - v17 = v27 / v26; - if ( v12 - 10 * v27 / v26 >= 6 ) - v17 = v27 / v26 + 1; - v15 = v26; - Dst = v27; - } - result = a1; - a1->x = Dst; - a1->y = v15; - a1->z = v16; - a1->w = v17; - return result;*/ -} - -//----- (004AC4FD) -------------------------------------------------------- -Vec4_int_ *__thiscall sub_4AC4FD_get_cpu_clocks_rdtsc(int _this, Vec4_int_ *a1) -{ - __debugbreak(); - return 0; - /*int v2; // eax@1 - int v3; // eax@4 - bool v4; // eax@5 - unsigned __int64 v5; // kr00_8@8 - int v6; // edi@9 - int v7; // eax@9 - bool v8; // eax@10 - unsigned __int64 v9; // kr08_8@13 - unsigned int v10; // eax@15 - Vec4_int_ *result; // eax@17 - int Dst; // [sp+Ch] [bp-2Ch]@1 - int v13; // [sp+10h] [bp-28h]@17 - int v14; // [sp+14h] [bp-24h]@15 - int v15; // [sp+18h] [bp-20h]@17 - unsigned int v16; // [sp+1Ch] [bp-1Ch]@8 - unsigned int v17; // [sp+20h] [bp-18h]@8 - unsigned int v18; // [sp+24h] [bp-14h]@13 - int nPriority; // [sp+28h] [bp-10h]@1 - __int64 v20; // [sp+2Ch] [bp-Ch]@1 - int v21; // [sp+34h] [bp-4h]@3 - - HIDWORD(v20) = GetCurrentThread(); - memset(&Dst, 0, 0x10u); - v2 = GetThreadPriority(HIDWORD(v20)); - nPriority = v2; - if ( v2 != 0x7FFFFFFF ) - SetThreadPriority(HIDWORD(v20), v2 + 1); - __outbyte(0x70u, 0); - v21 = __inbyte(0x71u); - do - { - __outbyte(0x70u, 0); - LODWORD(v20) = __inbyte(0x71u); - v3 = v20 - v21; - if ( (signed int)v20 >= v21 ) - v4 = v3 > 0; - else - v4 = v3 + 10; - } - while ( !v4 ); - v5 = __rdtsc(); - v16 = HIDWORD(v5); - v17 = v5; - do - { - __outbyte(0x70u, 0); - v21 = __inbyte(0x71u); - v6 = v21; - v7 = v21 - v20; - if ( v21 >= (signed int)v20 ) - v8 = v7 > 0; - else - v8 = v7 + 10; - } - while ( !v8 ); - v9 = __rdtsc(); - v18 = HIDWORD(v9); - v21 = v9; - if ( nPriority != 0x7FFFFFFF ) - SetThreadPriority(HIDWORD(v20), nPriority); - nPriority = v21; - *(__int64 *)((char *)&v20 + 4) = __PAIR__(v18, v21) - __PAIR__(v16, v17); - Dst = HIDWORD(v20); - v10 = HIDWORD(v20) / 0xF4240; - v14 = HIDWORD(v20) / 0xF4240; - if ( HIDWORD(v20) / 0x186A0 - 10 * HIDWORD(v20) / 0xF4240 >= 6 ) - ++v10; - v15 = v10; - result = a1; - v13 = 1000000 * v6 - 1000000 * v20; - a1->x = Dst; - a1->y = v13; - a1->z = v14; - a1->w = v15; - return result;*/ -}