//
// cocos2d::CCApplication::run from 0x180075e30 to 0x18007639f (1391 bytes)
//
// 5 xrefs:
// > ??> @ 0x180106d60
// > ??> @ 0x18014436c
// > ??> @ 0x1801443c4
// > ??> @ 0x18014cf68
// > ??> @ 0x1801be7e8
//
// 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
//
__int64 __fastcall cocos2d::CCApplication::run(cocos2d::CCApplication *this)
{
LSTATUS v2; // eax
cocos2d::CCDirector *v3; // r13
_BYTE *v4; // r15
char v6; // r12
__int64 v7; // rdx
_BYTE *v8; // rsi
unsigned __int32 v9; // xmm9_4
LONGLONG v10; // rdi
LONGLONG v11; // rax
float v12; // xmm6_4
char v13; // r14
bool v14; // al
float *v15; // rax
float *v16; // rax
__int64 v17; // rdx
__int64 v18; // rdx
double LowPart; // xmm0_8
float v20; // xmm7_4
float v21; // xmm8_4
float v22; // xmm0_4
int v23; // eax
cocos2d::CCDirector *v24; // rax
struct cocos2d::CCDirector *v25; // rax
HKEY hKey; // [rsp+50h] [rbp-B0h] BYREF
LARGE_INTEGER v27; // [rsp+58h] [rbp-A8h] BYREF
LARGE_INTEGER PerformanceCount; // [rsp+60h] [rbp-A0h] BYREF
DWORD cbData; // [rsp+68h] [rbp-98h] BYREF
LARGE_INTEGER Frequency; // [rsp+70h] [rbp-90h] BYREF
float v31; // [rsp+78h] [rbp-88h] BYREF
wchar_t Data[256]; // [rsp+80h] [rbp-80h] BYREF
hKey = nullptr;
if ( !RegCreateKeyExW(
HKEY_CURRENT_USER,
L"Software\\Imagination Technologies\\PVRVFRame\\STARTUP\\",
0,
nullptr,
0,
0xF003Fu,
nullptr,
&hKey,
nullptr) )
{
memset(Data, 0, sizeof(Data));
cbData = 512;
v2 = RegQueryValueExW(hKey, L"hide_gui", nullptr, nullptr, (LPBYTE)Data, &cbData);
if ( v2 == 2 || !v2 && wcscmp(L"YES", Data) )
{
cbData = 8;
RegSetValueExW(hKey, L"hide_gui", 0, 1u, (const BYTE *)L"YES", 8u);
}
RegCloseKey(hKey);
}
QueryPerformanceFrequency(&Frequency);
(*(void (__fastcall **)(cocos2d::CCApplication *))(*(_QWORD *)this + 112LL))(this);
v3 = cocos2d::CCDirector::sharedDirector();
v4 = *((_BYTE **)cocos2d::CCDirector::sharedDirector() + 24);
cocos2d::CCObject::retain((cocos2d::CCObject *)(v4 + 120));
cocos2d::CCApplication::setupVerticalSync(this);
cocos2d::CCApplication::updateVerticalSync(this);
if ( !(*(unsigned __int8 (__fastcall **)(cocos2d::CCApplication *))(*(_QWORD *)this + 8LL))(this) )
return 0;
v6 = v4[232];
*((_BYTE *)this + 213) = v6;
QueryPerformanceCounter(&PerformanceCount);
qword_1801B2518 = PerformanceCount.QuadPart;
if ( !cocos2d::CCEGLView::windowShouldClose((cocos2d::CCEGLView *)v4) )
{
v8 = (char *)this + 211;
v9 = _mm_load_si128((const __m128i *)&xmmword_1800EC5C0).m128i_u32[0];
do
{
if ( *((_BYTE *)this + 213) != v6 )
{
cocos2d::CCApplication::updateVerticalSync(this);
*v8 = 0;
}
v6 = *((_BYTE *)this + 213);
if ( *((_BYTE *)this + 208) )
{
v10 = *((_QWORD *)this + 4);
v11 = v10;
v12 = *((float *)this + 48);
if ( !v6 && !*v8 )
{
v13 = 1;
QueryPerformanceCounter(&v27);
qword_1801B2518 = v27.QuadPart;
LABEL_19:
if ( *((_BYTE *)this + 120) )
{
sub_180081540(*((_QWORD *)this + 13));
sub_180081540(*((_QWORD *)this + 14));
*((_BYTE *)this + 120) = 0;
}
v14 = *(_BYTE *)(*((_QWORD *)this + 13) + 20LL) || *(_BYTE *)(*((_QWORD *)this + 14) + 20LL);
*((_BYTE *)this + 209) = v14;
v15 = kmVec2Fill((float *)&cbData, 0.0, 0.0);
cocos2d::CCSize::operator=((_DWORD *)this + 42, v15);
v16 = kmVec2Fill(&v31, 0.0, 0.0);
cocos2d::CCSize::operator=((_DWORD *)this + 44, v16);
if ( *((_BYTE *)this + 209) )
{
v17 = *((_QWORD *)this + 13);
if ( *(_BYTE *)(v17 + 20) )
cocos2d::CCApplication::updateControllerKeys(this, (struct CXBOXController *)v17, 1);
v18 = *((_QWORD *)this + 14);
if ( *(_BYTE *)(v18 + 20) )
cocos2d::CCApplication::updateControllerKeys(this, (struct CXBOXController *)v18, 2);
}
LowPart = (double)(int)PerformanceCount.LowPart;
PerformanceCount = v27;
v20 = ((double)(int)v27.LowPart - LowPart) / (double)(int)v10 * v12;
v21 = v20;
if ( v13 )
{
v22 = v20 + *(float *)&dword_1801B2510;
v23 = ++dword_1801B2514;
*(float *)&dword_1801B2510 = v20 + *(float *)&dword_1801B2510;
if ( *(float *)&dword_1801B2510 > 0.5 )
{
dword_1801B2510 = 0;
dword_1801B2514 = 0;
if ( (float)((float)v23 / v22) > (float)((float)(1.0 / v12) * 1.2) )
*((_BYTE *)this + 211) = 1;
}
}
if ( *((_BYTE *)this + 212)
&& *((_BYTE *)cocos2d::CCDirector::sharedDirector() + 178)
&& (float)(v12 * 0.1) >= COERCE_FLOAT(COERCE_UNSIGNED_INT(v20 - v12) & v9) )
{
v20 = v12;
}
cocos2d::CCEGLView::pollEvents((cocos2d::CCEGLView *)v4);
cocos2d::CCEGLView::pumpRawInput((cocos2d::CCEGLView *)v4);
v24 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::setDeltaTime(v24, v20);
*((float *)cocos2d::CCDirector::sharedDirector() + 43) = v21;
v25 = cocos2d::CCDirector::sharedDirector();
(*(void (__fastcall **)(struct cocos2d::CCDirector *))(*(_QWORD *)v25 + 104LL))(v25);
continue;
}
}
else
{
v11 = *((_QWORD *)this + 3);
v12 = *((float *)this + 47);
}
v10 = v11;
v13 = 0;
QueryPerformanceCounter(&v27);
v8 = (char *)this + 211;
qword_1801B2518 = v27.QuadPart;
if ( v27.QuadPart - PerformanceCount.QuadPart >= v10 )
goto LABEL_19;
}
while ( !cocos2d::CCEGLView::windowShouldClose((cocos2d::CCEGLView *)v4) );
}
if ( !*((_BYTE *)this + 121) )
{
LOBYTE(v7) = 1;
(*(void (__fastcall **)(struct cocos2d::CCApplication *, __int64))(*(_QWORD *)cocos2d::CCApplication::sm_pSharedApplication
+ 56LL))(
cocos2d::CCApplication::sm_pSharedApplication,
v7);
}
if ( (*(unsigned __int8 (__fastcall **)(_BYTE *))(*(_QWORD *)v4 + 16LL))(v4) )
{
cocos2d::CCDirector::end(v3);
(*(void (__fastcall **)(cocos2d::CCDirector *))(*(_QWORD *)v3 + 104LL))(v3);
}
cocos2d::CCObject::release((cocos2d::CCObject *)(v4 + 120));
(*(void (__fastcall **)(struct cocos2d::CCApplication *))(*(_QWORD *)cocos2d::CCApplication::sm_pSharedApplication
+ 120LL))(cocos2d::CCApplication::sm_pSharedApplication);
return 1;
}