//
// GameLevelManager::getLevelComments from 0x723778 to 0x723d50 (1496 bytes)
//
// 3 xrefs:
// > InfoLayer::updateUserScoreFinished @ 0x7e1e58
// > InfoLayer::loadPage @ 0x7e3508
// > ??> @ 0x991e0
//
// 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
//
// local variable allocation has failed, the output may be wrong!
void GameLevelManager::getLevelComments(GameLevelManager *a1, int a2, int a3, int a4, int a5, CommentKeyType a6)
{
char *v12; // x0
cocos2d::CCString *v13; // x0
const char *CString; // x0
cocos2d::CCString *v15; // x0
size_t v16; // x0
cocos2d::CCString *v17; // x0
size_t v18; // x0
GameManager *v19; // x0
char *v20; // x23
GameManager *v21; // x0
char *v22; // x1
int *p_m_unknown2; // x0
char *v24; // x0
char *v25; // x0
void *v26; // x0
char *v27; // x0
unsigned int *v28; // x1
int v29; // w2
cocos2d::CCString *v30; // x0
size_t v31; // x0
unsigned int *v32; // x2
int v33; // w1
unsigned int *v34; // x1
int v35; // w2
unsigned int *v36; // x1
int v37; // w2
unsigned int *v38; // x1
int v39; // w2
unsigned int *v40; // x1
int v41; // w2
unsigned int *p_timeoutForConnect; // x1
int timeoutForConnect; // w2
const char *v44; // [xsp+68h] [xbp+68h]
const char *v45; // [xsp+68h] [xbp+68h]
const char *v46; // [xsp+68h] [xbp+68h]
char *v47; // [xsp+88h] [xbp+88h] BYREF
char *v48; // [xsp+90h] [xbp+90h] BYREF
__int64 v49; // [xsp+98h] [xbp+98h] BYREF
const char *v50; // [xsp+A0h] [xbp+A0h] BYREF
const char *v51; // [xsp+A8h] [xbp+A8h] BYREF
cocos2d::extension::CCHttpClient *v52; // [xsp+B0h] [xbp+B0h] BYREF
GameLevelManager::getCommentKey(*(const char **)&a2, (__int64)&v47);
if ( !GameLevelManager::isDLActive(a1, v47) )
{
GameLevelManager::addDLToActive(a1, v47);
GameLevelManager::getBasePostString(a1, (__int64)&v48);
v13 = (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(v13);
v15 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&page=%i&total=%i&secret=%s&mode=%i",
(const char *)(unsigned int)a3,
(unsigned int)a4,
CString,
(unsigned int)a5);
v44 = cocos2d::CCString::getCString(v15);
v16 = strlen(v44);
sub_D15FD4(&v48, v44, v16);
if ( a6 == 1 )
sub_D15FD4(&v48, "&userID=", 8);
else
sub_D15FD4(&v48, "&levelID=", 9);
v17 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)(unsigned int)a2);
v45 = cocos2d::CCString::getCString(v17);
v18 = strlen(v45);
sub_D15FD4(&v48, v45, v18);
v19 = GameManager::sharedState();
if ( GameManager::getGameVariable(v19, "0088") )
LODWORD(v20) = 20;
else
v20 = &byte_9[1];
v21 = GameManager::sharedState();
if ( GameManager::getGameVariable(v21, "0094") )
{
LODWORD(v20) = 2 * (_DWORD)v20;
}
else if ( (_DWORD)v20 == 10 )
{
goto LABEL_11;
}
v30 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"&count=%i",
(const char *)(unsigned int)v20);
v46 = cocos2d::CCString::getCString(v30);
v31 = strlen(v46);
sub_D15FD4(&v48, v46, v31);
LABEL_11:
if ( a6 == 1 )
v22 = "https://www.boomlings.com/database/getGJCommentHistory.php";
else
v22 = "https://www.boomlings.com/database/getGJComments21.php";
sub_D153B8((int)&v49, v22);
sub_D18D28(&v50);
sub_D153B8((int)&v51, v48);
sub_D18D28(&v52);
GameLevelManager::ProcessHttpRequest(a1, &v50, &v51, &v52, 12);
p_m_unknown2 = &v52[-1].m_unknown2;
if ( &v52[-1].m_unknown2 != (int *)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_timeoutForConnect = (unsigned int *)&v52[-1]._timeoutForConnect;
do
timeoutForConnect = __ldaxr(p_timeoutForConnect);
while ( __stlxr(timeoutForConnect - 1, p_timeoutForConnect) );
}
else
{
timeoutForConnect = v52[-1]._timeoutForConnect;
v52[-1]._timeoutForConnect = timeoutForConnect - 1;
}
if ( timeoutForConnect <= 0 )
operator delete(p_m_unknown2);
}
v24 = (char *)(v51 - 24);
if ( v51 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v38 = (unsigned int *)(v51 - 8);
do
v39 = __ldaxr(v38);
while ( __stlxr(v39 - 1, v38) );
}
else
{
v39 = *((_DWORD *)v51 - 2);
*((_DWORD *)v51 - 2) = v39 - 1;
}
if ( v39 <= 0 )
operator delete(v24);
}
v25 = (char *)(v50 - 24);
if ( v50 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v40 = (unsigned int *)(v50 - 8);
do
v41 = __ldaxr(v40);
while ( __stlxr(v41 - 1, v40) );
}
else
{
v41 = *((_DWORD *)v50 - 2);
*((_DWORD *)v50 - 2) = v41 - 1;
}
if ( v41 <= 0 )
operator delete(v25);
}
v26 = (void *)(v49 - 24);
if ( (__int64 *)(v49 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v36 = (unsigned int *)(v49 - 8);
do
v37 = __ldaxr(v36);
while ( __stlxr(v37 - 1, v36) );
}
else
{
v37 = *(_DWORD *)(v49 - 8);
*(_DWORD *)(v49 - 8) = v37 - 1;
}
if ( v37 <= 0 )
operator delete(v26);
}
v27 = v48 - 24;
if ( v48 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v34 = (unsigned int *)(v48 - 8);
do
v35 = __ldaxr(v34);
while ( __stlxr(v35 - 1, v34) );
}
else
{
v35 = *((_DWORD *)v48 - 2);
*((_DWORD *)v48 - 2) = v35 - 1;
}
if ( v35 <= 0 )
operator delete(v27);
}
v12 = v47 - 24;
if ( v47 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v28 = (unsigned int *)(v47 - 8);
do
v29 = __ldaxr(v28);
while ( __stlxr(v29 - 1, v28) );
}
else
{
v29 = *((_DWORD *)v47 - 2);
*((_DWORD *)v47 - 2) = v29 - 1;
}
if ( v29 <= 0 )
goto LABEL_23;
}
return;
}
v12 = v47 - 24;
if ( v47 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v32 = (unsigned int *)(v47 - 8);
do
v33 = __ldaxr(v32);
while ( __stlxr(v33 - 1, v32) );
}
else
{
v33 = *((_DWORD *)v47 - 2);
*((_DWORD *)v47 - 2) = v33 - 1;
}
if ( v33 <= 0 )
LABEL_23:
operator delete(v12);
}
}