//
// CommentOptionsPopup::init from 0x1400c1fc0 to 0x1400c288d (2253 bytes)
//
// 2 xrefs:
// > CommentCell::onMoreOptions @ 0x140154e9d
// > ??> @ 0x140913b80
//
// This function is hookable on this platform (idp: pc, 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 11:26:19 +0000
//
// Hidden C++ exception states: #wind=6
char __fastcall CommentOptionsPopup::init(__int64 a1, cocos2d::CCObject *a2, char a3, int a4)
{
__int64 v7; // rcx
__int64 v8; // rax
float v9; // xmm8_4
float v10; // xmm7_4
float v11; // xmm9_4
__int64 v12; // rcx
__int64 Username; // rbx
void *v14; // rcx
__int64 v15; // rax
__int64 v16; // rax
__int64 v17; // rdx
char *v18; // rbx
void *v19; // rcx
bool v20; // bl
_QWORD *v21; // rax
__int128 v22; // xmm6
__int128 v23; // xmm11
void *v24; // rcx
void **v25; // rcx
struct cocos2d::CCLabelBMFont *v26; // rdi
__int64 v27; // rdx
void (__fastcall *v28)(char *, __int64); // r8
__int64 v29; // rbx
__int64 v30; // rax
struct cocos2d::CCSprite *v31; // rax
int v32; // ebx
cocos2d::CCObject *v33; // rsi
__int64 v34; // rdi
__int64 v35; // rbx
__int64 v36; // rax
__int64 v37; // rax
int v38; // eax
cocos2d::CCObject *v39; // rsi
__int64 v40; // rdi
__int64 v41; // rbx
__int64 v42; // rax
__int64 v43; // rax
unsigned __int64 *v44; // rdx
size_t v45; // r8
__int64 v46; // rdx
__int64 v47; // rcx
__int64 v48; // r8
int v49; // ebx
const struct cocos2d::CCPoint *v50; // rax
char *v51; // rdi
__int64 v52; // rbx
__int64 v53; // rax
cocos2d::CCObject *v54; // rbx
cocos2d::CCObject *v55; // rsi
__int64 v56; // rdi
__int64 v57; // rbx
__int64 v58; // rax
__int64 v59; // rax
void *v60; // rcx
void *v62; // [rsp+58h] [rbp-B0h] BYREF
_BYTE *v63; // [rsp+60h] [rbp-A8h] BYREF
_BYTE v64[40]; // [rsp+68h] [rbp-A0h] BYREF
void *v65[2]; // [rsp+90h] [rbp-78h] BYREF
__int128 v66; // [rsp+A0h] [rbp-68h]
unsigned __int64 Src[4]; // [rsp+B0h] [rbp-58h] BYREF
void *Block[2]; // [rsp+D0h] [rbp-38h] BYREF
__int128 v69; // [rsp+E0h] [rbp-28h]
if ( !a2 || !(unsigned __int8)SetupTriggerPopup::init(a1, 0, 0, a4, 1126825984, 1, 0) )
return 0;
*(_QWORD *)(a1 + 1000) = a2;
cocos2d::CCObject::retain(a2);
v8 = cocos2d::CCDirector::sharedDirector(v7);
cocos2d::CCDirector::getWinSize(v8, v64);
v9 = *(float *)v64 * 0.5;
v10 = *(float *)&v64[4] * 0.5;
v11 = (float)(*(float *)&v64[4] * 0.5) + 85.0;
sub_14003F4F0((__int64)Block, *(_QWORD *)(a1 + 1000) + 352LL);
if ( !(_QWORD)v69 )
{
v12 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v62 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager(v62);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v12 = *(_QWORD *)&qword_14090BFB0;
}
Username = GameLevelManager::tryGetUsername(v12, Src, *(unsigned int *)(*(_QWORD *)(a1 + 1000) + 404LL));
if ( Block != (void **)Username )
{
if ( *((_QWORD *)&v69 + 1) > 0xFu )
{
v14 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v69 + 1) + 1LL) >= 0x1000 )
{
v14 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v14 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v14);
}
*(_QWORD *)&v69 = 0;
*((_QWORD *)&v69 + 1) = 15;
LOBYTE(Block[0]) = 0;
*(_OWORD *)Block = *(_OWORD *)Username;
v69 = *(_OWORD *)(Username + 16);
*(_QWORD *)(Username + 16) = 0;
*(_QWORD *)(Username + 24) = 15;
*(_BYTE *)Username = 0;
}
sub_14003D310((__int64)Src);
if ( !(_QWORD)v69 )
sub_1400405A0(Block, "Comment", 7u);
}
v15 = sub_14003F4F0((__int64)Src, (__int64)Block);
v16 = SetupTriggerPopup::addTitle(a1, v15);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v16 + 240LL))(v16);
*(_OWORD *)v65 = 0;
*(_QWORD *)&v66 = 0;
*((_QWORD *)&v66 + 1) = 15;
LOBYTE(v65[0]) = 0;
v17 = *(_QWORD *)(a1 + 1000);
if ( *(int *)(v17 + 468) > 0 )
{
v18 = GameToolbox::timestampToDateString((char *)Src, *(int *)(v17 + 468));
if ( v65 != (void **)v18 )
{
if ( *((_QWORD *)&v66 + 1) > 0xFu )
{
v19 = v65[0];
if ( (unsigned __int64)(*((_QWORD *)&v66 + 1) + 1LL) >= 0x1000 )
{
v19 = *((void **)v65[0] - 1);
if ( (unsigned __int64)((char *)v65[0] - (char *)v19 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v19);
}
*(_QWORD *)&v66 = 0;
*((_QWORD *)&v66 + 1) = 15;
LOBYTE(v65[0]) = 0;
*(_OWORD *)v65 = *(_OWORD *)v18;
v66 = *((_OWORD *)v18 + 1);
*((_QWORD *)v18 + 2) = 0;
*((_QWORD *)v18 + 3) = 15;
*v18 = 0;
}
LABEL_30:
sub_14003D310((__int64)Src);
goto LABEL_31;
}
sub_14003F4F0((__int64)Src, v17 + 408);
v20 = Src[2] != 0;
sub_14003D310((__int64)Src);
if ( v20 )
{
sub_14003F4F0((__int64)Src, *(_QWORD *)(a1 + 1000) + 408LL);
v21 = sub_140044D80(Src, " ago", 4u);
v22 = *(_OWORD *)v21;
v23 = *((_OWORD *)v21 + 1);
v21[2] = 0;
v21[3] = 15;
*(_BYTE *)v21 = 0;
if ( *((_QWORD *)&v66 + 1) > 0xFu )
{
v24 = v65[0];
if ( (unsigned __int64)(*((_QWORD *)&v66 + 1) + 1LL) >= 0x1000 )
{
v24 = *((void **)v65[0] - 1);
if ( (unsigned __int64)((char *)v65[0] - (char *)v24 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v24);
}
*(_OWORD *)v65 = v22;
v66 = v23;
goto LABEL_30;
}
LABEL_31:
if ( (_QWORD)v66 )
{
v25 = v65;
if ( *((_QWORD *)&v66 + 1) > 0xFu )
v25 = (void **)v65[0];
v26 = cocos2d::CCLabelBMFont::create((const char *)v25, "chatFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v26 + 160LL))(v26);
(**((void (__fastcall ***)(__int64, void *))v26 + 46))((__int64)v26 + 368, &unk_140702DD0);
v27 = *((_QWORD *)v26 + 46);
v28 = *(void (__fastcall **)(char *, __int64))(v27 + 40);
LOBYTE(v27) = -106;
v28((char *)v26 + 368, v27);
v29 = *(_QWORD *)v26;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v62, v9, v11 - 36.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v29 + 184))(v26, v30);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v26,
1);
}
v31 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v32 = (int)v31;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v31 + 160LL))(v31);
v33 = CCMenuItemSpriteExtra::create(v32, 0, a1, (__int64)sub_14009D628);
*((_DWORD *)v33 + 93) = 1069547520;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v33);
v34 = *(_QWORD *)v33;
v35 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v62, (float)(v9 - 150.0) + 8.0, v11 - 12.0);
cocos2d::CCNode::convertToNodeSpace(v35, &v63, v36);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v34 + 184))(v33, v37);
v38 = (unsigned int)cocos2d::CCSprite::createWithSpriteFrameName("threadBtn_copy_001.png");
v39 = CCMenuItemSpriteExtra::create(v38, 0, a1, (__int64)CommentOptionsPopup::onCopy);
*((_DWORD *)v39 + 93) = 1068708659;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v39);
v40 = *(_QWORD *)v39;
v41 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v63, (float)(v9 + 150.0) - 18.0, v11 - 19.0);
cocos2d::CCNode::convertToNodeSpace(v41, &v62, v42);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v40 + 184))(v39, v43);
sub_14003F4F0((__int64)Src, *(_QWORD *)(a1 + 1000) + 320LL);
GameToolbox::stripNonBreakingSpaces(Src);
v63 = &v64[8];
v44 = Src;
if ( Src[3] > 0xF )
v44 = (unsigned __int64 *)Src[0];
memset(&v64[8], 0, 32);
v45 = -1;
do
++v45;
while ( *((_BYTE *)v44 + v45) );
sub_14003D230(&v64[8], v44, v45);
ensureEmotesAreLoaded(v47, v46, v48, COERCE_DOUBLE(1133903872));
v49 = dword_1408FE3A4;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v62, 0.5, 0.5);
v51 = TextArea::create((__int64)&v64[8], "chatFont.fnt", 1.0, 343.75, v50, 1101004800, 1, v49);
(*(void (__fastcall **)(char *))(*(_QWORD *)v51 + 160LL))(v51);
v52 = *(_QWORD *)v51;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v63, v9, v10 + 6.0);
(*(void (__fastcall **)(char *, __int64))(v52 + 184))(v51, v53);
(*(void (__fastcall **)(_QWORD, char *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v51, 1);
if ( a3 )
{
v63 = operator new(0x2C8u);
v54 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v63);
if ( v54 )
{
if ( ButtonSprite::init_1(
(__int64)v54,
(__int64)&dword_140724044,
100,
0,
1060320051,
1,
&qword_140704F78,
(__int64)"GJ_button_06.png",
1106247680) )
{
cocos2d::CCObject::autorelease(v54);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v54 + 8LL))(v54, 1);
LODWORD(v54) = 0;
}
}
v55 = CCMenuItemSpriteExtra::create((int)v54, 0, a1, (__int64)CommentOptionsPopup::onReport);
*((_DWORD *)v55 + 93) = 1066192077;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v55);
v56 = *(_QWORD *)v55;
v57 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v63, v9, (float)(v10 - 85.0) + 24.0);
cocos2d::CCNode::convertToNodeSpace(v57, &v62, v58);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v56 + 184))(v55, v59);
}
sub_14003D310((__int64)Src);
if ( *((_QWORD *)&v66 + 1) > 0xFu )
{
v60 = v65[0];
if ( (unsigned __int64)(*((_QWORD *)&v66 + 1) + 1LL) >= 0x1000 )
{
v60 = *((void **)v65[0] - 1);
if ( (unsigned __int64)((char *)v65[0] - (char *)v60 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v60);
}
*(_QWORD *)&v66 = 0;
*((_QWORD *)&v66 + 1) = 15;
LOBYTE(v65[0]) = 0;
sub_14003D310((__int64)Block);
return 1;
}