//
// GameStatsManager::getCompletedMapPacks from 0x1402e2a70 to 0x1402e2d01 (657 bytes)
//
// 2 xrefs:
// > GameManager::recountUserStats @ 0x140280ed5
// > ??> @ 0x14091ded0
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:29:49 +0000
//
// Hidden C++ exception states: #wind=2
cocos2d::CCArray *__fastcall GameStatsManager::getCompletedMapPacks(__int64 a1)
{
cocos2d::CCArray *v1; // r15
__int64 v2; // rcx
cocos2d::CCArray *v3; // r12
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
char *v13; // rbx
unsigned __int64 v14; // rdi
unsigned __int64 v15; // r14
size_t v16; // r8
struct cocos2d::CCObject *v17; // rax
char *v18; // rax
void *v19; // rcx
__int128 Buf2; // [rsp+30h] [rbp-98h] BYREF
__int64 v22; // [rsp+40h] [rbp-88h]
__int64 v23; // [rsp+48h] [rbp-80h]
void *Buf1[2]; // [rsp+50h] [rbp-78h] BYREF
unsigned __int64 v25; // [rsp+60h] [rbp-68h]
unsigned __int64 v26; // [rsp+68h] [rbp-60h]
__int128 v27; // [rsp+70h] [rbp-58h] BYREF
__int128 v28; // [rsp+80h] [rbp-48h]
v1 = cocos2d::CCDictionary::allKeys(*(cocos2d::CCDictionary **)(a1 + 712));
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);
v27 = 0;
v28 = 0;
v7 = -1;
do
++v7;
while ( CString[v7] );
sub_14003D230(&v27, CString, v7);
v8 = sub_1400D2840((__int64 *)&v27, "_");
if ( cocos2d::CCArray::count(v8) == 2 )
{
v9 = cocos2d::CCArray::stringAtIndex(v8, 0);
v10 = cocos2d::CCString::getCString(v9);
*(_OWORD *)Buf1 = 0;
v25 = 0;
v26 = 0;
v11 = -1;
do
++v11;
while ( v10[v11] );
sub_14003D230(Buf1, v10, v11);
Buf2 = 0;
v22 = 4;
v23 = 15;
strcpy((char *)&Buf2, "pack");
v12 = Buf1;
v13 = (char *)Buf1[0];
v14 = v26;
if ( v26 > 0xF )
v12 = (void **)Buf1[0];
v15 = v25;
v16 = v25;
if ( v25 > 4 )
v16 = 4;
if ( !memcmp(v12, &Buf2, v16) && v15 == 4 )
{
v17 = cocos2d::CCArray::objectAtIndex(v8, 1u);
cocos2d::CCArray::addObject(v3, v17);
}
if ( v14 > 0xF )
{
v18 = v13;
if ( v14 + 1 >= 0x1000 )
{
v13 = *((char **)v13 - 1);
if ( (unsigned __int64)(v18 - v13 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v13);
}
}
if ( *((_QWORD *)&v28 + 1) > 0xFu )
{
v19 = (void *)v27;
if ( (unsigned __int64)(*((_QWORD *)&v28 + 1) + 1LL) >= 0x1000 )
{
v19 = *(void **)(v27 - 8);
if ( (unsigned __int64)(v27 - (_QWORD)v19 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v19);
}
}
return v3;
}