//
// GameLevelManager::getCompletedLevels from 0x706218 to 0x7063d8 (448 bytes)
//
// 3 xrefs:
// > GameLevelManager::getOnlineLevels @ 0x72be04
// > GameLevelManager::submitUserInfo @ 0x72c9e8
// > ??> @ 0x4e168
//
// 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
//
cocos2d::CCArray *GameLevelManager::getCompletedLevels(GameLevelManager *a1, bool a2)
{
_BOOL4 v3; // w25
unsigned int v4; // w19
cocos2d::CCArray *v5; // x26
cocos2d::CCArray *v6; // x20
int v7; // w0
cocos2d::CCString *v8; // x0
char *CString; // x0
cocos2d::CCDictionary *m_onlineLevels; // x27
GJGameLevel *v11; // x27
char *v12; // x0
unsigned int *v14; // x1
int v15; // w3
std::string v16; // [xsp+80h] [xbp+80h] BYREF
v3 = a2;
v4 = 0;
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create(_stack_chk_guard);
v6 = cocos2d::CCDictionary::allKeys(a1->m_onlineLevels);
if ( (unsigned int)cocos2d::CCArray::count(v6) )
{
do
{
v7 = cocos2d::CCArray::count(v6);
v8 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v6, v7 + ~v4);
CString = (char *)cocos2d::CCString::getCString(v8);
m_onlineLevels = a1->m_onlineLevels;
sub_D153B8((int)&v16, CString);
v11 = (GJGameLevel *)cocos2d::CCDictionary::objectForKey(m_onlineLevels, &v16);
v12 = (char *)v16.m_data.m_data - 24;
if ( (__int64 *)v16.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)((char *)v16.m_data.m_data - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *((_DWORD *)v16.m_data.m_data - 2);
*((_DWORD *)v16.m_data.m_data - 2) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v12);
}
if ( v3 )
{
if ( v11->m_orbCompletion.random - v11->m_orbCompletion.seed > 99 )
goto LABEL_9;
}
else if ( GJGameLevel::getNormalPercent(v11) > 99 )
{
LABEL_9:
++v4;
cocos2d::CCArray::addObject(v5, v11);
continue;
}
++v4;
}
while ( v4 < (unsigned int)cocos2d::CCArray::count(v6) );
}
return v5;
}