//
// CommentOptionsPopup::init from 0xcff8a4 to 0xd00124 (2176 bytes)
//
// 2 xrefs:
// > CommentOptionsPopup::create @ 0xd0036c
// > ??> @ 0xbca10
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:06:53 +0000
//
__int64 __fastcall CommentOptionsPopup::init(cocos2d::CCNode **this, GJComment *a2, unsigned __int8 a3)
{
int v5; // w23
unsigned __int8 v6; // w0
unsigned int v7; // w21
cocos2d::CCDirector *v9; // x0
cocos2d::CCDirector *v10; // x0
__int64 v11; // x0
__int64 *v12; // x24
float v13; // s9
float v14; // s11
float v15; // s8
void *v16; // x2
__int64 v17; // x0
GameLevelManager *v18; // x1
GameLevelManager *v19; // x0
__int64 v20; // x22
__int64 v21; // x1
int v22; // w0
const char *v23; // x2
const char *v24; // x1
cocos2d::CCLabelBMFont *v25; // x0
__int64 v26; // x24
void (__fastcall *v27)(__int64, __int64 *); // x25
__int64 v28; // x22
__int64 v29; // x24
void (__fastcall *v30)(__int64, __int64 *); // x26
cocos2d::CCNode *v31; // x27
const char *v32; // x1
__int64 v33; // x0
__int64 v34; // x24
cocos2d::CCNode *v35; // x27
void (__fastcall *v36)(__int64, __int64 *); // x26
__int64 v37; // x0
__int64 v38; // x2
__int64 v39; // x0
__int64 v40; // x1
const char *v41; // x1
size_t v42; // x0
EmoteSprite *v43; // x0
int v44; // w0
__int64 v45; // x24
void (__fastcall *v46)(__int64, __int64 *); // x26
const char *v47; // x6
cocos2d::CCDictionary **v48; // x0
char v49; // w3
__int64 v50; // x4
__int64 v51; // x5
__int64 v52; // x22
__int64 v53; // x0
__int64 v54; // x2
__int64 v55; // x0
__int64 v56; // x1
__int64 v57; // x0
GameLevelManager *v58; // x3
__int64 v59; // x0
__int64 v60; // x23
cocos2d::CCNode *v61; // x24
void (__fastcall *v62)(__int64, __int64 *); // x19
char *v63; // [xsp+98h] [xbp+98h]
__int64 v64; // [xsp+A0h] [xbp+A0h] BYREF
char v65[8]; // [xsp+A8h] [xbp+A8h] BYREF
__int64 v66; // [xsp+B0h] [xbp+B0h] BYREF
__int64 v67; // [xsp+B8h] [xbp+B8h] BYREF
GameLevelManager *v68; // [xsp+C0h] [xbp+C0h]
void *v69; // [xsp+C8h] [xbp+C8h]
__int64 v70[3]; // [xsp+D0h] [xbp+D0h] BYREF
__int64 v71; // [xsp+E8h] [xbp+E8h] BYREF
GameLevelManager *v72; // [xsp+F0h] [xbp+F0h]
void *v73; // [xsp+F8h] [xbp+F8h]
__int64 v74[3]; // [xsp+100h] [xbp+100h] BYREF
__int64 v75; // [xsp+118h] [xbp+118h] BYREF
__int64 v76; // [xsp+120h] [xbp+120h]
void *v77; // [xsp+128h] [xbp+128h]
__int64 v78; // [xsp+130h] [xbp+130h] BYREF
__int64 v79; // [xsp+138h] [xbp+138h]
void *v80; // [xsp+140h] [xbp+140h]
__int64 v81; // [xsp+148h] [xbp+148h] BYREF
__int64 v82; // [xsp+150h] [xbp+150h]
void *v83; // [xsp+158h] [xbp+158h]
__int64 v84; // [xsp+160h] [xbp+160h] BYREF
GameLevelManager *v85; // [xsp+168h] [xbp+168h]
void *v86; // [xsp+170h] [xbp+170h]
v5 = a3;
if ( !a2 )
return 0;
v6 = SetupTriggerPopup::init((SetupTriggerPopup *)this, nullptr, nullptr, 300.0, 170.0, 1u, 0.0);
v7 = v6;
if ( !v6 )
return 0;
*(this + 127) = a2;
v9 = (cocos2d::CCDirector *)cocos2d::CCObject::retain(a2);
v10 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v9);
cocos2d::CCDirector::getWinSize(&v64, v10);
v67 = 0;
v11 = (__int64)*(this + 127);
v68 = nullptr;
v69 = nullptr;
v12 = (__int64 *)(v11 + 344);
v13 = *((float *)&v64 + 1) * 0.5;
v14 = (float)(*((float *)&v64 + 1) * 0.5) + 85.0;
v15 = *(float *)&v64 * 0.5;
if ( (*(_BYTE *)(v11 + 344) & 1) != 0 )
{
std::string::__init(&v67, *(void **)(v11 + 360), *(_QWORD *)(v11 + 352));
}
else
{
v16 = *(void **)(v11 + 360);
v17 = *v12;
v18 = (GameLevelManager *)v12[1];
v69 = v16;
v67 = v17;
v68 = v18;
}
if ( (v67 & 1) != 0 )
{
v19 = v68;
if ( v68 )
goto LABEL_9;
}
else
{
v19 = (GameLevelManager *)((int)(unsigned __int8)v67 >> 1);
if ( (_DWORD)v19 )
{
v19 = (GameLevelManager *)(int)v19;
goto LABEL_9;
}
}
v48 = (cocos2d::CCDictionary **)GameLevelManager::sharedState(v19);
GameLevelManager::tryGetUsername(v70, v48, *((_DWORD *)*(this + 127) + 97));
if ( (v67 & 1) != 0 )
{
*(_BYTE *)v69 = 0;
v68 = nullptr;
}
else
{
LOWORD(v67) = 0;
}
std::string::reserve(&v67, 0);
v67 = v70[0];
v68 = (GameLevelManager *)v70[1];
v69 = (void *)v70[2];
if ( (v70[0] & 1) != 0 )
v19 = v68;
else
v19 = (GameLevelManager *)((int)LOBYTE(v70[0]) >> 1);
LABEL_9:
if ( !v19 )
std::string::assign(&v67, "Comment", 7u);
v71 = 0;
v72 = nullptr;
v73 = nullptr;
if ( (v67 & 1) != 0 )
{
std::string::__init(&v71, v69, (size_t)v68);
}
else
{
v73 = v69;
v71 = v67;
v72 = v68;
}
v20 = SetupTriggerPopup::addTitle((__int64)this, (__int64)&v71);
if ( (v71 & 1) != 0 )
operator delete(v73);
(*(void (__fastcall **)(__int64, float, float))(*(_QWORD *)v20 + 248LL))(v20, 0.0, -4.0);
v21 = (__int64)*(this + 127);
v71 = 0;
v72 = nullptr;
v73 = nullptr;
v22 = *(_DWORD *)(v21 + 444);
if ( v22 <= 0 )
{
v49 = *(_BYTE *)(v21 + 392);
v75 = 0;
v23 = (const char *)(v21 + 392);
v76 = 0;
v77 = nullptr;
if ( (v49 & 1) != 0 )
{
std::string::__init(&v75, *(void **)(v21 + 408), *(_QWORD *)(v21 + 400));
}
else
{
v50 = *(_QWORD *)v23;
v51 = *(_QWORD *)(v21 + 400);
v77 = *(void **)(v21 + 408);
v75 = v50;
v76 = v51;
}
v52 = (unsigned __int8)v75 >> 1;
if ( (v75 & 1) != 0 )
{
v52 = v76;
operator delete(v77);
}
if ( v52 )
{
v53 = (__int64)*(this + 127);
v78 = 0;
v54 = v53 + 392;
v79 = 0;
LOBYTE(v53) = *(_BYTE *)(v53 + 392);
v80 = nullptr;
if ( (v53 & 1) != 0 )
{
std::string::__init(&v78, *(void **)(v54 + 16), *(_QWORD *)(v54 + 8));
}
else
{
v55 = *(_QWORD *)v54;
v56 = *(_QWORD *)(v54 + 8);
v80 = *(void **)(v54 + 16);
v78 = v55;
v79 = v56;
}
v57 = std::string::append((__int64)&v78, " ago");
v58 = *(GameLevelManager **)(v57 + 8);
v84 = *(_QWORD *)v57;
v85 = v58;
v86 = *(void **)(v57 + 16);
*(_QWORD *)v57 = 0;
*(_QWORD *)(v57 + 8) = 0;
*(_QWORD *)(v57 + 16) = 0;
if ( (v71 & 1) != 0 )
{
*(_BYTE *)v73 = 0;
v72 = nullptr;
}
else
{
LOWORD(v71) = 0;
}
std::string::reserve(&v71, 0);
v73 = v86;
v23 = (const char *)(unsigned __int8)v78;
v71 = v84;
v72 = v85;
if ( (v78 & 1) != 0 )
operator delete(v80);
}
}
else
{
GameToolbox::timestampToDateString((GameToolbox *)v22, v74);
if ( (v71 & 1) != 0 )
{
*(_BYTE *)v73 = 0;
v72 = nullptr;
}
else
{
LOWORD(v71) = 0;
}
std::string::reserve(&v71, 0);
v73 = (void *)v74[2];
v71 = v74[0];
v72 = (GameLevelManager *)v74[1];
}
v24 = (const char *)(unsigned __int8)v71;
if ( (v71 & 1) == 0 )
{
v24 = (const char *)((int)(unsigned __int8)v71 >> 1);
v25 = (cocos2d::CCLabelBMFont *)((char *)&v71 + 1);
if ( !(_DWORD)v24 )
goto LABEL_23;
goto LABEL_22;
}
if ( v72 )
{
v25 = (cocos2d::CCLabelBMFont *)v73;
LABEL_22:
v26 = cocos2d::CCLabelBMFont::create(v25, "chatFont.fnt", v23);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v26 + 160LL))(v26, 0.6);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v26 + 1072LL))(v26, &unk_11A58C0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v26 + 1024LL))(v26, 4294967190LL);
v27 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v26 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v66, v15, v14 - 36.0);
v27(v26, &v66);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)*(this + 73) + 464LL))(*(this + 73), v26, 1);
}
LABEL_23:
v28 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v24);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v28 + 160LL))(v28, 0.8);
v29 = CCMenuItemSpriteExtra::create(v28, 0, (__int64)this, 1368, 1);
CCMenuItemSpriteExtra::setSizeMult(v29, 1.5);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v29);
v30 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v29 + 184LL);
v31 = *(this + 69);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, (float)(v15 - 150.0) + 8.0, v14 - 12.0);
cocos2d::CCNode::convertToNodeSpace(&v66, v31, (const cocos2d::CCPoint *)v65);
v30(v29, &v66);
v33 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"threadBtn_copy_001.png", v32);
v34 = CCMenuItemSpriteExtra::create(v33, 0, (__int64)this, (__int64)CommentOptionsPopup::onCopy, 0);
CCMenuItemSpriteExtra::setSizeMult(v34, 1.4);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v34);
v35 = *(this + 69);
v36 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v34 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, (float)(v15 + 150.0) - 18.0, v14 - 19.0);
cocos2d::CCNode::convertToNodeSpace(&v66, v35, (const cocos2d::CCPoint *)v65);
v36(v34, &v66);
v37 = (__int64)*(this + 127);
v81 = 0;
v38 = v37 + 320;
v82 = 0;
LOBYTE(v37) = *(_BYTE *)(v37 + 320);
v83 = nullptr;
if ( (v37 & 1) != 0 )
{
std::string::__init(&v81, *(void **)(v38 + 16), *(_QWORD *)(v38 + 8));
}
else
{
v39 = *(_QWORD *)v38;
v40 = *(_QWORD *)(v38 + 8);
v83 = *(void **)(v38 + 16);
v81 = v39;
v82 = v40;
}
GameToolbox::stripNonBreakingSpaces((unsigned __int8 *)&v81);
v41 = (char *)&v81 + 1;
if ( (v81 & 1) != 0 )
v41 = (const char *)v83;
v63 = (char *)v41;
v84 = 0;
v85 = nullptr;
v86 = nullptr;
v42 = strlen(v41);
std::string::__init(&v84, v63, v42);
v43 = (EmoteSprite *)cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v66, 0.5, 0.5);
v44 = EmoteSprite::maxEmotesComment(v43);
v45 = TextArea::create((char *)&v84, "chatFont.fnt", (const cocos2d::CCPoint *)&v66, 1, v44, 1.0, 343.75, 20.0);
if ( (v84 & 1) != 0 )
operator delete(v86);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v45 + 160LL))(v45, 0.8);
v46 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v45 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v66, v15, v13 + 6.0);
v46(v45, &v66);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(*(_QWORD *)*(this + 73) + 464LL))(*(this + 73), v45, 1);
if ( v5 )
{
v59 = ButtonSprite::create(
(ButtonSprite *)"Report",
(const char *)&qword_60 + 4,
0,
1,
0.7,
"bigFont.fnt",
"GJ_button_06.png",
v47,
30.0);
v60 = CCMenuItemSpriteExtra::create(v59, 0, (__int64)this, (__int64)CommentOptionsPopup::onReport, 0);
CCMenuItemSpriteExtra::setSizeMult(v60, 1.1);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)*(this + 69) + 456LL))(*(this + 69), v60);
v61 = *(this + 69);
v62 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v60 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v65, v15, (float)(v13 - 85.0) + 24.0);
cocos2d::CCNode::convertToNodeSpace(&v66, v61, (const cocos2d::CCPoint *)v65);
v62(v60, &v66);
}
if ( (v81 & 1) != 0 )
operator delete(v83);
if ( (v71 & 1) != 0 )
operator delete(v73);
if ( (v67 & 1) != 0 )
operator delete(v69);
return v7;
}