//
// GJComment::create from 0x100550a20 to 0x1005510eb (1739 bytes)
//
// 3 xrefs:
// > GameLevelManager::createAndGetCommentsFull @ 0x1005504a3
// > GameLevelManager::createAndGetCommentsFull @ 0x100550780
// > GJMultiplayerManager::addComment @ 0x10065af83
//
// 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
//
GJComment *__fastcall GJComment::create(cocos2d::CCDictionary *a1)
{
double v1; // xmm0_8
cocos2d::CCString *v2; // rax
const char *CString; // r14
size_t v4; // rax
std::string::size_type v5; // r15
char *data; // r12
size_t v7; // r13
cocos2d::CCString *v8; // rax
int v9; // r14d
cocos2d::CCString *v10; // rax
int v11; // r15d
cocos2d::CCString *v12; // rax
const char *v13; // rax
int v14; // r12d
cocos2d::CCString *v15; // rax
cocos2d::CCString *v16; // rax
cocos2d::CCString *v17; // rax
const char *v18; // r14
size_t v19; // rax
size_t v20; // r15
char *v21; // r12
cocos2d::CCString *v22; // rax
int v23; // r14d
cocos2d::CCString *v24; // rax
int v25; // r15d
cocos2d::CCString *v26; // rax
int v27; // r12d
GJComment *v28; // r14
size_t v29; // r13
char v30; // r13
cocos2d::CCString *v31; // rax
const char *v32; // rbx
size_t v33; // rax
size_t v34; // r15
char *v35; // r12
char *v36; // rbx
size_t v37; // r13
size_t v38; // rax
size_t v39; // r15
char *v40; // r12
size_t v41; // r13
cocos2d::CCArray *v42; // rbx
cocos2d::CCString *v43; // rax
unsigned __int8 v44; // r15
cocos2d::CCString *v45; // rax
__int16 v46; // r12
cocos2d::CCString *v47; // rax
std::string __str; // [rsp+0h] [rbp-100h] BYREF
std::string v50; // [rsp+20h] [rbp-E0h] BYREF
std::string v51; // [rsp+40h] [rbp-C0h] BYREF
std::string __dst; // [rsp+58h] [rbp-A8h] BYREF
int v53; // [rsp+74h] [rbp-8Ch]
int v54; // [rsp+78h] [rbp-88h]
int v55; // [rsp+7Ch] [rbp-84h]
int v56; // [rsp+80h] [rbp-80h]
int v57; // [rsp+84h] [rbp-7Ch]
_QWORD v58[2]; // [rsp+88h] [rbp-78h] BYREF
void *v59; // [rsp+98h] [rbp-68h]
_QWORD v60[2]; // [rsp+A0h] [rbp-60h] BYREF
char *__s; // [rsp+B0h] [rbp-50h]
bool v62; // [rsp+BFh] [rbp-41h]
__int128 v63; // [rsp+C0h] [rbp-40h] BYREF
void *v64; // [rsp+D0h] [rbp-30h]
LOWORD(v63) = 12802;
BYTE2(v63) = 0;
v2 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)&v63);
CString = cocos2d::CCString::getCString(v2);
v4 = strlen(CString);
if ( v4 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v1);
v5 = v4;
if ( v4 >= 0x17 )
{
v7 = 26;
if ( (v4 | 7) != 0x17 )
v7 = (v4 | 7) + 1;
data = (char *)operator new(v7);
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst.__r_.__value_.__r.__words[0] = v7 | 1;
__dst.__r_.__value_.__l.__size_ = v5;
goto LABEL_8;
}
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v4);
data = __dst.__r_.__value_.__s.__data_;
if ( v4 )
LABEL_8:
memmove(data, CString, v5);
data[v5] = 0;
LevelTools::base64DecodeString(&v51, &__dst, v1);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
if ( (v63 & 1) != 0 )
operator delete(v64);
LOWORD(v63) = 13058;
BYTE2(v63) = 0;
v8 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)&v63);
v9 = cocos2d::CCString::intValue(v8);
if ( (v63 & 1) != 0 )
operator delete(v64);
LOWORD(v63) = 13314;
BYTE2(v63) = 0;
v10 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)&v63);
v11 = cocos2d::CCString::intValue(v10);
if ( (v63 & 1) != 0 )
operator delete(v64);
LOWORD(v63) = 13826;
BYTE2(v63) = 0;
v12 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)&v63);
v13 = cocos2d::CCString::getCString(v12);
v14 = atoi(v13);
if ( (v63 & 1) != 0 )
operator delete(v64);
LOWORD(v63) = 14082;
BYTE2(v63) = 0;
v15 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)&v63);
v62 = cocos2d::CCString::boolValue(v15);
if ( (v63 & 1) != 0 )
operator delete(v64);
LOWORD(v63) = 14338;
BYTE2(v63) = 0;
v16 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)&v63);
v53 = cocos2d::CCString::intValue(v16);
v56 = v14;
v55 = v11;
v54 = v9;
if ( (v63 & 1) != 0 )
operator delete(v64);
LOWORD(v60[0]) = 14594;
BYTE2(v60[0]) = 0;
v17 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)v60);
v18 = cocos2d::CCString::getCString(v17);
v19 = strlen(v18);
if ( v19 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v1);
v20 = v19;
if ( v19 >= 0x17 )
{
v29 = 26;
if ( (v19 | 7) != 0x17 )
v29 = (v19 | 7) + 1;
v21 = (char *)operator new(v29);
v64 = v21;
*(_QWORD *)&v63 = v29 | 1;
*((_QWORD *)&v63 + 1) = v20;
}
else
{
LOBYTE(v63) = 2 * v19;
v21 = (char *)&v63 + 1;
if ( !v19 )
{
BYTE1(v63) = 0;
if ( (v60[0] & 1) == 0 )
goto LABEL_28;
goto LABEL_27;
}
}
memmove(v21, v18, v20);
v21[v20] = 0;
if ( (v60[0] & 1) != 0 )
LABEL_27:
operator delete(__s);
LABEL_28:
LOBYTE(v60[0]) = 4;
*(_WORD *)((char *)v60 + 1) = 12337;
BYTE3(v60[0]) = 0;
v22 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)v60);
v23 = cocos2d::CCString::intValue(v22);
if ( (v60[0] & 1) != 0 )
operator delete(__s);
LOBYTE(v60[0]) = 4;
*(_WORD *)((char *)v60 + 1) = 12593;
BYTE3(v60[0]) = 0;
v24 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)v60);
v25 = cocos2d::CCString::intValue(v24);
if ( (v60[0] & 1) != 0 )
operator delete(__s);
LOWORD(v60[0]) = 12546;
BYTE2(v60[0]) = 0;
v26 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)v60);
v27 = cocos2d::CCString::intValue(v26);
v57 = v23;
if ( (v60[0] & 1) != 0 )
operator delete(__s);
v28 = GJComment::create_1();
if ( (*(_BYTE *)&v51.__r_.__value_.__s.0 & 1) != 0 )
{
sub_100006B70(&__str, v51.__r_.__value_.__l.__data_, v51.__r_.__value_.__l.__size_, v1);
}
else
{
__str = v51;
v1 = *(double *)v51.__r_.__value_.__r.__words;
}
std::string::operator=((std::string *)&v28->m_commentString, &__str);
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__str.__r_.__value_.__l.__data_);
v28->m_userID = v54;
v28->m_likeCount = v55;
v28->m_commentID = v56;
v28->m_isSpam = v62;
v28->m_accountID = v53;
v30 = v63 & 1;
if ( (v63 & 1) != 0 )
{
sub_100006B70(&v50, v64, *((unsigned __int64 *)&v63 + 1), v1);
}
else
{
v50.__r_.__value_.__r.__words[2] = (std::string::size_type)v64;
v1 = *(double *)&v63;
*(_OWORD *)&v50.__r_.__value_.__l.0 = v63;
}
std::string::operator=((std::string *)&v28->m_uploadDate, &v50);
if ( (*(_BYTE *)&v50.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v50.__r_.__value_.__l.__data_);
v28->m_percentage = v57;
v28->m_modBadge = v25;
v28->m_levelID = v27;
if ( v27 )
v28->m_hasLevelID = 1;
if ( v25 > 0 )
{
LOBYTE(v58[0]) = 4;
*(_WORD *)((char *)v58 + 1) = 12849;
BYTE3(v58[0]) = 0;
v31 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey_1((__int64)a1, (__int64)v58);
v32 = cocos2d::CCString::getCString(v31);
v33 = strlen(v32);
if ( v33 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v1);
v34 = v33;
if ( v33 >= 0x17 )
{
v37 = 26;
if ( (v33 | 7) != 0x17 )
v37 = (v33 | 7) + 1;
v35 = (char *)operator new(v37);
__s = v35;
v60[0] = v37 | 1;
v60[1] = v34;
}
else
{
LOBYTE(v60[0]) = 2 * v33;
v35 = (char *)v60 + 1;
if ( !v33 )
{
BYTE1(v60[0]) = 0;
if ( (v58[0] & 1) == 0 )
goto LABEL_57;
goto LABEL_56;
}
}
memmove(v35, v32, v34);
v35[v34] = 0;
if ( (v58[0] & 1) == 0 )
{
LABEL_57:
if ( (v60[0] & 1) != 0 )
v36 = __s;
else
v36 = (char *)v60 + 1;
v38 = strlen(v36);
if ( v38 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v1);
v39 = v38;
if ( v38 >= 0x17 )
{
v41 = 26;
if ( (v38 | 7) != 0x17 )
v41 = (v38 | 7) + 1;
v40 = (char *)operator new(v41);
v59 = v40;
v58[0] = v41 | 1;
v58[1] = v39;
}
else
{
LOBYTE(v58[0]) = 2 * v38;
v40 = (char *)v58 + 1;
if ( !v38 )
goto LABEL_73;
}
memmove(v40, v36, v39);
LABEL_73:
v40[v39] = 0;
v42 = (cocos2d::CCArray *)sub_10052DD30((unsigned __int8 *)v58, ",", v1);
if ( (v58[0] & 1) != 0 )
operator delete(v59);
if ( (unsigned int)sub_100720070(v42) >= 3 )
{
v43 = cocos2d::CCArray::stringAtIndex(v42, 0);
v44 = cocos2d::CCString::intValue(v43);
v45 = cocos2d::CCArray::stringAtIndex(v42, 1u);
v46 = cocos2d::CCString::intValue(v45);
v47 = cocos2d::CCArray::stringAtIndex(v42, 2u);
v28->m_color.b = cocos2d::CCString::intValue(v47);
*(_WORD *)&v28->m_color.r = (v46 << 8) | v44;
}
if ( (v60[0] & 1) != 0 )
operator delete(__s);
v30 = v63 & 1;
goto LABEL_80;
}
LABEL_56:
operator delete(v59);
goto LABEL_57;
}
LABEL_80:
if ( v30 )
operator delete(v64);
if ( (*(_BYTE *)&v51.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v51.__r_.__value_.__l.__data_);
return v28;
}