//
// GameLevelManager::getCompletedEventLevels from 0x100537090 to 0x10053727f (495 bytes)
//
// 2 xrefs:
// > GameLevelManager::updateUserScore @ 0x100548a36
// > GameLevelManager::updateUserScore @ 0x10054932d
//
// 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 __fastcall GameLevelManager::getCompletedEventLevels(GameLevelManager *a1, int a2, int a3)
{
double v3; // xmm0_8
GameLevelManager *v4; // r15
cocos2d::CCArray *v5; // rax
cocos2d::ccArray *data; // rax
cocos2d::CCString **arr; // r13
cocos2d::CCString **v8; // r12
cocos2d::CCString *v9; // rbx
const char *CString; // r14
size_t v11; // rax
size_t v12; // rbx
char *v13; // r12
size_t v14; // r15
const void *v15; // rax
GJGameLevel *v16; // rbx
int v17; // eax
GameStatsManager *v18; // rax
bool hasCompletedLevel; // al
__int64 m_dailyLevels; // [rsp+8h] [rbp-68h]
cocos2d::CCString **v22; // [rsp+10h] [rbp-60h]
_QWORD __dst[2]; // [rsp+20h] [rbp-50h] BYREF
void *__p; // [rsp+30h] [rbp-40h]
int v25; // [rsp+38h] [rbp-38h]
int v26; // [rsp+3Ch] [rbp-34h]
__int64 v27; // [rsp+40h] [rbp-30h]
v25 = a3;
v26 = a2;
v4 = a1;
v5 = cocos2d::CCDictionary::allKeys(a1->m_dailyLevels);
v27 = 0;
if ( v5 )
{
data = v5->data;
if ( data->num )
{
arr = (cocos2d::CCString **)data->arr;
v8 = &arr[data->num - 1];
v27 = 0;
v22 = v8;
while ( 1 )
{
v9 = *arr;
if ( !*arr )
return v27;
if ( cocos2d::CCString::intValue(*arr) >= 200001 )
break;
LABEL_4:
if ( ++arr > v8 )
return v27;
}
m_dailyLevels = (__int64)v4->m_dailyLevels;
CString = cocos2d::CCString::getCString(v9);
v11 = strlen(CString);
if ( v11 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v3);
v12 = v11;
if ( v11 >= 0x17 )
{
v14 = (v11 | 7) + 1;
if ( (v11 | 7) == 0x17 )
v14 = 26;
v13 = (char *)operator new(v14);
__p = v13;
__dst[0] = v14 + 1;
v4 = a1;
__dst[1] = v12;
}
else
{
LOBYTE(__dst[0]) = 2 * v11;
v13 = (char *)__dst + 1;
if ( !v11 )
{
LABEL_15:
v13[v12] = 0;
v15 = (const void *)cocos2d::CCDictionary::objectForKey_1(m_dailyLevels, (char *)__dst);
v8 = v22;
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);
if ( (__dst[0] & 1) == 0 )
{
LABEL_18:
if ( v16 )
{
v17 = v16->m_stars.random - v16->m_stars.seed;
if ( v17 >= v26 && v17 <= v25 && v16->m_normalPercent.random - v16->m_normalPercent.seed == 100 )
{
v18 = GameStatsManager::sharedState();
hasCompletedLevel = GameStatsManager::hasCompletedLevel(v18, v16);
v27 = hasCompletedLevel + (unsigned int)v27;
}
}
goto LABEL_4;
}
}
else
{
v16 = nullptr;
if ( (__dst[0] & 1) == 0 )
goto LABEL_18;
}
operator delete(__p);
goto LABEL_18;
}
}
memmove(v13, CString, v12);
goto LABEL_15;
}
}
return v27;
}