//
// ThreadMessageOptionsPopup::init from 0xc7902c to 0xc7967c (1616 bytes)
//
// 2 xrefs:
// > ThreadMessageOptionsPopup::create @ 0xc798f4
// > ??> @ 0xb1e50
//
// 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:05:35 +0000
//
__int64 __fastcall ThreadMessageOptionsPopup::init(__int64 a1, cocos2d::CCObject *a2, char *a3, __int64 a4)
{
unsigned __int8 v8; // w0
unsigned int v9; // w20
__int64 *v11; // x0
const void *v12; // x1
size_t v13; // x2
int v14; // w21
__int64 v15; // x0
_BOOL8 v16; // x0
cocos2d::CCDirector *v17; // x0
char v18; // w0
float v19; // s9
float v20; // s8
float v21; // s11
__int64 v22; // x0
__int64 v23; // x1
__int64 v24; // x21
const char *v25; // x1
GameToolbox *v26; // x0
const char *v27; // x2
cocos2d::CCLabelBMFont *v28; // x0
__int64 v29; // x23
void (__fastcall *v30)(__int64, __int64 *); // x25
__int64 v31; // x23
__int64 v32; // x23
cocos2d::CCNode *v33; // x27
void (__fastcall *v34)(__int64, __int64 *); // x26
const char *v35; // x1
__int64 v36; // x0
__int64 v37; // x23
cocos2d::CCNode *v38; // x27
void (__fastcall *v39)(__int64, __int64 *); // x26
EmoteSprite *v40; // x0
int v41; // w0
__int64 v42; // x23
__int64 v43; // x1
void (__fastcall *v44)(__int64, __int64 *); // x26
__int64 v45; // x0
__int64 v46; // x1
void (__fastcall *v47)(__int64, __int64 *); // x24
const char *v48; // x6
char *v49; // x0
__int64 v50; // x0
__int64 v51; // x23
cocos2d::CCNode *v52; // x24
void (__fastcall *v53)(__int64, __int64 *); // x22
__int64 v54; // [xsp+88h] [xbp+88h] BYREF
_BYTE v55[8]; // [xsp+90h] [xbp+90h] BYREF
__int64 v56; // [xsp+98h] [xbp+98h] BYREF
__int64 v57; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v58; // [xsp+A8h] [xbp+A8h]
cocos2d::CCLabelBMFont *v59; // [xsp+B0h] [xbp+B0h]
if ( !a2 )
return 0;
if ( !a4 )
return 0;
v8 = SetupTriggerPopup::init((SetupTriggerPopup *)a1, nullptr, nullptr, 300.0, 170.0, 1u, 0.0);
v9 = v8;
if ( !v8 )
return 0;
*(_QWORD *)(a1 + 1024) = a2;
cocos2d::CCObject::retain(a2);
*(_QWORD *)(a1 + 1032) = a4;
v11 = (__int64 *)(a1 + 1040);
if ( (char *)(a1 + 1040) != a3 )
{
if ( (*a3 & 1) != 0 )
{
v12 = *((const void **)a3 + 2);
v13 = *((_QWORD *)a3 + 1);
}
else
{
v12 = a3 + 1;
v13 = (unsigned __int8)*a3 >> 1;
}
v11 = std::string::assign(v11, v12, v13);
}
v14 = *((_DWORD *)a2 + 16);
v15 = GJAccountManager::sharedState((GJAccountManager *)v11);
v16 = v14 == *(_DWORD *)(v15 + 352) - *(_DWORD *)(v15 + 356);
*(_BYTE *)(a1 + 1064) = v16;
v17 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)v16);
cocos2d::CCDirector::getWinSize(&v54, v17);
v57 = 0;
v18 = *a3;
v58 = 0;
v59 = nullptr;
v19 = *((float *)&v54 + 1) * 0.5;
v20 = *(float *)&v54 * 0.5;
v21 = (float)(*((float *)&v54 + 1) * 0.5) + 85.0;
if ( (v18 & 1) != 0 )
{
std::string::__init(&v57, *((void **)a3 + 2), *((_QWORD *)a3 + 1));
}
else
{
v22 = *(_QWORD *)a3;
v23 = *((_QWORD *)a3 + 1);
v59 = *((cocos2d::CCLabelBMFont **)a3 + 2);
v57 = v22;
v58 = v23;
}
v24 = SetupTriggerPopup::addTitle(a1, (__int64)&v57);
if ( (v57 & 1) != 0 )
operator delete(v59);
(*(void (__fastcall **)(__int64, float, float))(*(_QWORD *)v24 + 248LL))(v24, 0.0, -4.0);
v26 = *(GameToolbox **)(*(_QWORD *)(a1 + 1024) + 96LL);
if ( (__int64)v26 > 0 )
{
GameToolbox::timestampToDateString(v26, &v57);
v28 = (cocos2d::CCLabelBMFont *)((char *)&v57 + 1);
if ( (v57 & 1) != 0 )
v28 = v59;
v29 = cocos2d::CCLabelBMFont::create(v28, "chatFont.fnt", v27);
if ( (v57 & 1) != 0 )
operator delete(v59);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v29 + 160LL))(v29, 0.6);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v29 + 1072LL))(v29, &unk_119E6A0);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v29 + 1024LL))(v29, 4294967190LL);
v30 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v29 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v56, v20, v21 - 36.0);
v30(v29, &v56);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v29, 1);
}
v31 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_closeBtn_001.png", v25);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v31 + 160LL))(v31, 0.8);
v32 = CCMenuItemSpriteExtra::create(v31, 0, a1, 1368, 1);
CCMenuItemSpriteExtra::setSizeMult(v32, 1.5);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v32);
v33 = *(cocos2d::CCNode **)(a1 + 552);
v34 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v32 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v55, (float)(v20 - 150.0) + 8.0, v21 - 12.0);
cocos2d::CCNode::convertToNodeSpace(&v56, v33, (const cocos2d::CCPoint *)v55);
v34(v32, &v56);
v36 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"threadBtn_copy_001.png", v35);
v37 = CCMenuItemSpriteExtra::create(v36, 0, a1, (__int64)ThreadMessageOptionsPopup::onCopy, 0);
CCMenuItemSpriteExtra::setSizeMult(v37, 1.4);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v37);
v38 = *(cocos2d::CCNode **)(a1 + 552);
v39 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v37 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v55, (float)(v20 + 150.0) - 18.0, v21 - 19.0);
cocos2d::CCNode::convertToNodeSpace(&v56, v38, (const cocos2d::CCPoint *)v55);
v39(v37, &v56);
v57 = 0;
v58 = 0;
v59 = nullptr;
std::string::__init(&v57, &byte_11B8890, 0);
v40 = (EmoteSprite *)cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v56, 0.0, 0.5);
v41 = EmoteSprite::maxEmotesMessage(v40);
v42 = TextArea::create((char *)&v57, "chatFont.fnt", (const cocos2d::CCPoint *)&v56, 1, v41, 1.0, 250.0, 20.0);
if ( (v57 & 1) != 0 )
operator delete(v59);
v43 = *(_QWORD *)v42;
*(_BYTE *)(v42 + 597) = 1;
v44 = *(void (__fastcall **)(__int64, __int64 *))(v43 + 296);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v56, 0.0, 0.5);
v44(v42, &v56);
v57 = 0;
v45 = *(_QWORD *)(a1 + 1024);
v58 = 0;
v59 = nullptr;
if ( (*(_BYTE *)(v45 + 72) & 1) != 0 )
{
std::string::__init(&v57, *(void **)(v45 + 88), *(_QWORD *)(v45 + 80));
}
else
{
v46 = *(_QWORD *)(v45 + 80);
v57 = *(_QWORD *)(v45 + 72);
v58 = v46;
v59 = *(cocos2d::CCLabelBMFont **)(v45 + 88);
}
TextArea::fitString((float *)v42, (char *)&v57, 250.0, 80.0, 0.35, 0.0);
if ( (v57 & 1) != 0 )
operator delete(v59);
v47 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v42 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v56, (float)(v20 - 125.0) - 10.0, v19 + 2.0);
v47(v42, &v56);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v42, 1);
if ( !*(_BYTE *)(a1 + 1064) )
{
if ( *(_BYTE *)(*(_QWORD *)(a1 + 1024) + 104LL) )
return v9;
if ( !*(_BYTE *)(*(_QWORD *)(a1 + 1032) + 791LL) )
{
v49 = "Report";
goto LABEL_30;
}
LABEL_29:
v49 = "Delete";
LABEL_30:
v50 = ButtonSprite::create(
(ButtonSprite *)v49,
(const char *)&qword_60 + 4,
0,
1,
0.7,
"bigFont.fnt",
"GJ_button_06.png",
v48,
30.0);
v51 = CCMenuItemSpriteExtra::create(v50, 0, a1, (__int64)ThreadMessageOptionsPopup::onAction, 0);
CCMenuItemSpriteExtra::setSizeMult(v51, 1.1);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v51);
v52 = *(cocos2d::CCNode **)(a1 + 552);
v53 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v51 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v55, v20, (float)(v19 - 85.0) + 24.0);
cocos2d::CCNode::convertToNodeSpace(&v56, v52, (const cocos2d::CCPoint *)v55);
v53(v51, &v56);
return v9;
}
if ( !*(_BYTE *)(*(_QWORD *)(a1 + 1024) + 104LL) && !ThreadViewPopup::removedView(*(ThreadViewPopup **)(a1 + 1032)) )
goto LABEL_29;
return v9;
}