//
// GameLevelManager::getLevelComments from 0x10054f770 to 0x10054fb7d (1037 bytes)
//
// 3 xrefs:
// > InfoLayer::loadPage @ 0x1007b15f2
// > InfoLayer::updateUserScoreFinished @ 0x1007b2d2d
// > sub_1007B2D40 @ 0x1007b2df4
//
// 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 __fastcall GameLevelManager::getLevelComments(
GameLevelManager *a1,
int a2,
int a3,
int a4,
int a5,
CommentKeyType a6)
{
__m128 v6; // xmm0
cocos2d::CCString *v7; // rax
const char *CString; // r14
size_t v9; // rax
size_t v10; // r13
char *v11; // r15
size_t v12; // r12
char v13; // r13
char v14; // r12
const char *v15; // r14
cocos2d::CCString *v16; // rax
cocos2d::CCString *v17; // rax
const char *v18; // rax
const std::string::value_type *v19; // rsi
cocos2d::CCString *v20; // rax
const char *v21; // rax
GameManager *v22; // rax
int v23; // ebx
GameManager *v24; // rax
cocos2d::CCString *v25; // rax
const char *v26; // rax
CommentKeyType v27; // r14d
size_t v28; // rbx
void *v29; // r15
const char *v30; // rsi
const char *data; // rbx
size_t v32; // rax
size_t v33; // r14
char *v34; // r12
size_t v35; // r13
char v36; // [rsp+0h] [rbp-D0h]
char v37; // [rsp+0h] [rbp-D0h]
char v38; // [rsp+0h] [rbp-D0h]
char v39; // [rsp+0h] [rbp-D0h]
std::string v40; // [rsp+8h] [rbp-C8h] BYREF
__int128 v41; // [rsp+20h] [rbp-B0h] BYREF
void *v42; // [rsp+30h] [rbp-A0h]
_QWORD v43[2]; // [rsp+40h] [rbp-90h] BYREF
void *v44; // [rsp+50h] [rbp-80h]
int v45; // [rsp+5Ch] [rbp-74h]
int v46; // [rsp+60h] [rbp-70h]
int v47; // [rsp+64h] [rbp-6Ch]
std::string v48; // [rsp+68h] [rbp-68h] BYREF
GameLevelManager *v49; // [rsp+80h] [rbp-50h]
__int128 __dst; // [rsp+88h] [rbp-48h] BYREF
void *__p; // [rsp+98h] [rbp-38h]
CommentKeyType v52; // [rsp+A4h] [rbp-2Ch]
v46 = a4;
v47 = a2;
v45 = a5;
v52 = a6;
v7 = (cocos2d::CCString *)sub_1007AB580("comment_%i_%i_%i_%i", v36);
CString = cocos2d::CCString::getCString(v7);
v9 = strlen(CString);
if ( v9 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)v6.i64);
v10 = v9;
v49 = a1;
if ( v9 >= 0x17 )
{
v12 = 26;
if ( (v9 | 7) != 0x17 )
v12 = (v9 | 7) + 1;
v11 = (char *)operator new(v12);
__p = v11;
*(_QWORD *)&__dst = v12 + 1;
*((_QWORD *)&__dst + 1) = v10;
goto LABEL_8;
}
LOBYTE(__dst) = 2 * v9;
v11 = (char *)&__dst + 1;
if ( v9 )
LABEL_8:
memmove(v11, CString, v10);
v11[v10] = 0;
v13 = __dst;
v14 = __dst & 1;
if ( (__dst & 1) != 0 )
v15 = (const char *)__p;
else
v15 = (char *)&__dst + 1;
if ( GameLevelManager::isDLActive(v49, v15) )
goto LABEL_40;
GameLevelManager::addDLToActive(v49, v15);
GameLevelManager::getBasePostString(&v48, v6);
v16 = (cocos2d::CCString *)sub_1007AB580("%c%s%s%c%c%s", (char)"7");
cocos2d::CCString::getCString(v16);
v17 = (cocos2d::CCString *)sub_1007AB580("&page=%i&total=%i&secret=%s&mode=%i", v37);
v18 = cocos2d::CCString::getCString(v17);
std::string::append(&v48, v18);
v19 = "&levelID=";
if ( v52 == 1 )
v19 = "&userID=";
std::string::append(&v48, v19);
v20 = (cocos2d::CCString *)sub_1007AB580("%i", v38);
v21 = cocos2d::CCString::getCString(v20);
std::string::append(&v48, v21);
v22 = GameManager::sharedState();
v23 = 10;
if ( GameManager::getGameVariable(v22, "0088") )
v23 = 20;
v24 = GameManager::sharedState();
if ( (unsigned int)(v23 << GameManager::getGameVariable(v24, "0094")) >= 0xB )
{
v25 = (cocos2d::CCString *)sub_1007AB580("&count=%i", v39);
v26 = cocos2d::CCString::getCString(v25);
std::string::append(&v48, v26);
}
v27 = v52;
v28 = 4LL * (v52 == 1) + 54;
v29 = operator new((v28 | 7) + 1);
v30 = "https://www.boomlings.com/database/getGJComments21.php";
if ( v27 == 1 )
v30 = "https://www.boomlings.com/database/getGJCommentHistory.php";
memcpy(v29, v30, v28);
*((_BYTE *)v29 + v28) = 0;
sub_100006B70(&v40, v29, v28, *(double *)v6.i64);
if ( (*(_BYTE *)&v48.__r_.__value_.__s.0 & 1) != 0 )
data = v48.__r_.__value_.__l.__data_;
else
data = v48.__r_.__value_.__s.__data_;
v32 = strlen(data);
if ( v32 >= 0xFFFFFFFFFFFFFFF8LL )
{
LOBYTE(v52) = v13;
sub_100006BF0(*(double *)v6.i64);
}
v33 = v32;
if ( v32 >= 0x17 )
{
LOBYTE(v52) = v13;
v35 = 26;
if ( (v32 | 7) != 0x17 )
v35 = (v32 | 7) + 1;
v34 = (char *)operator new(v35);
v44 = v34;
v43[0] = v35 | 1;
v43[1] = v33;
goto LABEL_31;
}
LOBYTE(v43[0]) = 2 * v32;
v34 = (char *)v43 + 1;
if ( v32 )
LABEL_31:
memmove(v34, data, v33);
v34[v33] = 0;
v14 = __dst & 1;
if ( (__dst & 1) != 0 )
{
sub_100006B70(&v41, __p, *((unsigned __int64 *)&__dst + 1), *(double *)v6.i64);
}
else
{
v42 = __p;
v41 = __dst;
}
GameLevelManager::ProcessHttpRequest(v49, &v40, (__int64)v43, (__int64)&v41, 12);
if ( (v41 & 1) == 0 )
{
if ( (v43[0] & 1) == 0 )
goto LABEL_37;
LABEL_44:
operator delete(v44);
if ( (*(_BYTE *)&v40.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_38:
operator delete(v29);
if ( (*(_BYTE *)&v48.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_40;
goto LABEL_39;
}
goto LABEL_45;
}
operator delete(v42);
if ( (v43[0] & 1) != 0 )
goto LABEL_44;
LABEL_37:
if ( (*(_BYTE *)&v40.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_38;
LABEL_45:
operator delete(v40.__r_.__value_.__l.__data_);
operator delete(v29);
if ( (*(_BYTE *)&v48.__r_.__value_.__s.0 & 1) != 0 )
LABEL_39:
operator delete(v48.__r_.__value_.__l.__data_);
LABEL_40:
if ( v14 )
operator delete(__p);
}