//
// GameLevelManager::getCompletedWeeklyLevels from 0x100536c90 to 0x100536e75 (485 bytes)
//
// 1 xrefs:
// > GameLevelManager::updateUserScore @ 0x1005485c3
//
// 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::getCompletedWeeklyLevels(GameLevelManager *a1)
{
double v1; // xmm0_8
GameLevelManager *v2; // rbx
cocos2d::CCArray *v3; // rax
cocos2d::ccArray *data; // rax
cocos2d::CCString **arr; // r12
unsigned __int64 v6; // r15
cocos2d::CCString *v7; // r14
const char *CString; // r15
size_t v9; // rax
size_t v10; // r13
char *v11; // r14
__int64 v12; // rax
size_t v13; // rbx
const void *v14; // rax
GJGameLevel *v15; // r15
GameStatsManager *v16; // rax
bool hasCompletedLevel; // al
__int64 m_dailyLevels; // [rsp+0h] [rbp-60h]
_QWORD __dst[2]; // [rsp+10h] [rbp-50h] BYREF
void *__p; // [rsp+20h] [rbp-40h]
unsigned __int64 v22; // [rsp+28h] [rbp-38h]
__int64 v23; // [rsp+30h] [rbp-30h]
v2 = a1;
v3 = cocos2d::CCDictionary::allKeys(a1->m_dailyLevels);
v23 = 0;
if ( v3 )
{
data = v3->data;
if ( data->num )
{
arr = (cocos2d::CCString **)data->arr;
v6 = (unsigned __int64)&arr[data->num - 1];
v23 = 0;
v22 = v6;
while ( 1 )
{
v7 = *arr;
if ( !*arr )
return v23;
if ( (unsigned int)(cocos2d::CCString::intValue(*arr) - 100001) <= 0x1869F )
break;
LABEL_5:
if ( (unsigned __int64)++arr > v6 )
return v23;
}
m_dailyLevels = (__int64)v2->m_dailyLevels;
CString = cocos2d::CCString::getCString(v7);
v9 = strlen(CString);
if ( v9 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v1);
v10 = v9;
if ( v9 >= 0x17 )
{
v12 = v9 | 7;
v13 = 26;
if ( (v10 | 7) != 0x17 )
v13 = v12 + 1;
v11 = (char *)operator new(v13);
__p = v11;
__dst[0] = v13 + 1;
__dst[1] = v10;
v2 = a1;
}
else
{
LOBYTE(__dst[0]) = 2 * v9;
v11 = (char *)__dst + 1;
if ( !v9 )
{
LABEL_16:
v11[v10] = 0;
v14 = (const void *)cocos2d::CCDictionary::objectForKey_1(m_dailyLevels, (char *)__dst);
if ( v14 )
{
v15 = (GJGameLevel *)__dynamic_cast(
v14,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'GJGameLevel,
0);
if ( (__dst[0] & 1) == 0 )
goto LABEL_19;
}
else
{
v15 = nullptr;
if ( (__dst[0] & 1) == 0 )
{
LABEL_19:
if ( v15
&& v15->m_stars.random - v15->m_stars.seed == 10
&& v15->m_normalPercent.random - v15->m_normalPercent.seed == 100 )
{
v16 = GameStatsManager::sharedState();
hasCompletedLevel = GameStatsManager::hasCompletedLevel(v16, v15);
v23 = hasCompletedLevel + (unsigned int)v23;
}
v6 = v22;
goto LABEL_5;
}
}
operator delete(__p);
goto LABEL_19;
}
}
memmove(v11, CString, v10);
goto LABEL_16;
}
}
return v23;
}