//
// GameLevelManager::getCompletedEventLevels from 0x706818 to 0x706a48 (560 bytes)
//
// 3 xrefs:
// > GameLevelManager::updateUserScore @ 0x737640
// > GameLevelManager::updateUserScore @ 0x737790
// > ??> @ 0x8eb78
//
// 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
//
int GameLevelManager::getCompletedEventLevels(GameLevelManager *a1, int a2, int a3)
{
cocos2d::CCArray *v6; // x0
cocos2d::ccArray *data; // x1
cocos2d::CCString **arr; // x19
__int64 v9; // x0
char *v10; // x20
cocos2d::CCString *v11; // x28
cocos2d::CCString *v12; // x0
cocos2d::CCDictionary *m_dailyLevels; // x28
char *CString; // x0
const void *v15; // x0
GJGameLevel *v16; // x28
char *v17; // x0
int v18; // w0
GameStatsManager *v19; // x0
bool v20; // zf
int v21; // w0
unsigned int *v23; // x1
int v24; // w3
int v25; // [xsp+6Ch] [xbp+6Ch]
std::string v26; // [xsp+80h] [xbp+80h] BYREF
v6 = cocos2d::CCDictionary::allKeys(a1->m_dailyLevels);
if ( !v6 )
return 0;
data = v6->data;
if ( !data->num )
return 0;
arr = (cocos2d::CCString **)data->arr;
v9 = 8LL * data->num - 8;
v10 = (char *)arr + v9;
if ( arr > (cocos2d::CCString **)((char *)arr + v9) )
return 0;
v11 = *arr;
v25 = 0;
if ( *arr )
{
if ( cocos2d::CCString::intValue(v11) > 200000 )
goto LABEL_9;
while ( v10 >= (char *)++arr )
{
v11 = *arr;
if ( !*arr )
break;
if ( cocos2d::CCString::intValue(*arr) > 200000 )
{
LABEL_9:
v12 = v11;
m_dailyLevels = a1->m_dailyLevels;
CString = (char *)cocos2d::CCString::getCString(v12);
sub_D153B8((int)&v26, CString);
v15 = (const void *)cocos2d::CCDictionary::objectForKey(m_dailyLevels, &v26);
if ( v15 )
v16 = (GJGameLevel *)_dynamic_cast(
v15,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'GJGameLevel,
0);
else
v16 = nullptr;
v17 = (char *)v26.m_data.m_data - 24;
if ( (__int64 *)v26.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v23 = (unsigned int *)((char *)v26.m_data.m_data - 8);
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *((_DWORD *)v26.m_data.m_data - 2);
*((_DWORD *)v26.m_data.m_data - 2) = v24 - 1;
}
if ( v24 <= 0 )
operator delete(v17);
}
if ( v16 )
{
v18 = v16->m_stars.random - v16->m_stars.seed;
if ( a2 <= v18 && a3 >= v18 && GJGameLevel::getNormalPercent(v16) == 100 )
{
v19 = GameStatsManager::sharedState();
v20 = !GameStatsManager::hasCompletedLevel(v19, v16);
v21 = v25;
if ( !v20 )
v21 = v25 + 1;
v25 = v21;
}
}
}
}
}
return v25;
}