// // cocos2d::CCApplication::run from 0x180073390 to 0x1800738eb (1371 bytes) // // 5 xrefs: // > @ 0x1801006f0 // > @ 0x18013afbc // > @ 0x18013b018 // > @ 0x1801438a8 // > @ 0x1801b4440 // // This function is hookable on this platform! // // Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings // __int64 __fastcall cocos2d::CCApplication::run(cocos2d::CCApplication *this) { LSTATUS Value; // eax __int64 v3; // rcx __int16 v4; // ax cocos2d::CCDirector *v5; // rdi HKEY m_pobOpenGLView; // rsi char v8; // r13 _BYTE *v9; // rdi float v10; // xmm7_4 signed __int64 m_capacity; // r12 char v12; // si LARGE_INTEGER v13; // rax __int64 v14; // rdx __int64 v15; // rdx double LowPart; // xmm0_8 float v17; // xmm6_4 float v18; // xmm8_4 float v19; // xmm0_4 int v20; // eax cocos2d::CCDirector *v21; // rax struct cocos2d::CCDirector *v22; // rax HKEY hKey; // [rsp+50h] [rbp-B0h] BYREF LARGE_INTEGER v24; // [rsp+58h] [rbp-A8h] BYREF DWORD cbData[2]; // [rsp+60h] [rbp-A0h] BYREF LARGE_INTEGER PerformanceCount; // [rsp+68h] [rbp-98h] BYREF LARGE_INTEGER Frequency; // [rsp+70h] [rbp-90h] BYREF BYTE Data[512]; // [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) ) { goto LABEL_10; } memset(Data, 0, sizeof(Data)); cbData[0] = 512; Value = RegQueryValueExW(hKey, L"hide_gui", nullptr, nullptr, Data, cbData); if ( Value == 2 ) goto LABEL_8; if ( !Value ) { v3 = 0; while ( 1 ) { v4 = *(_WORD *)&::Data[2 * v3++]; if ( v4 != *(_WORD *)&Data[2 * v3 - 2] ) break; if ( v3 == 4 ) goto LABEL_9; } LABEL_8: cbData[0] = 8; RegSetValueExW(hKey, L"hide_gui", 0, 1u, L"YES", 8u); } LABEL_9: RegCloseKey(hKey); LABEL_10: QueryPerformanceFrequency(&Frequency); ((void (__fastcall *)(cocos2d::CCApplication *))this->__vftable[1].applicationDidFinishLaunching)(this); v5 = cocos2d::CCDirector::sharedDirector(); *(_QWORD *)cbData = v5; m_pobOpenGLView = (HKEY)cocos2d::CCDirector::sharedDirector()->m_pobOpenGLView; hKey = m_pobOpenGLView; cocos2d::CCObject::retain((cocos2d::CCObject *)(m_pobOpenGLView + 30)); cocos2d::CCApplication::setupVerticalSync(this); cocos2d::CCApplication::updateVerticalSync(this); if ( !((unsigned __int8 (__fastcall *)(cocos2d::CCApplication *))this->applicationDidFinishLaunching)(this) ) return 0; v8 = *((_BYTE *)m_pobOpenGLView + 232); *((_BYTE *)this + 201) = v8; QueryPerformanceCounter(&PerformanceCount); qword_1801A84D8 = PerformanceCount.QuadPart; if ( cocos2d::CCEGLView::windowShouldClose((cocos2d::CCEGLView *)m_pobOpenGLView) ) goto LABEL_44; v9 = (char *)this + 199; do { if ( *((_BYTE *)this + 201) != v8 ) { cocos2d::CCApplication::updateVerticalSync(this); *v9 = 0; } v8 = *((_BYTE *)this + 201); if ( *((_BYTE *)this + 196) ) { v10 = *((float *)this + 48); m_capacity = this->m_resourceRootPath.m_data.m_capacity; } else { v10 = *((float *)this + 47); m_capacity = this->m_resourceRootPath.m_data.m_size; } if ( v8 || *v9 ) { v12 = 0; v9 = (char *)this + 199; QueryPerformanceCounter(&v24); v13 = v24; qword_1801A84D8 = v24.QuadPart; if ( v24.QuadPart - PerformanceCount.QuadPart < m_capacity ) { m_pobOpenGLView = hKey; continue; } } else { v12 = 1; QueryPerformanceCounter(&v24); v13 = v24; qword_1801A84D8 = v24.QuadPart; } if ( *((_BYTE *)this + 120) ) { sub_18007E560(*((_QWORD *)this + 13)); sub_18007E560(*((_QWORD *)this + 14)); v13 = v24; *((_BYTE *)this + 120) = 0; } v14 = *((_QWORD *)this + 13); if ( *(_BYTE *)(v14 + 20) || *(_BYTE *)(*((_QWORD *)this + 14) + 20LL) ) { *((_BYTE *)this + 197) = 1; if ( *(_BYTE *)(v14 + 20) ) { cocos2d::CCApplication::updateControllerKeys(this, (struct CXBOXController *)v14, 1); v13 = v24; } v15 = *((_QWORD *)this + 14); if ( *(_BYTE *)(v15 + 20) ) { cocos2d::CCApplication::updateControllerKeys(this, (struct CXBOXController *)v15, 2); v13 = v24; } } else { *((_BYTE *)this + 197) = 0; } LowPart = (double)(int)PerformanceCount.LowPart; PerformanceCount = v13; v17 = ((double)(int)v13.LowPart - LowPart) / (double)(int)m_capacity * v10; v18 = v17; if ( v12 ) { v19 = v17 + *(float *)&dword_1801A84D0; v20 = ++dword_1801A84D4; *(float *)&dword_1801A84D0 = v17 + *(float *)&dword_1801A84D0; if ( *(float *)&dword_1801A84D0 > 0.5 ) { dword_1801A84D0 = 0; dword_1801A84D4 = 0; if ( (float)((float)v20 / v19) > (float)((float)(1.0 / v10) * 1.2) ) *((_BYTE *)this + 199) = 1; } } if ( *((_BYTE *)this + 200) && cocos2d::CCDirector::sharedDirector()->m_bSmoothFixCheck && (float)(v10 * 0.1) >= fabs(v17 - v10) ) { v17 = v10; } m_pobOpenGLView = hKey; cocos2d::CCEGLView::pollEvents((cocos2d::CCEGLView *)hKey); cocos2d::CCEGLView::pumpRawInput((cocos2d::CCEGLView *)m_pobOpenGLView); v21 = cocos2d::CCDirector::sharedDirector(); cocos2d::CCDirector::setDeltaTime(v21, v17); cocos2d::CCDirector::sharedDirector()->m_fActualDeltaTime = v18; v22 = cocos2d::CCDirector::sharedDirector(); ((void (__fastcall *)(struct cocos2d::CCDirector *))v22->mainLoop)(v22); } while ( !cocos2d::CCEGLView::windowShouldClose((cocos2d::CCEGLView *)m_pobOpenGLView) ); v5 = *(cocos2d::CCDirector **)cbData; LABEL_44: if ( !*((_BYTE *)this + 121) ) ((void (__fastcall *)(struct cocos2d::CCApplication *, _QWORD))cocos2d::CCApplication::sm_pSharedApplication->trySaveGame)( cocos2d::CCApplication::sm_pSharedApplication, 0); if ( (*(unsigned __int8 (__fastcall **)(HKEY))(*(_QWORD *)m_pobOpenGLView + 16LL))(m_pobOpenGLView) ) { cocos2d::CCDirector::end(v5); ((void (__fastcall *)(cocos2d::CCDirector *))v5->mainLoop)(v5); } cocos2d::CCObject::release((cocos2d::CCObject *)(m_pobOpenGLView + 30)); ((void (__fastcall *)(struct cocos2d::CCApplication *))cocos2d::CCApplication::sm_pSharedApplication->__vftable[1].applicationDidEnterBackground)(cocos2d::CCApplication::sm_pSharedApplication); return 1; }