//
// LevelTools::createStarPackDict from 0x605fb4 to 0x60634c (920 bytes)
//
// 2 xrefs:
// > GameManager::recountUserStats @ 0x5f9fe4
// > ??> @ 0xbf238
//
// 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
//
cocos2d::CCDictionary *LevelTools::createStarPackDict()
{
cocos2d::CCArray *v0; // x0
cocos2d::CCArray *v1; // x27
__int64 v2; // x20
__int64 v3; // x3
unsigned __int64 v4; // x19
__int64 v5; // x26
const std::string *v6; // x1
cocos2d::CCObject *v7; // x0
void *v8; // x0
char *v9; // x0
unsigned int *v10; // x1
int v11; // w2
unsigned int *v12; // x1
int v13; // w2
char *v14; // x0
void *v15; // x0
unsigned int v16; // w19
unsigned int v17; // w1
cocos2d::CCString *v18; // x0
int v19; // w21
cocos2d::CCString *v20; // x0
unsigned int v21; // w20
unsigned int *v23; // x19
int v24; // w1
unsigned int *v25; // x1
int v26; // w2
cocos2d::CCDictionary *v27; // [xsp+68h] [xbp+68h]
__int64 v28; // [xsp+90h] [xbp+90h] BYREF
char *v29; // [xsp+98h] [xbp+98h] BYREF
__int64 v30; // [xsp+A0h] [xbp+A0h] BYREF
v27 = cocos2d::CCDictionary::create();
v0 = (cocos2d::CCArray *)sub_D153B8(
(int)&v28,
"1,3,2,4,3,4,5,5,6,6,7,6,8,7,9,8,10,8,11,9,19,10,20,10,21,10,22,10,26,10,27,10,28,10,29,10,3"
"0,10,31,10,32,4,33,5,34,6,35,8,36,8,37,5,38,5,39,6,40,7,41,8,42,8,43,8,44,9,45,6,46,10,47,1"
"0,48,10,49,10,50,10,52,4,53,3,54,4,55,4,56,5,57,6,58,7,59,8,60,8,61,8,62,9,63,9,64,10,65,10,66,10");
v1 = (cocos2d::CCArray *)cocos2d::CCArray::create(v0);
v2 = sub_D168E0((int)&v28, &byte_F804F8, 0, 1u);
v3 = v2;
v4 = 0;
v5 = *(_QWORD *)(v28 - 24);
while ( 1 )
{
sub_D14F84(&v29, &v28, v4, v3);
if ( v5 != v4 || *((_QWORD *)v29 - 3) )
{
sub_D153B8((int)&v30, v29);
v7 = (cocos2d::CCObject *)cocos2d::CCString::create((cocos2d::CCString *)&v30, v6);
cocos2d::CCArray::addObject(v1, v7);
v8 = (void *)(v30 - 24);
if ( (__int64 *)(v30 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v12 = (unsigned int *)(v30 - 8);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *(_DWORD *)(v30 - 8);
*(_DWORD *)(v30 - 8) = v13 - 1;
}
if ( v13 <= 0 )
break;
}
}
if ( v2 == -1 )
goto LABEL_19;
LABEL_7:
v4 = v2 + 1;
v2 = sub_D168E0((int)&v28, &byte_F804F8, (int)v2 + 1, 1u);
v9 = v29 - 24;
if ( v29 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v10 = (unsigned int *)(v29 - 8);
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
}
else
{
v11 = *((_DWORD *)v29 - 2);
*((_DWORD *)v29 - 2) = v11 - 1;
}
if ( v11 <= 0 )
operator delete(v9);
}
v3 = v2 - v4;
if ( *(_QWORD *)(v28 - 24) < v4 )
sub_D13C5C(
"%s: __pos (which is %zu) > this->size() (which is %zu)",
"basic_string::substr",
v4,
*(_QWORD *)(v28 - 24));
}
operator delete(v8);
if ( v2 != -1 )
goto LABEL_7;
LABEL_19:
v14 = v29 - 24;
if ( v29 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v25 = (unsigned int *)(v29 - 8);
do
v26 = __ldaxr(v25);
while ( __stlxr(v26 - 1, v25) );
}
else
{
v26 = *((_DWORD *)v29 - 2);
*((_DWORD *)v29 - 2) = v26 - 1;
}
if ( v26 <= 0 )
operator delete(v14);
}
v15 = (void *)(v28 - 24);
if ( (__int64 *)(v28 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v23 = (unsigned int *)(v28 - 8);
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *(_DWORD *)(v28 - 8);
*(_DWORD *)(v28 - 8) = v24 - 1;
}
if ( v24 <= 0 )
operator delete(v15);
}
v16 = 0;
while ( 1 )
{
v21 = v16 + 1;
if ( v16 + 1 >= (unsigned int)cocos2d::CCArray::count(v1) )
break;
v17 = v16;
v16 += 2;
v18 = cocos2d::CCArray::stringAtIndex(v1, v17);
v19 = cocos2d::CCString::intValue(v18);
v20 = cocos2d::CCArray::stringAtIndex(v1, v21);
cocos2d::CCDictionary::setObject(v27, v20, v19);
}
return v27;
}