//
// GameLevelManager::createAndGetCommentsFull from 0x7179c4 to 0x718028 (1636 bytes)
//
// 3 xrefs:
// > GameLevelManager::createAndGetLevelComments @ 0x71806c
// > GameLevelManager::createAndGetAccountComments @ 0x7186d0
// > ??> @ 0xac458
//
// 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
//
cocos2d::CCArray *__fastcall GameLevelManager::createAndGetCommentsFull(
_QWORD *a1,
__int64 a2,
int a3,
unsigned __int8 a4)
{
int v4; // w26
cocos2d::CCArray *v5; // x27
cocos2d::CCArray *v6; // x24
char *v7; // x0
unsigned int v8; // w20
cocos2d::CCString *v9; // x0
char *CString; // x0
cocos2d::CCArray *v11; // x19
cocos2d::CCString *v12; // x0
char *v13; // x0
cocos2d::CCString *v14; // x0
char *v15; // x0
char **v16; // x25
GJComment *v17; // x0
char *v18; // x1
GJComment *v19; // x19
char *v20; // x0
char **v21; // x25
GJUserScore *v22; // x25
char *v23; // x1
__int64 *v24; // x0
cocos2d::CCObject *m_userScore; // x0
int m_accountID; // w25
char *v27; // x0
char *v28; // x0
__int64 v29; // x1
__int64 *v30; // x0
void *v31; // x0
unsigned int *v33; // x1
int v34; // w2
unsigned int *v35; // x1
int v36; // w2
unsigned int *v37; // x1
int v38; // w2
char *v39; // x0
unsigned int *v40; // x1
int v41; // w2
unsigned int *v42; // x1
int v43; // w2
unsigned int *v44; // x1
int v45; // w2
unsigned int *v46; // x1
int v47; // w2
unsigned int *v48; // x1
int v49; // w2
__int64 v50; // [xsp+0h] [xbp+0h] BYREF
_QWORD *v51; // [xsp+60h] [xbp+60h]
char **v52; // [xsp+68h] [xbp+68h]
char *v53; // [xsp+70h] [xbp+70h]
int m_userID; // [xsp+78h] [xbp+78h]
int v55; // [xsp+7Ch] [xbp+7Ch]
int v56[2]; // [xsp+80h] [xbp+80h]
char **v57; // [xsp+88h] [xbp+88h]
__int64 v58; // [xsp+98h] [xbp+98h] BYREF
__int64 v59; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v60; // [xsp+A8h] [xbp+A8h] BYREF
__int64 v61; // [xsp+B0h] [xbp+B0h] BYREF
char *v62; // [xsp+B8h] [xbp+B8h] BYREF
char *v63; // [xsp+C0h] [xbp+C0h] BYREF
v51 = a1;
*(_QWORD *)v56 = a2;
v55 = a3;
v4 = a4;
v57 = (char **)&v61;
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create(_stack_chk_guard);
sub_D153B8((int)&v63, **(char ***)v56);
v6 = sub_6F004C(&v63, "|");
v7 = v63 - 24;
if ( v63 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v48 = (unsigned int *)(v63 - 8);
do
v49 = __ldaxr(v48);
while ( __stlxr(v49 - 1, v48) );
}
else
{
v49 = *((_DWORD *)v63 - 2);
*((_DWORD *)v63 - 2) = v49 - 1;
}
if ( v49 <= 0 )
operator delete(v7);
}
v8 = 0;
v53 = ":";
*(_QWORD *)v56 = &v59;
v52 = (char **)&v60;
while ( v8 < (unsigned int)cocos2d::CCArray::count(v6) )
{
v9 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v6, v8);
CString = (char *)cocos2d::CCString::getCString(v9);
sub_D153B8((unsigned int)&v50 + 152, CString);
if ( v4 )
{
sub_D18D28(&v63);
GameLevelManager::responseToDict(&v63, 1u);
v19 = GJComment::create();
v39 = v63 - 24;
if ( v63 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v40 = (unsigned int *)(v63 - 8);
do
v41 = __ldaxr(v40);
while ( __stlxr(v41 - 1, v40) );
}
else
{
v41 = *((_DWORD *)v63 - 2);
*((_DWORD *)v63 - 2) = v41 - 1;
}
if ( v41 <= 0 )
operator delete(v39);
}
if ( !v19 )
goto LABEL_19;
v19->m_accountID = v55;
}
else
{
v11 = sub_6F004C(&v58, v53);
if ( (unsigned int)cocos2d::CCArray::count(v11) <= 1 )
goto LABEL_19;
v12 = cocos2d::CCArray::stringAtIndex(v11, 0);
v13 = (char *)cocos2d::CCString::getCString(v12);
sub_D153B8(v56[0], v13);
v14 = cocos2d::CCArray::stringAtIndex(v11, 1u);
v15 = (char *)cocos2d::CCString::getCString(v14);
sub_D153B8((int)&v63, v15);
v16 = v52;
sub_D18D28(v52);
GameLevelManager::responseToDict(v16, 1u);
v17 = GJComment::create();
v18 = *v16;
v19 = v17;
v20 = *v16 - 24;
if ( v20 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v42 = (unsigned int *)(v18 - 8);
do
v43 = __ldaxr(v42);
while ( __stlxr(v43 - 1, v42) );
}
else
{
v43 = *((_DWORD *)v18 - 2);
*((_DWORD *)v18 - 2) = v43 - 1;
}
if ( v43 <= 0 )
operator delete(v20);
}
v21 = v57;
sub_D18D28(v57);
v57 = v21;
GameLevelManager::responseToDict(v21, 1u);
v22 = GJUserScore::create();
v23 = *v57;
v24 = (__int64 *)(*v57 - 24);
if ( v24 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v37 = (unsigned int *)(v23 - 8);
do
v38 = __ldaxr(v37);
while ( __stlxr(v38 - 1, v37) );
}
else
{
v38 = *((_DWORD *)v23 - 2);
*((_DWORD *)v23 - 2) = v38 - 1;
}
if ( v38 <= 0 )
operator delete(v24);
}
if ( v22 )
{
if ( v22 != v19->m_userScore )
{
cocos2d::CCObject::retain(v22);
m_userScore = v19->m_userScore;
if ( m_userScore )
cocos2d::CCObject::release(m_userScore);
v19->m_userScore = v22;
}
m_userID = v19->m_userID;
m_accountID = v22->m_accountID;
sub_D18D28(&v62);
GameLevelManager::storeUserName(v51, m_userID, m_accountID, &v62);
v27 = v62 - 24;
if ( v62 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v46 = (unsigned int *)(v62 - 8);
do
v47 = __ldaxr(v46);
while ( __stlxr(v47 - 1, v46) );
}
else
{
v47 = *((_DWORD *)v62 - 2);
*((_DWORD *)v62 - 2) = v47 - 1;
}
if ( v47 <= 0 )
operator delete(v27);
}
}
v28 = v63 - 24;
if ( v63 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v44 = (unsigned int *)(v63 - 8);
do
v45 = __ldaxr(v44);
while ( __stlxr(v45 - 1, v44) );
}
else
{
v45 = *((_DWORD *)v63 - 2);
*((_DWORD *)v63 - 2) = v45 - 1;
}
if ( v45 <= 0 )
operator delete(v28);
}
v29 = **(_QWORD **)v56;
v30 = (__int64 *)(**(_QWORD **)v56 - 24LL);
if ( v30 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v35 = (unsigned int *)(v29 - 8);
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
}
else
{
v36 = *(_DWORD *)(v29 - 8);
*(_DWORD *)(v29 - 8) = v36 - 1;
}
if ( v36 <= 0 )
operator delete(v30);
}
if ( !v19 )
goto LABEL_19;
if ( !v19->m_levelID )
v19->m_levelID = v55;
}
cocos2d::CCArray::addObject(v5, v19);
LABEL_19:
v31 = (void *)(v58 - 24);
if ( (__int64 *)(v58 - 24) == &qword_124B6B0 )
goto LABEL_20;
if ( &pthread_create )
{
v33 = (unsigned int *)(v58 - 8);
do
v34 = __ldaxr(v33);
while ( __stlxr(v34 - 1, v33) );
}
else
{
v34 = *(_DWORD *)(v58 - 8);
*(_DWORD *)(v58 - 8) = v34 - 1;
}
if ( v34 > 0 )
{
LABEL_20:
++v8;
}
else
{
++v8;
operator delete(v31);
}
}
return v5;
}