//
// ThreadMessageOptionsPopup::init from 0x1400e53e0 to 0x1400e5a44 (1636 bytes)
//
// 2 xrefs:
// > ThreadViewPopup::onMessageOptions @ 0x1400dc878
// > ??> @ 0x140914c54
//
// 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:32 +0000
//
// Hidden C++ exception states: #wind=3
char __fastcall ThreadMessageOptionsPopup::init(__int64 a1, cocos2d::CCObject *a2, void **a3, __int64 a4)
{
void **v8; // rcx
void *v9; // rdx
__int64 v10; // rax
__int64 v11; // rax
float v12; // xmm8_4
float v13; // xmm7_4
float v14; // xmm9_4
__int64 v15; // rax
__int64 v16; // rax
__time64_t v17; // rdx
char *v18; // rax
struct cocos2d::CCLabelBMFont *v19; // rdi
__int64 v20; // rdx
__int64 v21; // rbx
__int64 v22; // rax
struct cocos2d::CCSprite *v23; // rax
int v24; // ebx
cocos2d::CCObject *v25; // rsi
__int64 v26; // rdi
__int64 v27; // rbx
__int64 v28; // rax
__int64 v29; // rax
int v30; // eax
cocos2d::CCObject *v31; // rsi
__int64 v32; // rdi
__int64 v33; // rbx
__int64 v34; // rax
__int64 v35; // rax
__int64 v36; // rdx
__int64 v37; // rcx
__int64 v38; // r8
const struct cocos2d::CCPoint *v39; // rax
char *v40; // rdi
__int64 v41; // rbx
__int64 v42; // rax
__int64 v43; // rax
__int64 v44; // rbx
__int64 v45; // rax
char v46; // cl
BOOL v47; // edi
__int64 v48; // rcx
cocos2d::CCObject *v49; // rbx
int *v50; // rdx
cocos2d::CCObject *v51; // rsi
__int64 v52; // rdi
__int64 v53; // rbx
__int64 v54; // rax
__int64 v55; // rax
__int128 *v57; // [rsp+58h] [rbp-69h] BYREF
_BYTE v58[8]; // [rsp+60h] [rbp-61h] BYREF
float v59; // [rsp+68h] [rbp-59h] BYREF
float v60; // [rsp+6Ch] [rbp-55h]
_BYTE v61[32]; // [rsp+70h] [rbp-51h] BYREF
__int128 v62; // [rsp+90h] [rbp-31h] BYREF
__int64 v63; // [rsp+A0h] [rbp-21h]
__int64 v64; // [rsp+A8h] [rbp-19h]
if ( !a2 || !a4 || !(unsigned __int8)SetupTriggerPopup::init(a1, 0, 0, a4, 1126825984, 1, 0) )
return 0;
*(_QWORD *)(a1 + 1008) = a2;
cocos2d::CCObject::retain(a2);
*(_QWORD *)(a1 + 1016) = a4;
v8 = (void **)(a1 + 1024);
if ( (void **)(a1 + 1024) != a3 )
{
v9 = a3;
if ( (unsigned __int64)a3[3] > 0xF )
v9 = *a3;
sub_1400405A0(v8, v9, (size_t)a3[2]);
}
v10 = GJAccountManager::sharedState(v8);
*(_BYTE *)(a1 + 1056) = *((_DWORD *)a2 + 16) == *(_DWORD *)(v10 + 360) - *(_DWORD *)(v10 + 364);
v11 = cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v11, &v59);
v12 = v59 * 0.5;
v13 = v60 * 0.5;
v14 = (float)(v60 * 0.5) + 85.0;
v15 = sub_14003F4F0((__int64)&v62, (__int64)a3);
v16 = SetupTriggerPopup::addTitle(a1, v15);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v16 + 240LL))(v16);
v17 = *(_QWORD *)(*(_QWORD *)(a1 + 1008) + 104LL);
if ( v17 > 0 )
{
v18 = GameToolbox::timestampToDateString((char *)&v62, v17);
if ( *((_QWORD *)v18 + 3) > 0xFu )
v18 = *(char **)v18;
v19 = cocos2d::CCLabelBMFont::create(v18, "chatFont.fnt");
sub_14003D310((__int64)&v62);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v19 + 160LL))(v19);
(**((void (__fastcall ***)(__int64, void *))v19 + 46))((__int64)v19 + 368, &unk_140702E6C);
LOBYTE(v20) = -106;
(*(void (__fastcall **)(__int64, __int64))(*((_QWORD *)v19 + 46) + 40LL))((__int64)v19 + 368, v20);
v21 = *(_QWORD *)v19;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v58, v12, v14 - 36.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v21 + 184))(v19, v22);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v19,
1);
}
v23 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v24 = (int)v23;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v23 + 160LL))(v23);
v25 = CCMenuItemSpriteExtra::create(v24, 0, a1, (__int64)sub_14009D628);
*((_DWORD *)v25 + 93) = 1069547520;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v25);
v26 = *(_QWORD *)v25;
v27 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v58, (float)(v12 - 150.0) + 8.0, v14 - 12.0);
cocos2d::CCNode::convertToNodeSpace(v27, &v57, v28);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v26 + 184))(v25, v29);
v30 = (unsigned int)cocos2d::CCSprite::createWithSpriteFrameName("threadBtn_copy_001.png");
v31 = CCMenuItemSpriteExtra::create(v30, 0, a1, (__int64)ThreadMessageOptionsPopup::onCopy);
*((_DWORD *)v31 + 93) = 1068708659;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v31);
v32 = *(_QWORD *)v31;
v33 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v57, (float)(v12 + 150.0) - 18.0, v14 - 19.0);
cocos2d::CCNode::convertToNodeSpace(v33, v58, v34);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v32 + 184))(v31, v35);
v57 = &v62;
v62 = 0;
v63 = 0;
v64 = 15;
LOBYTE(v62) = 0;
ensureEmotesAreLoaded(v37, v36, v38, COERCE_DOUBLE(1133903872));
LODWORD(v33) = dword_1408FE394;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v58, 0.0, 0.5);
v40 = TextArea::create((__int64)&v62, "chatFont.fnt", 1.0, 250.0, v39, 1101004800, 1, v33);
v40[601] = 1;
v41 = *(_QWORD *)v40;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v57, 0.0, 0.5);
(*(void (__fastcall **)(char *, __int64))(v41 + 288))(v40, v42);
v43 = sub_14003F4F0((__int64)v61, *(_QWORD *)(a1 + 1008) + 72LL);
TextArea::fitString((float *)v40, v43, 250.0, COERCE_DOUBLE(1117782016), 0.34999999, 0.0);
v44 = *(_QWORD *)v40;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v57, (float)(v12 - 125.0) - 10.0, v13 + 2.0);
(*(void (__fastcall **)(char *, __int64))(v44 + 184))(v40, v45);
(*(void (__fastcall **)(_QWORD, char *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v40, 1);
v46 = *(_BYTE *)(a1 + 1056);
v47 = v46 || *(_BYTE *)(*(_QWORD *)(a1 + 1016) + 783LL);
if ( !*(_BYTE *)(*(_QWORD *)(a1 + 1008) + 112LL) )
{
if ( !v46
|| (v48 = *(_QWORD *)(*(_QWORD *)(a1 + 1016) + 744LL), *(_BYTE *)(v48 + 320))
|| *(_DWORD *)(v48 + 324) != 8 )
{
v57 = (__int128 *)operator new(0x2C8u);
v49 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v57);
if ( v49 )
{
v50 = &dword_140724044;
if ( v47 )
v50 = (int *)"Delete";
if ( ButtonSprite::init_1(
(__int64)v49,
(__int64)v50,
100,
0,
1060320051,
1,
&qword_140704F78,
(__int64)"GJ_button_06.png",
1106247680) )
{
cocos2d::CCObject::autorelease(v49);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v49 + 8LL))(v49, 1);
LODWORD(v49) = 0;
}
}
v51 = CCMenuItemSpriteExtra::create((int)v49, 0, a1, (__int64)ThreadMessageOptionsPopup::onAction);
*((_DWORD *)v51 + 93) = 1066192077;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v51);
v52 = *(_QWORD *)v51;
v53 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v57, v12, (float)(v13 - 85.0) + 24.0);
cocos2d::CCNode::convertToNodeSpace(v53, v58, v54);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v52 + 184))(v51, v55);
}
}
return 1;
}