//
// GameLevelManager::onGetLevelListsCompleted from 0x72fe64 to 0x7305d8 (1908 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x732814
// > ??> @ 0x84c78
//
// 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
//
__int64 __fastcall GameLevelManager::onGetLevelListsCompleted(GameLevelManager *a1, const void **a2, const char **a3)
{
char *v4; // x24
_DWORD *v6; // x27
unsigned __int64 v7; // x28
unsigned __int64 v8; // x20
size_t v9; // x2
int v10; // w19
__int64 v11; // x20
__int64 *v12; // x0
LevelManagerDelegate *v13; // x0
cocos2d::CCArray *v15; // x19
char *v16; // x0
cocos2d::CCString *v17; // x0
char *CString; // x0
cocos2d::CCString *v19; // x0
char *v20; // x0
cocos2d::CCString *v21; // x0
char *v22; // x0
cocos2d::CCString *v23; // x0
char *v24; // x0
char *v25; // x0
cocos2d::CCArray *LevelLists; // x25
char *v27; // x0
cocos2d::ccArray *data; // x1
LevelManagerDelegate *m_levelManagerDelegate; // x19
void (__fastcall *setupPageInfo)(LevelManagerDelegate *__hidden, std::string, const unsigned __int8 *); // x28
long double v31; // q0
void *v32; // x0
char *v33; // x0
LevelManagerDelegate *v34; // x0
void *v35; // x0
void *v36; // x0
void *v37; // x0
void *v38; // x19
unsigned int *v39; // x27
int v40; // w0
unsigned int *v41; // x27
int v42; // w1
GJLevelList **arr; // x19
__int64 v44; // x0
char *v45; // x27
unsigned int *v46; // x1
int v47; // w2
unsigned int *v48; // x1
int v49; // w2
unsigned int *v50; // x1
int v51; // w2
unsigned int *v52; // x1
int v53; // w2
unsigned int *v54; // x1
int v55; // w2
unsigned int *v56; // x1
int v57; // w2
unsigned int *v58; // x1
int v59; // w2
unsigned int *v60; // x1
int v61; // w2
__int64 v62; // [xsp+68h] [xbp+68h] BYREF
__int64 v63; // [xsp+70h] [xbp+70h] BYREF
__int64 v64; // [xsp+78h] [xbp+78h] BYREF
__int64 v65; // [xsp+80h] [xbp+80h] BYREF
char *v66; // [xsp+88h] [xbp+88h] BYREF
char *v67; // [xsp+90h] [xbp+90h] BYREF
__int64 v68; // [xsp+98h] [xbp+98h] BYREF
void *v69; // [xsp+A0h] [xbp+A0h] BYREF
v4 = (char *)*a3;
GameLevelManager::removeDLFromActive(a1, *a3);
sub_D153B8((int)&v69, "-1");
v6 = v69;
v7 = *((_QWORD *)v69 - 3);
v8 = *((_QWORD *)*a2 - 3);
if ( v7 > v8 )
v9 = *((_QWORD *)*a2 - 3);
else
v9 = *((_QWORD *)v69 - 3);
v10 = memcmp(*a2, v69, v9);
if ( v10 || (v10 = 0x7FFFFFFF, v11 = v8 - v7, v11 > 0x7FFFFFFF) )
{
v12 = (__int64 *)(v6 - 6);
if ( v6 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_7;
}
else
{
v12 = (__int64 *)(v6 - 6);
if ( v11 >= (__int64)0xFFFFFFFF80000000LL )
v10 = v11;
else
v10 = 0x80000000;
if ( v12 == &qword_124B6B0 )
goto LABEL_7;
}
if ( &pthread_create )
{
v41 = v6 - 2;
do
v42 = __ldaxr(v41);
while ( __stlxr(v42 - 1, v41) );
}
else
{
v42 = *(v6 - 2);
*(v6 - 2) = v42 - 1;
}
if ( v42 <= 0 )
operator delete(v12);
LABEL_7:
if ( !v10 )
goto LABEL_8;
sub_D153B8((int)&v69, (char *)*a2);
v15 = sub_6F004C(&v69, "#");
v16 = (char *)v69 - 24;
if ( (char *)v69 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v48 = (unsigned int *)((char *)v69 - 8);
do
v49 = __ldaxr(v48);
while ( __stlxr(v49 - 1, v48) );
}
else
{
v49 = *((_DWORD *)v69 - 2);
*((_DWORD *)v69 - 2) = v49 - 1;
}
if ( v49 <= 0 )
operator delete(v16);
}
if ( (unsigned int)cocos2d::CCArray::count(v15) > 3 )
{
v17 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v15, 0);
CString = (char *)cocos2d::CCString::getCString(v17);
sub_D153B8((int)&v62, CString);
v19 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v15, 1u);
v20 = (char *)cocos2d::CCString::getCString(v19);
sub_D153B8((int)&v63, v20);
v21 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v15, 2u);
v22 = (char *)cocos2d::CCString::getCString(v21);
sub_D153B8((int)&v64, v22);
v23 = cocos2d::CCArray::stringAtIndex(v15, 3u);
v24 = (char *)cocos2d::CCString::getCString(v23);
sub_D153B8((int)&v65, v24);
sub_D18D28(&v66);
GameLevelManager::storeUserNames(a1, &v66);
v25 = v66 - 24;
if ( v66 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v50 = (unsigned int *)(v66 - 8);
do
v51 = __ldaxr(v50);
while ( __stlxr(v51 - 1, v50) );
}
else
{
v51 = *((_DWORD *)v66 - 2);
*((_DWORD *)v66 - 2) = v51 - 1;
}
if ( v51 <= 0 )
operator delete(v25);
}
sub_D18D28(&v67);
LevelLists = GameLevelManager::createAndGetLevelLists((__int64)a1, &v67);
v27 = v67 - 24;
if ( v67 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v46 = (unsigned int *)(v67 - 8);
do
v47 = __ldaxr(v46);
while ( __stlxr(v47 - 1, v46) );
}
else
{
v47 = *((_DWORD *)v67 - 2);
*((_DWORD *)v67 - 2) = v47 - 1;
}
if ( v47 <= 0 )
operator delete(v27);
}
if ( LevelLists )
{
data = LevelLists->data;
if ( data->num )
{
arr = (GJLevelList **)data->arr;
v44 = 8LL * data->num - 8;
v45 = (char *)arr + v44;
if ( arr <= (GJLevelList **)((char *)arr + v44) )
{
do
{
if ( !*arr )
break;
GameLevelManager::updateSavedLevelList(a1, *arr++);
}
while ( v45 >= (char *)arr );
}
}
}
m_levelManagerDelegate = a1->m_levelManagerDelegate;
if ( m_levelManagerDelegate )
{
setupPageInfo = m_levelManagerDelegate->setupPageInfo;
*(__n128 *)&v31 = sub_D18D28(&v68);
((void (__fastcall *)(LevelManagerDelegate *, __int64 *, char *, long double))setupPageInfo)(
m_levelManagerDelegate,
&v68,
v4,
v31);
v32 = (void *)(v68 - 24);
if ( (__int64 *)(v68 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v60 = (unsigned int *)(v68 - 8);
do
v61 = __ldaxr(v60);
while ( __stlxr(v61 - 1, v60) );
}
else
{
v61 = *(_DWORD *)(v68 - 8);
*(_DWORD *)(v68 - 8) = v61 - 1;
}
if ( v61 <= 0 )
operator delete(v32);
}
}
sub_D18D28(&v69);
GameLevelManager::storeSearchResult(a1, LevelLists, (char **)&v69, v4);
v33 = (char *)v69 - 24;
if ( (char *)v69 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v52 = (unsigned int *)((char *)v69 - 8);
do
v53 = __ldaxr(v52);
while ( __stlxr(v53 - 1, v52) );
}
else
{
v53 = *((_DWORD *)v69 - 2);
*((_DWORD *)v69 - 2) = v53 - 1;
}
if ( v53 <= 0 )
operator delete(v33);
}
v34 = a1->m_levelManagerDelegate;
if ( v34 )
v34->loadLevelsFinished_0(v34, LevelLists, (const unsigned __int8 *)v4, 1);
v35 = (void *)(v65 - 24);
if ( (__int64 *)(v65 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v58 = (unsigned int *)(v65 - 8);
do
v59 = __ldaxr(v58);
while ( __stlxr(v59 - 1, v58) );
}
else
{
v59 = *(_DWORD *)(v65 - 8);
*(_DWORD *)(v65 - 8) = v59 - 1;
}
if ( v59 <= 0 )
operator delete(v35);
}
v36 = (void *)(v64 - 24);
if ( (__int64 *)(v64 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v54 = (unsigned int *)(v64 - 8);
do
v55 = __ldaxr(v54);
while ( __stlxr(v55 - 1, v54) );
}
else
{
v55 = *(_DWORD *)(v64 - 8);
*(_DWORD *)(v64 - 8) = v55 - 1;
}
if ( v55 <= 0 )
operator delete(v36);
}
v37 = (void *)(v63 - 24);
if ( (__int64 *)(v63 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v56 = (unsigned int *)(v63 - 8);
do
v57 = __ldaxr(v56);
while ( __stlxr(v57 - 1, v56) );
}
else
{
v57 = *(_DWORD *)(v63 - 8);
*(_DWORD *)(v63 - 8) = v57 - 1;
}
if ( v57 <= 0 )
operator delete(v37);
}
v38 = (void *)(v62 - 24);
if ( (__int64 *)(v62 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v39 = (unsigned int *)(v62 - 8);
do
v40 = __ldaxr(v39);
while ( __stlxr(v40 - 1, v39) );
}
else
{
v40 = *(_DWORD *)(v62 - 8);
*(_DWORD *)(v62 - 8) = v40 - 1;
}
if ( v40 <= 0 )
operator delete(v38);
}
}
else
{
LABEL_8:
v13 = a1->m_levelManagerDelegate;
if ( v13 )
v13->loadLevelsFailed_0(v13, (const unsigned __int8 *)v4, 1);
}
return _stack_chk_guard;
}