//
// sub_180075A70 from 0x180075a70 to 0x180075de5 (885 bytes)
//
// 2 xrefs:
// > cocos2d::CCApplication::updateVerticalSync @ 0x18007780d
// > ??> @ 0x1801be7dc
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:21:58 +0000
//
// Hidden C++ exception states: #wind=1
double __fastcall sub_180075A70(wchar_t *String2)
{
int v2; // esi
size_t v3; // rdi
DISPLAYCONFIG_PATH_INFO *v4; // rbx
__int64 v5; // rax
DISPLAYCONFIG_PATH_INFO *v6; // r12
__int64 v7; // r14
DISPLAYCONFIG_MODE_INFO *modeInfoArray; // rdi
char *v9; // r15
unsigned __int64 v10; // rsi
__int64 v11; // rax
__int64 modeInfoIdx; // rax
__int64 v13; // rax
int v14; // ecx
int Denominator; // ecx
double v16; // xmm6_8
DISPLAYCONFIG_PATH_INFO *v17; // rax
UINT32 numPathArrayElements; // [rsp+38h] [rbp-69h] BYREF
UINT32 numModeInfoArrayElements; // [rsp+3Ch] [rbp-65h] BYREF
__int128 v21; // [rsp+40h] [rbp-61h]
DISPLAYCONFIG_PATH_INFO *v22; // [rsp+50h] [rbp-51h]
_QWORD requestPacket[9]; // [rsp+58h] [rbp-49h] BYREF
__int64 v24; // [rsp+A0h] [rbp-1h]
int v25; // [rsp+A8h] [rbp+7h]
v2 = 0;
numPathArrayElements = 0;
numModeInfoArrayElements = 0;
if ( GetDisplayConfigBufferSizes(2u, &numPathArrayElements, &numModeInfoArrayElements) || !numPathArrayElements )
return 0.0;
v21 = 0;
v22 = nullptr;
v3 = 72LL * numPathArrayElements;
if ( v3 )
{
if ( v3 < 0x1000 )
{
v4 = (DISPLAYCONFIG_PATH_INFO *)sub_1800E4AC0(72LL * numPathArrayElements);
}
else
{
if ( v3 + 39 < v3 )
Concurrency::cancel_current_task();
v5 = sub_1800E4AC0(v3 + 39);
if ( !v5 )
LABEL_36:
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
v4 = (DISPLAYCONFIG_PATH_INFO *)((v5 + 39) & 0xFFFFFFFFFFFFFFE0uLL);
*(_QWORD *)&v4[-1].targetInfo.statusFlags = v5;
}
}
else
{
v4 = nullptr;
}
*(_QWORD *)&v21 = v4;
v6 = &v4[v3 / 0x48];
v22 = &v4[v3 / 0x48];
memset(v4, 0, v3);
*((_QWORD *)&v21 + 1) = &v4[v3 / 0x48];
v7 = numModeInfoArrayElements;
modeInfoArray = nullptr;
v9 = nullptr;
if ( numModeInfoArrayElements )
{
v10 = (unsigned __int64)numModeInfoArrayElements << 6;
if ( v10 )
{
if ( v10 < 0x1000 )
{
modeInfoArray = (DISPLAYCONFIG_MODE_INFO *)sub_1800E4AC0((unsigned __int64)numModeInfoArrayElements << 6);
}
else
{
if ( v10 + 39 < v10 )
Concurrency::cancel_current_task();
v11 = sub_1800E4AC0(v10 + 39);
if ( !v11 )
goto LABEL_39;
modeInfoArray = (DISPLAYCONFIG_MODE_INFO *)((v11 + 39) & 0xFFFFFFFFFFFFFFE0uLL);
*((_QWORD *)&modeInfoArray[-1].desktopImageInfo + 5) = v11;
}
}
v9 = (char *)modeInfoArray + v10;
memset(modeInfoArray, 0, v7 << 6);
v2 = 0;
}
if ( QueryDisplayConfig(2u, &numPathArrayElements, v4, &numModeInfoArrayElements, modeInfoArray, nullptr)
|| !numPathArrayElements )
{
LABEL_27:
v16 = 0.0;
}
else
{
while ( 1 )
{
memset(&requestPacket[1], 0, 64);
v24 = 0;
v25 = 0;
requestPacket[0] = 0x5400000001LL;
requestPacket[1] = v4[v2].sourceInfo.adapterId;
LODWORD(requestPacket[2]) = v4[v2].sourceInfo.id;
if ( !DisplayConfigGetDeviceInfo((DISPLAYCONFIG_DEVICE_INFO_HEADER *)requestPacket)
&& !wcscmp((const wchar_t *)&requestPacket[2] + 2, String2) )
{
modeInfoIdx = v4[v2].targetInfo.modeInfoIdx;
if ( (unsigned int)modeInfoIdx < numModeInfoArrayElements )
{
v13 = modeInfoIdx << 6;
if ( *(DISPLAYCONFIG_MODE_INFO_TYPE *)((char *)&modeInfoArray->infoType + v13) == DISPLAYCONFIG_MODE_INFO_TYPE_TARGET )
{
v14 = *(LONG *)((char *)&modeInfoArray->desktopImageInfo.DesktopImageRegion.bottom + v13);
if ( v14 )
{
v16 = (double)*(int *)((char *)&modeInfoArray->sourceMode.position.y + v13) / (double)v14;
goto LABEL_28;
}
}
}
Denominator = v4[v2].targetInfo.refreshRate.Denominator;
if ( Denominator )
break;
}
if ( ++v2 >= numPathArrayElements )
goto LABEL_27;
}
v16 = (double)(int)v4[v2].targetInfo.refreshRate.Numerator / (double)Denominator;
}
LABEL_28:
if ( !modeInfoArray )
goto LABEL_33;
if ( ((v9 - (char *)modeInfoArray) & 0xFFFFFFFFFFFFFFC0uLL) >= 0x1000 )
{
if ( (unsigned __int64)modeInfoArray - *((_QWORD *)&modeInfoArray[-1].desktopImageInfo + 5) - 8 <= 0x1F )
{
modeInfoArray = *((DISPLAYCONFIG_MODE_INFO **)&modeInfoArray[-1].desktopImageInfo + 5);
goto LABEL_32;
}
LABEL_39:
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
LABEL_32:
j_j_free_0(modeInfoArray);
LABEL_33:
if ( v4 )
{
v17 = v4;
if ( (unsigned __int64)(72 * (v6 - v4)) >= 0x1000 )
{
v4 = *(DISPLAYCONFIG_PATH_INFO **)&v4[-1].targetInfo.statusFlags;
if ( (unsigned __int64)((char *)v17 - (char *)v4 - 8) > 0x1F )
goto LABEL_36;
}
j_j_free_0(v4);
}
return v16;
}