//
// GameLevelManager::getCompletedDailyLevels from 0x100536e90 to 0x100537075 (485 bytes)
//
// 1 xrefs:
// > GameLevelManager::updateUserScore @ 0x100548db8
//
// 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::getCompletedDailyLevels(GameLevelManager *a1)
{
double v1; // xmm0_8
cocos2d::CCArray *v2; // rax
cocos2d::ccArray *data; // rax
cocos2d::CCString **arr; // r12
unsigned __int64 v5; // r14
cocos2d::CCString *v6; // rbx
cocos2d::CCDictionary *m_dailyLevels; // 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 v19; // [rsp+0h] [rbp-60h]
unsigned __int64 v20; // [rsp+10h] [rbp-50h]
_QWORD __dst[2]; // [rsp+18h] [rbp-48h] BYREF
void *__p; // [rsp+28h] [rbp-38h]
__int64 v23; // [rsp+30h] [rbp-30h]
v2 = cocos2d::CCDictionary::allKeys(a1->m_dailyLevels);
v23 = 0;
if ( v2 )
{
data = v2->data;
if ( data->num )
{
arr = (cocos2d::CCString **)data->arr;
v5 = (unsigned __int64)&arr[data->num - 1];
v23 = 0;
v20 = v5;
while ( 1 )
{
v6 = *arr;
if ( !*arr )
return v23;
if ( cocos2d::CCString::intValue(*arr) <= 100000 )
break;
LABEL_4:
if ( (unsigned __int64)++arr > v5 )
return v23;
}
m_dailyLevels = a1->m_dailyLevels;
CString = cocos2d::CCString::getCString(v6);
v9 = strlen(CString);
if ( v9 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v1);
v10 = v9;
v19 = (__int64)m_dailyLevels;
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;
}
else
{
LOBYTE(__dst[0]) = 2 * v9;
v11 = (char *)__dst + 1;
if ( !v9 )
{
LABEL_15:
v11[v10] = 0;
v14 = (const void *)cocos2d::CCDictionary::objectForKey_1(v19, (char *)__dst);
v5 = v20;
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 )
{
LABEL_18:
if ( v15
&& v15->m_stars.random - v15->m_stars.seed <= 9
&& v15->m_normalPercent.random - v15->m_normalPercent.seed == 100 )
{
v16 = GameStatsManager::sharedState();
hasCompletedLevel = GameStatsManager::hasCompletedLevel(v16, v15);
v23 = hasCompletedLevel + (unsigned int)v23;
}
goto LABEL_4;
}
}
else
{
v15 = nullptr;
if ( (__dst[0] & 1) == 0 )
goto LABEL_18;
}
operator delete(__p);
goto LABEL_18;
}
}
memmove(v11, CString, v10);
goto LABEL_15;
}
}
return v23;
}