//
// GameLevelManager::onGetTopArtistsCompleted from 0x700958 to 0x701030 (1752 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x731f54
// > ??> @ 0x49968
//
// 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::onGetTopArtistsCompleted(GameLevelManager *a1, const void **a2, const char **a3)
{
char *v3; // x26
_DWORD *v6; // x23
unsigned __int64 v7; // x24
unsigned __int64 v8; // x22
size_t v9; // x2
int v10; // w19
__int64 v11; // x22
__int64 *v12; // x0
OnlineListDelegate *v13; // x0
cocos2d::CCArray *v15; // x19
char *v16; // x0
cocos2d::CCString *v17; // x0
char *CString; // x0
cocos2d::CCString *v19; // x0
char *v20; // x0
cocos2d::CCArray *v21; // x0
OnlineListDelegate *m_onlineListDelegate; // x19
void (__fastcall *setupPageInfo)(OnlineListDelegate *__hidden, std::string, const unsigned __int8 *); // x23
long double v24; // q0
cocos2d::CCArray *v25; // x24
cocos2d::CCArray *v26; // x23
void *v27; // x0
unsigned int v28; // w20
cocos2d::CCString *v29; // x0
char *v30; // x0
cocos2d::CCDictionary *v31; // x2
char *v32; // x0
SongInfoObject *v33; // x0
char *v34; // x0
unsigned int *v35; // x1
int v36; // w2
unsigned int *v37; // x23
int v38; // w1
unsigned int *v39; // x1
int v40; // w3
char *v41; // x0
OnlineListDelegate *v42; // x0
void *v43; // x0
char *v44; // x0
unsigned int *v45; // x19
int v46; // w1
unsigned int *v47; // x1
int v48; // w2
unsigned int *v49; // x1
int v50; // w2
unsigned int *v51; // x1
int v52; // w2
unsigned int *v53; // x1
int v54; // w2
unsigned int *v55; // x1
int v56; // w2
cocos2d::CCDictionary *v57; // [xsp+60h] [xbp+60h]
char *v58; // [xsp+78h] [xbp+78h] BYREF
__int64 v59; // [xsp+80h] [xbp+80h] BYREF
__int64 v60; // [xsp+88h] [xbp+88h] BYREF
__int64 v61; // [xsp+90h] [xbp+90h] BYREF
char *v62; // [xsp+98h] [xbp+98h] BYREF
void *v63; // [xsp+A0h] [xbp+A0h] BYREF
v3 = (char *)*a3;
GameLevelManager::removeDLFromActive(a1, *a3);
sub_D153B8((int)&v63, "-1");
v6 = v63;
v7 = *((_QWORD *)v63 - 3);
v8 = *((_QWORD *)*a2 - 3);
if ( v7 > v8 )
v9 = *((_QWORD *)*a2 - 3);
else
v9 = *((_QWORD *)v63 - 3);
v10 = memcmp(*a2, v63, 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 )
{
v37 = v6 - 2;
do
v38 = __ldaxr(v37);
while ( __stlxr(v38 - 1, v37) );
}
else
{
v38 = *(v6 - 2);
*(v6 - 2) = v38 - 1;
}
if ( v38 <= 0 )
operator delete(v12);
LABEL_7:
if ( !v10 )
goto LABEL_8;
sub_D153B8((int)&v63, (char *)*a2);
v15 = sub_6F004C(&v63, "#");
v16 = (char *)v63 - 24;
if ( (char *)v63 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v51 = (unsigned int *)((char *)v63 - 8);
do
v52 = __ldaxr(v51);
while ( __stlxr(v52 - 1, v51) );
}
else
{
v52 = *((_DWORD *)v63 - 2);
*((_DWORD *)v63 - 2) = v52 - 1;
}
if ( v52 <= 0 )
operator delete(v16);
}
if ( (unsigned int)cocos2d::CCArray::count(v15) > 1 )
{
v17 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v15, 0);
CString = (char *)cocos2d::CCString::getCString(v17);
sub_D153B8((int)&v58, CString);
v19 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v15, 1u);
v20 = (char *)cocos2d::CCString::getCString(v19);
v21 = (cocos2d::CCArray *)sub_D153B8((int)&v59, v20);
m_onlineListDelegate = a1->m_onlineListDelegate;
if ( m_onlineListDelegate )
{
setupPageInfo = m_onlineListDelegate->setupPageInfo;
*(__n128 *)&v24 = sub_D18D28(&v60, &v59);
((void (__fastcall *)(OnlineListDelegate *, __int64 *, char *, long double))setupPageInfo)(
m_onlineListDelegate,
&v60,
v3,
v24);
v21 = (cocos2d::CCArray *)(v60 - 24);
if ( (__int64 *)(v60 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v49 = (unsigned int *)(v60 - 8);
do
v50 = __ldaxr(v49);
while ( __stlxr(v50 - 1, v49) );
}
else
{
v50 = *(_DWORD *)(v60 - 8);
*(_DWORD *)(v60 - 8) = v50 - 1;
}
if ( v50 <= 0 )
operator delete(v21);
}
}
v25 = (cocos2d::CCArray *)cocos2d::CCArray::create(v21);
sub_D153B8((int)&v61, v58);
v26 = sub_6F004C(&v61, "|");
v27 = (void *)(v61 - 24);
if ( (__int64 *)(v61 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v47 = (unsigned int *)(v61 - 8);
do
v48 = __ldaxr(v47);
while ( __stlxr(v48 - 1, v47) );
}
else
{
v48 = *(_DWORD *)(v61 - 8);
*(_DWORD *)(v61 - 8) = v48 - 1;
}
if ( v48 <= 0 )
operator delete(v27);
}
v28 = 0;
while ( v28 < (unsigned int)cocos2d::CCArray::count(v26) )
{
v29 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v26, v28);
v30 = (char *)cocos2d::CCString::getCString(v29);
sub_D153B8((int)&v63, v30);
sub_D18D28(&v62, &v63);
v31 = GameLevelManager::responseToDict(&v62, 0);
v32 = v62 - 24;
if ( v62 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v39 = (unsigned int *)(v62 - 8);
do
v40 = __ldaxr(v39);
while ( __stlxr(v40 - 1, v39) );
}
else
{
v40 = *((_DWORD *)v62 - 2);
*((_DWORD *)v62 - 2) = v40 - 1;
}
if ( v40 <= 0 )
{
v57 = v31;
operator delete(v32);
v31 = v57;
}
}
v33 = SongInfoObject::create(v31);
cocos2d::CCArray::addObject(v25, v33);
v34 = (char *)v63 - 24;
if ( (char *)v63 - 24 == (char *)&qword_124B6B0 )
goto LABEL_25;
if ( &pthread_create )
{
v35 = (unsigned int *)((char *)v63 - 8);
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
}
else
{
v36 = *((_DWORD *)v63 - 2);
*((_DWORD *)v63 - 2) = v36 - 1;
}
if ( v36 > 0 )
{
LABEL_25:
++v28;
}
else
{
++v28;
operator delete(v34);
}
}
sub_D18D28(&v63, &v59);
GameLevelManager::storeSearchResult(a1, v25, (char **)&v63, v3);
v41 = (char *)v63 - 24;
if ( (char *)v63 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v53 = (unsigned int *)((char *)v63 - 8);
do
v54 = __ldaxr(v53);
while ( __stlxr(v54 - 1, v53) );
}
else
{
v54 = *((_DWORD *)v63 - 2);
*((_DWORD *)v63 - 2) = v54 - 1;
}
if ( v54 <= 0 )
operator delete(v41);
}
v42 = a1->m_onlineListDelegate;
if ( v42 )
v42->loadListFinished(v42, v25, (const unsigned __int8 *)v3);
v43 = (void *)(v59 - 24);
if ( (__int64 *)(v59 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v55 = (unsigned int *)(v59 - 8);
do
v56 = __ldaxr(v55);
while ( __stlxr(v56 - 1, v55) );
}
else
{
v56 = *(_DWORD *)(v59 - 8);
*(_DWORD *)(v59 - 8) = v56 - 1;
}
if ( v56 <= 0 )
operator delete(v43);
}
v44 = v58 - 24;
if ( v58 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v45 = (unsigned int *)(v58 - 8);
do
v46 = __ldaxr(v45);
while ( __stlxr(v46 - 1, v45) );
}
else
{
v46 = *((_DWORD *)v58 - 2);
*((_DWORD *)v58 - 2) = v46 - 1;
}
if ( v46 <= 0 )
operator delete(v44);
}
}
else
{
LABEL_8:
v13 = a1->m_onlineListDelegate;
if ( v13 )
v13->loadListFailed(v13, (const unsigned __int8 *)v3);
}
return _stack_chk_guard;
}