//
// CommentOptionsPopup::init from 0x79ffac to 0x7a0532 (1414 bytes)
//
// 1 xrefs:
// > CommentOptionsPopup::create @ 0x7a05f4
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:59:53 +0000
//
GameManager *__fastcall CommentOptionsPopup::init(cocos2d::CCPoint **this, GJComment *a2, int a3)
{
GameManager *v5; // r11
cocos2d::CCDirector *v6; // r0
float v7; // s18
float v8; // s16
int v9; // r3
float v10; // s19
int v11; // r3
cocos2d::CCDictionary **v12; // r0
int v13; // r0
int v14; // r1
_BYTE *v15; // r2
int v16; // r6
int v17; // r3
time_t v18; // r1
int *v19; // r8
int v20; // r0
int v21; // r1
cocos2d::CCLabelBMFont *v22; // r2
int v23; // r9
const char *v24; // r1
int *v25; // r3
int v26; // r1
int v27; // r2
int v28; // r0
int v29; // r1
cocos2d::CCLabelBMFont *v30; // r2
int v31; // r8
cocos2d::CCLabelBMFont *v32; // r0
int v33; // r8
void (__fastcall *v34)(int, _DWORD *); // r10
int v35; // r8
void (__fastcall *v36)(int, _DWORD *); // r10
const char *v37; // r1
int v38; // r0
int v39; // r10
const char *v40; // r10
size_t v41; // r0
EmoteSprite *v42; // r0
int v43; // r0
int v44; // r9
void (__fastcall *v45)(int, _DWORD *); // r10
ButtonSprite *v46; // r0
int v47; // r5
const cocos2d::CCPoint *v48; // r10
void (__fastcall *v49)(int, _BYTE *); // r9
float v51; // [sp+10h] [bp-BCh]
cocos2d::CCPoint *v52; // [sp+18h] [bp-B4h]
cocos2d::CCPoint *v53; // [sp+18h] [bp-B4h]
cocos2d::CCPoint *v54; // [sp+1Ch] [bp-B0h]
float v56[2]; // [sp+28h] [bp-A4h] BYREF
char v57[8]; // [sp+30h] [bp-9Ch] BYREF
_BYTE v58[8]; // [sp+38h] [bp-94h] BYREF
int v59; // [sp+40h] [bp-8Ch]
int v60; // [sp+44h] [bp-88h]
_DWORD v61[2]; // [sp+48h] [bp-84h] BYREF
_DWORD v62[2]; // [sp+50h] [bp-7Ch] BYREF
int v63; // [sp+58h] [bp-74h] BYREF
int v64; // [sp+5Ch] [bp-70h]
_BYTE *v65; // [sp+60h] [bp-6Ch]
int v66; // [sp+64h] [bp-68h] BYREF
int v67; // [sp+68h] [bp-64h]
_BYTE *v68; // [sp+6Ch] [bp-60h]
int v69[3]; // [sp+70h] [bp-5Ch] BYREF
int v70; // [sp+7Ch] [bp-50h] BYREF
int v71; // [sp+80h] [bp-4Ch]
cocos2d::CCLabelBMFont *v72; // [sp+84h] [bp-48h]
int v73; // [sp+88h] [bp-44h] BYREF
int v74; // [sp+8Ch] [bp-40h]
cocos2d::CCLabelBMFont *v75; // [sp+90h] [bp-3Ch]
int v76[3]; // [sp+94h] [bp-38h] BYREF
int v77[3]; // [sp+A0h] [bp-2Ch] BYREF
int v78[3]; // [sp+ACh] [bp-20h] BYREF
int v79; // [sp+B8h] [bp-14h] BYREF
int v80; // [sp+BCh] [bp-10h]
cocos2d::CCLabelBMFont *v81; // [sp+C0h] [bp-Ch]
if ( !a2 )
return nullptr;
v5 = SetupTriggerPopup::init((SetupTriggerPopup *)this, nullptr, nullptr, 300.0, 170.0, (_BYTE *)&dword_0 + 1, 0.0);
if ( !v5 )
return nullptr;
*(this + 178) = a2;
v6 = (cocos2d::CCDirector *)cocos2d::CCObject::retain(a2);
cocos2d::CCDirector::sharedDirector(v6);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v56);
v7 = v56[0] * 0.5;
v8 = v56[1] * 0.5;
std::string::basic_string(&v63, (int)*(this + 178) + 276);
v9 = (unsigned __int8)v63;
v10 = v8 + 85.0;
if ( (v63 & 1) != 0 )
{
if ( v64 )
{
LABEL_6:
v11 = v64;
goto LABEL_13;
}
}
else if ( (unsigned __int8)v63 >> 1 )
{
goto LABEL_12;
}
v12 = (cocos2d::CCDictionary **)GameLevelManager::sharedState((GameLevelManager *)((unsigned __int8)v63 << 31));
GameLevelManager::tryGetUsername((GameLevelManager *)&v66, v12, *((_DWORD *)*(this + 178) + 77));
if ( (v63 & 1) != 0 )
{
*v65 = 0;
v64 = 0;
}
else
{
LOWORD(v63) = 0;
}
std::string::reserve(&v63, 0);
v13 = v66;
v14 = v67;
v15 = v68;
v66 = 0;
v67 = 0;
v68 = nullptr;
v63 = v13;
v64 = v14;
v65 = v15;
std::string::~string((int)&v66);
v9 = (unsigned __int8)v63;
if ( (v63 & 1) != 0 )
goto LABEL_6;
LABEL_12:
v11 = v9 >> 1;
LABEL_13:
if ( !v11 )
std::string::assign(&v63, "Comment", 7u);
std::string::basic_string(v69, (int)&v63);
v16 = SetupTriggerPopup::addTitle((int)this, (unsigned __int8 *)v69);
std::string::~string((int)v69);
(*(void (__fastcall **)(int, _DWORD, int))(*(_DWORD *)v16 + 124))(v16, 0, -1065353216);
v70 = 0;
v71 = 0;
v72 = nullptr;
v17 = (int)*(this + 178);
v18 = *(_DWORD *)(v17 + 352);
if ( v18 > 0 )
{
v19 = &v73;
GameToolbox::timestampToDateString((GameToolbox *)&v73, v18);
if ( (v70 & 1) != 0 )
{
*(_BYTE *)v72 = 0;
v71 = 0;
}
else
{
LOWORD(v70) = 0;
}
std::string::reserve(&v70, 0);
v20 = v73;
v21 = v74;
v22 = v75;
v73 = 0;
v74 = 0;
v75 = nullptr;
v70 = v20;
v71 = v21;
v72 = v22;
LABEL_28:
std::string::~string((int)v19);
goto LABEL_29;
}
std::string::basic_string(v76, v17 + 312);
if ( (v76[0] & 1) != 0 )
v23 = v76[1];
else
v23 = (int)LOBYTE(v76[0]) >> 1;
std::string::~string((int)v76);
if ( v23 )
{
v19 = v77;
std::string::basic_string(v77, (int)*(this + 178) + 312);
v25 = std::string::append(v77, " ago");
v26 = v25[1];
v27 = v25[2];
v79 = *v25;
v80 = v26;
v81 = (cocos2d::CCLabelBMFont *)v27;
*v25 = 0;
v25[1] = 0;
v25[2] = 0;
if ( (v70 & 1) != 0 )
{
*(_BYTE *)v72 = 0;
v71 = 0;
}
else
{
LOWORD(v70) = 0;
}
std::string::reserve(&v70, 0);
v28 = v79;
v29 = v80;
v30 = v81;
v79 = 0;
v80 = 0;
v81 = nullptr;
v70 = v28;
v71 = v29;
v72 = v30;
std::string::~string((int)&v79);
goto LABEL_28;
}
LABEL_29:
if ( (v70 & 1) != 0 )
{
if ( !v71 )
goto LABEL_31;
v32 = v72;
}
else
{
if ( !((unsigned __int8)v70 >> 1) )
goto LABEL_31;
v32 = (cocos2d::CCLabelBMFont *)((char *)&v70 + 1);
}
v33 = cocos2d::CCLabelBMFont::create(v32, "chatFont.fnt", (const char *)((unsigned __int8)v70 << 31));
(*(void (__fastcall **)(int, int))(*(_DWORD *)v33 + 80))(v33, 1058642330);
(*(void (__fastcall **)(int, int *))(*(_DWORD *)v33 + 536))(v33, &dword_BF1318);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v33 + 512))(v33, 150);
v34 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v33 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v62, v7, v10 - 36.0);
v34(v33, v62);
(*(void (__fastcall **)(_DWORD, int, int))(*(_DWORD *)*(this + 115) + 232))(*(this + 115), v33, 1);
LABEL_31:
v31 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v24);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v31 + 80))(v31, 1061997773);
v59 = 684;
v60 = 1;
v35 = CCMenuItemSpriteExtra::create(v31, 0, (int)this, 684, 1);
CCMenuItemSpriteExtra::setSizeMult(v35, 1.5);
(*(void (__fastcall **)(_DWORD, int))(*(_DWORD *)*(this + 111) + 228))(*(this + 111), v35);
v36 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v35 + 92);
v52 = *(this + 111);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v61, (float)(v7 - 150.0) + 8.0, v10 - 12.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v62, v52);
v36(v35, v62);
v38 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"threadBtn_copy_001.png", v37);
v61[1] = 0;
v61[0] = CommentOptionsPopup::onCopy;
v39 = CCMenuItemSpriteExtra::create(v38, 0, (int)this, (int)CommentOptionsPopup::onCopy, 0);
CCMenuItemSpriteExtra::setSizeMult(v39, 1.4);
(*(void (__fastcall **)(_DWORD, int))(*(_DWORD *)*(this + 111) + 228))(*(this + 111), v39);
v53 = *(cocos2d::CCPoint **)(*(_DWORD *)v39 + 92);
v54 = *(this + 111);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v58, (float)(v7 + 150.0) - 18.0, v10 - 19.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v62, v54);
((void (__fastcall *)(int, _DWORD *))v53)(v39, v62);
v40 = (const char *)v78;
std::string::basic_string(v78, (int)*(this + 178) + 264);
GameToolbox::stripNonBreakingSpaces(v78);
if ( (v78[0] & 1) == 0 )
v40 = (char *)v78 + 1;
v79 = 0;
if ( (v78[0] & 1) != 0 )
v40 = (const char *)v78[2];
v80 = 0;
v81 = nullptr;
v41 = strlen(v40);
std::string::__init(&v79, v40, v41);
v42 = (EmoteSprite *)cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v62, 0.5, 0.5);
v43 = EmoteSprite::maxEmotesComment(v42);
v44 = TextArea::create(
(int)&v79,
"chatFont.fnt",
1065353216,
1135337472,
(const cocos2d::CCPoint *)v62,
1101004800,
1,
v43);
std::string::~string((int)&v79);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v44 + 80))(v44, 1061997773);
v45 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v44 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v62, v7, v8 + 6.0);
v45(v44, v62);
(*(void (__fastcall **)(_DWORD, int, int))(*(_DWORD *)*(this + 115) + 232))(*(this + 115), v44, 1);
if ( a3 )
{
v46 = ButtonSprite::create(
(ButtonSprite *)"Report",
(const char *)&dword_64,
0,
0.7,
1,
"bigFont.fnt",
"GJ_button_06.png",
(const char *)0x41F00000,
v51);
v62[1] = 0;
v62[0] = CommentOptionsPopup::onReport;
v47 = CCMenuItemSpriteExtra::create((int)v46, 0, (int)this, (int)CommentOptionsPopup::onReport, 0);
CCMenuItemSpriteExtra::setSizeMult(v47, 1.1);
(*(void (__fastcall **)(_DWORD, int))(*(_DWORD *)*(this + 111) + 228))(*(this + 111), v47);
v48 = *(this + 111);
v49 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v47 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v57, v7, (float)(v8 - 85.0) + 24.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v58, v48);
v49(v47, v58);
}
std::string::~string((int)v78);
std::string::~string((int)&v70);
std::string::~string((int)&v63);
return v5;
}