//
// GameLevelManager::getTopArtists from 0x7218bc to 0x721d00 (1092 bytes)
//
// 3 xrefs:
// > TopArtistsLayer::init @ 0x966384
// > TopArtistsLayer::loadPage @ 0x966c2c
// > ??> @ 0x948f0
//
// 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
//
void GameLevelManager::getTopArtists(GameLevelManager *a1, int a2, int a3)
{
char *TopArtistsKey; // x0
char *v7; // x0
cocos2d::CCString *v8; // x0
const char *CString; // x0
cocos2d::CCString *v10; // x0
size_t v11; // x0
int *p_m_unknown2; // x0
char *v13; // x0
char *v14; // x0
char *v15; // x0
unsigned int *v16; // x1
int v17; // w2
unsigned int *v18; // x2
int v19; // w1
unsigned int *p_timeoutForConnect; // x1
int timeoutForConnect; // w2
unsigned int *v22; // x1
int v23; // w2
unsigned int *v24; // x1
int v25; // w2
unsigned int *v26; // x1
int v27; // w2
const char *v28; // [xsp+58h] [xbp+58h]
char *v29; // [xsp+80h] [xbp+80h] BYREF
char *v30; // [xsp+88h] [xbp+88h] BYREF
const char *v31; // [xsp+90h] [xbp+90h] BYREF
const char *v32; // [xsp+98h] [xbp+98h] BYREF
cocos2d::extension::CCHttpClient *v33; // [xsp+A0h] [xbp+A0h] BYREF
TopArtistsKey = (char *)GameLevelManager::getTopArtistsKey(a1, a2);
sub_D153B8((int)&v29, TopArtistsKey);
if ( GameLevelManager::isDLActive(a1, v29) )
{
v7 = v29 - 24;
if ( v29 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v29 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *((_DWORD *)v29 - 2);
*((_DWORD *)v29 - 2) = v19 - 1;
}
if ( v19 <= 0 )
LABEL_18:
operator delete(v7);
}
}
else
{
GameLevelManager::addDLToActive(a1, v29);
GameLevelManager::getBasePostString(a1, (__int64)&v30);
v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%c%s%s%c%c%s",
(const char *)off_50 + 7,
"mfd",
"2893",
103,
98,
"7");
CString = cocos2d::CCString::getCString(v8);
v10 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&page=%i&secret=%s&total=%i",
(const char *)(unsigned int)a2,
CString,
(unsigned int)a3);
v28 = cocos2d::CCString::getCString(v10);
v11 = strlen(v28);
sub_D15FD4(&v30, v28, v11);
sub_D153B8((int)&v31, "https://www.boomlings.com/database/getGJTopArtists.php");
sub_D153B8((int)&v32, v30);
sub_D18D28(&v33);
GameLevelManager::ProcessHttpRequest(a1, &v31, &v32, &v33, 53);
p_m_unknown2 = &v33[-1].m_unknown2;
if ( &v33[-1].m_unknown2 != (int *)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_timeoutForConnect = (unsigned int *)&v33[-1]._timeoutForConnect;
do
timeoutForConnect = __ldaxr(p_timeoutForConnect);
while ( __stlxr(timeoutForConnect - 1, p_timeoutForConnect) );
}
else
{
timeoutForConnect = v33[-1]._timeoutForConnect;
v33[-1]._timeoutForConnect = timeoutForConnect - 1;
}
if ( timeoutForConnect <= 0 )
operator delete(p_m_unknown2);
}
v13 = (char *)(v32 - 24);
if ( v32 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = (unsigned int *)(v32 - 8);
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *((_DWORD *)v32 - 2);
*((_DWORD *)v32 - 2) = v27 - 1;
}
if ( v27 <= 0 )
operator delete(v13);
}
v14 = (char *)(v31 - 24);
if ( v31 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v24 = (unsigned int *)(v31 - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *((_DWORD *)v31 - 2);
*((_DWORD *)v31 - 2) = v25 - 1;
}
if ( v25 <= 0 )
operator delete(v14);
}
v15 = v30 - 24;
if ( v30 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(v30 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *((_DWORD *)v30 - 2);
*((_DWORD *)v30 - 2) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v15);
}
v7 = v29 - 24;
if ( v29 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v29 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *((_DWORD *)v29 - 2);
*((_DWORD *)v29 - 2) = v17 - 1;
}
if ( v17 <= 0 )
goto LABEL_18;
}
}
}