//
// GameStatsManager::getCompletedMapPacks from 0x1401df150 to 0x1401df3bd (621 bytes)
//
// 2 xrefs:
// > GameManager::recountUserStats @ 0x140185572
// > ??> @ 0x1406cc468
//
// 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
//
// Hidden C++ exception states: #wind=2
cocos2d::CCArray *GameStatsManager::getCompletedMapPacks(GameStatsManager *a1)
{
cocos2d::CCArray *v1; // r12
__int64 v2; // rcx
cocos2d::CCArray *v3; // r13
unsigned int i; // ebp
cocos2d::CCString *v5; // rax
const char *CString; // rax
size_t v7; // r8
cocos2d::CCArray *v8; // rsi
cocos2d::CCString *v9; // rax
const char *v10; // rax
size_t v11; // r8
void **v12; // rcx
unsigned __int64 v13; // r14
bool v14; // r15
char *v15; // rbx
unsigned __int64 v16; // rdi
size_t v17; // r8
struct cocos2d::CCObject *v18; // rax
char *v19; // rax
void *v20; // rcx
void *Buf1[2]; // [rsp+20h] [rbp-98h] BYREF
unsigned __int64 v23; // [rsp+30h] [rbp-88h]
unsigned __int64 v24; // [rsp+38h] [rbp-80h]
__int128 v25; // [rsp+40h] [rbp-78h] BYREF
__int64 v26; // [rsp+50h] [rbp-68h]
unsigned __int64 v27; // [rsp+58h] [rbp-60h]
__int128 Buf2; // [rsp+60h] [rbp-58h] BYREF
__int64 v29; // [rsp+70h] [rbp-48h]
__int64 v30; // [rsp+78h] [rbp-40h]
v1 = cocos2d::CCDictionary::allKeys(a1->m_completedLevels);
v3 = (cocos2d::CCArray *)cocos2d::CCArray::create(v2);
for ( i = 0; i < cocos2d::CCArray::count(v1); ++i )
{
v5 = cocos2d::CCArray::stringAtIndex(v1, i);
CString = cocos2d::CCString::getCString(v5);
v25 = 0;
v26 = 0;
v27 = 0;
v7 = -1;
do
++v7;
while ( CString[v7] );
sub_14003A930(&v25, CString, v7);
v8 = sub_140140F70((__int64 *)&v25, "_");
if ( cocos2d::CCArray::count(v8) == 2 )
{
v9 = cocos2d::CCArray::stringAtIndex(v8, 0);
v10 = cocos2d::CCString::getCString(v9);
*(_OWORD *)Buf1 = 0;
v23 = 0;
v24 = 0;
v11 = -1;
do
++v11;
while ( v10[v11] );
sub_14003A930(Buf1, v10, v11);
Buf2 = 0;
v29 = 4;
v30 = 15;
strcpy((char *)&Buf2, "pack");
v12 = Buf1;
v13 = v24;
v14 = v24 > 0xF;
v15 = (char *)Buf1[0];
if ( v24 > 0xF )
v12 = (void **)Buf1[0];
v16 = v23;
v17 = v23;
if ( v23 > 4 )
v17 = 4;
if ( !memcmp(v12, &Buf2, v17) && v16 == 4 )
{
v18 = cocos2d::CCArray::objectAtIndex(v8, 1u);
cocos2d::CCArray::addObject(v3, v18);
}
if ( v14 )
{
v19 = v15;
if ( v13 + 1 >= 0x1000 )
{
v15 = *((char **)v15 - 1);
if ( (unsigned __int64)(v19 - v15 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v15);
}
}
if ( v27 > 0xF )
{
v20 = (void *)v25;
if ( v27 + 1 >= 0x1000 )
{
v20 = *(void **)(v25 - 8);
if ( (unsigned __int64)(v25 - (_QWORD)v20 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v20);
}
}
return v3;
}