//
// GameLevelManager::getTopArtists from 0x140158fb0 to 0x1401592d0 (800 bytes)
//
// 3 xrefs:
// > TopArtistsLayer::init @ 0x1404cb35d
// > TopArtistsLayer::loadPage @ 0x1404cbaf1
// > ??> @ 0x1406ca9a4
//
// 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
//
// Hidden C++ exception states: #wind=4
void GameLevelManager::getTopArtists(GameLevelManager *a1, int a2, int a3)
{
cocos2d::CCString *v6; // rax
const char *CString; // rax
size_t v8; // rbx
size_t v9; // r8
void **v10; // rdx
void **v11; // rdx
__int64 v12; // rcx
cocos2d::CCString *v13; // rax
const char *v14; // rax
cocos2d::CCString *v15; // rax
char *v16; // rax
size_t v17; // r8
__int64 v18; // rdx
__int64 v19; // rcx
__int64 v20; // r8
__int64 v21; // r9
void **v22; // r12
char *v23; // rdi
unsigned __int64 v24; // r15
__int64 v25; // rsi
unsigned __int64 v26; // r14
_QWORD *v27; // rdx
char *v28; // rax
int v29; // [rsp+20h] [rbp-B9h]
int v30; // [rsp+28h] [rbp-B1h]
__int128 v31; // [rsp+40h] [rbp-99h] BYREF
unsigned __int64 v32; // [rsp+50h] [rbp-89h]
__int64 v33; // [rsp+58h] [rbp-81h]
__int128 v34; // [rsp+60h] [rbp-79h] BYREF
__int64 v35; // [rsp+70h] [rbp-69h]
__int64 v36; // [rsp+78h] [rbp-61h]
__int128 v37; // [rsp+80h] [rbp-59h] BYREF
__int64 v38; // [rsp+90h] [rbp-49h]
__int64 v39; // [rsp+98h] [rbp-41h]
__int128 *v40; // [rsp+A0h] [rbp-39h]
__int128 *v41; // [rsp+A8h] [rbp-31h]
void *Src[2]; // [rsp+B8h] [rbp-21h] BYREF
unsigned __int64 v43; // [rsp+C8h] [rbp-11h]
unsigned __int64 v44; // [rsp+D0h] [rbp-9h]
_QWORD v45[4]; // [rsp+D8h] [rbp-1h] BYREF
v6 = cocos2d::CCString::createWithFormat("topArtists_%i", a2);
CString = cocos2d::CCString::getCString(v6);
*(_OWORD *)Src = 0;
v43 = 0;
v44 = 0;
v8 = -1;
v9 = -1;
do
++v9;
while ( CString[v9] );
sub_14003A930(Src, CString, v9);
v10 = Src;
if ( v44 > 0xF )
v10 = (void **)Src[0];
if ( GameLevelManager::isDLActive(a1, (const char *)v10) )
{
v24 = v44;
v23 = (char *)Src[0];
}
else
{
v11 = Src;
if ( v44 > 0xF )
v11 = (void **)Src[0];
GameLevelManager::addDLToActive(a1, (const char *)v11);
GameLevelManager::getBasePostString(v12, v45);
v30 = 98;
v29 = 103;
v13 = cocos2d::CCString::createWithFormat(
"%c%s%s%c%c%s",
87,
"mfd",
"2893",
v29,
v30,
(const char *)&word_140531E88);
v14 = cocos2d::CCString::getCString(v13);
v15 = cocos2d::CCString::createWithFormat("&page=%i&secret=%s&total=%i", a2, v14, a3);
v16 = (char *)cocos2d::CCString::getCString(v15);
v17 = -1;
do
++v17;
while ( v16[v17] );
sub_140041270(v45, v16, v17);
v40 = &v31;
v41 = &v37;
v31 = 0;
v32 = 0;
v33 = 0;
v22 = Src;
v23 = (char *)Src[0];
v24 = v44;
if ( v44 > 0xF )
v22 = (void **)Src[0];
v25 = 0x7FFFFFFFFFFFFFFFLL;
v26 = v43;
if ( v43 > 0x7FFFFFFFFFFFFFFFLL )
sub_140007B50(v19, v18, v20, v21);
v33 = 15;
if ( v43 > 0xF )
{
if ( (v43 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL )
{
v25 = v43 | 0xF;
if ( (v43 | 0xF) < 0x16 )
v25 = 22;
}
*(_QWORD *)&v31 = sub_14003AA10(v25 + 1);
v32 = v26;
v33 = v25;
memcpy((void *)v31, v22, v26 + 1);
}
else
{
v32 = v43;
v31 = *(_OWORD *)v22;
}
v27 = v45;
if ( v45[3] > 0xFu )
v27 = (_QWORD *)v45[0];
v37 = 0;
v38 = 0;
v39 = 0;
do
++v8;
while ( *((_BYTE *)v27 + v8) );
sub_14003A930(&v37, v27, v8);
v34 = 0;
v35 = 0;
v36 = 15;
*(_QWORD *)&v34 = sub_14003AA10(0x40u);
v35 = 54;
v36 = 63;
strcpy((char *)v34, "https://www.boomlings.com/database/getGJTopArtists.php");
GameLevelManager::ProcessHttpRequest(a1, (__int64)&v34, (const char *)&v37, (const char *)&v31, 53);
sub_14003A830((__int64)v45);
}
if ( v24 > 0xF )
{
v28 = v23;
if ( v24 + 1 >= 0x1000 )
{
v23 = *((char **)v23 - 1);
if ( (unsigned __int64)(v28 - v23 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v23);
}
}