//
// GameLevelManager::createAndGetLevelLists from 0x72fbc8 to 0x72fe64 (668 bytes)
//
// 2 xrefs:
// > GameLevelManager::onGetLevelListsCompleted @ 0x73009c
// > ??> @ 0xa7a18
//
// 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::CCArray *__fastcall GameLevelManager::createAndGetLevelLists(__int64 a1, char **a2)
{
cocos2d::CCArray *v2; // x25
cocos2d::CCArray *v3; // x24
char *v4; // x0
unsigned int v5; // w20
cocos2d::CCString *v6; // x0
char *CString; // x0
GJLevelList *v8; // x22
char *v9; // x0
void *v10; // x0
unsigned int *v12; // x1
int v13; // w2
unsigned int *v14; // x1
int v15; // w2
unsigned int *v16; // x1
int v17; // w2
__int64 v18; // [xsp+0h] [xbp+0h] BYREF
char **v19; // [xsp+68h] [xbp+68h]
__int64 v20; // [xsp+78h] [xbp+78h]
char *v21; // [xsp+80h] [xbp+80h] BYREF
v19 = a2;
v2 = (cocos2d::CCArray *)cocos2d::CCArray::create(_stack_chk_guard);
sub_D153B8((int)&v21, *v19);
v3 = sub_6F004C(&v21, "|");
v4 = v21 - 24;
if ( v21 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v21 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *((_DWORD *)v21 - 2);
*((_DWORD *)v21 - 2) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v4);
}
v5 = 0;
while ( v5 < (unsigned int)cocos2d::CCArray::count(v3) )
{
v6 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v3, v5);
CString = (char *)cocos2d::CCString::getCString(v6);
sub_D153B8((unsigned int)&v18 + 120, CString);
sub_D18D28(&v21);
GameLevelManager::responseToDict(&v21, 0);
v8 = GJLevelList::create();
v9 = v21 - 24;
if ( v21 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)(v21 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *((_DWORD *)v21 - 2);
*((_DWORD *)v21 - 2) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v9);
}
if ( v8 )
cocos2d::CCArray::addObject(v2, v8);
v10 = (void *)(v20 - 24);
if ( (__int64 *)(v20 - 24) == &qword_124B6B0 )
goto LABEL_7;
if ( &pthread_create )
{
v12 = (unsigned int *)(v20 - 8);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *(_DWORD *)(v20 - 8);
*(_DWORD *)(v20 - 8) = v13 - 1;
}
if ( v13 > 0 )
{
LABEL_7:
++v5;
}
else
{
++v5;
operator delete(v10);
}
}
return v2;
}