//
// ThreadOptionsPopup::init from 0x10050c87c to 0x10050d080 (2052 bytes)
//
// 1 xrefs:
// > ThreadOptionsPopup::create @ 0x1004fbdf4
//
// 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 11:07:00 +0000
//
__int64 __fastcall ThreadOptionsPopup::init(__int64 a1, __int64 a2, __int64 a3, char a4)
{
int v6; // w23
_BOOL4 v7; // w24
unsigned int v8; // w22
__int64 result; // x0
int v10; // w21
__int64 v11; // x0
_BOOL4 v12; // w25
__int64 v13; // x0
__int64 v14; // x20
signed int v15; // w21
__int64 v16; // x0
signed int i; // w0
__int64 v18; // x8
_BOOL4 v19; // w8
int v20; // w8
int v21; // w8
__int64 v22; // x0
char *v23; // x8
char *v24; // x1
__int64 v25; // kr00_8
__int64 v26; // x20
__int64 v27; // x21
float v28; // s9
float v29; // s13
float v30; // s10
float v31; // s0
float v32; // s8
float v33; // s9
__int64 v34; // x0
std::string *v35; // x0
__int128 v36; // q0
void **v37; // x0
void *v38; // x20
void *v39; // x20
void *v40; // x20
__int64 v41; // x21
void **v42; // x13
unsigned int v43; // w14
const char *v44; // x13
_BYTE *v45; // x15
const char *v46; // x13
unsigned int v47; // w16
void **v48; // x0
const char *v49; // x17
unsigned int v50; // w12
void **v51; // x16
unsigned int v52; // w10
void **v53; // x11
const char *v54; // x9
__int64 (__fastcall *v55)(); // x11
__int64 v56; // x23
void **v57; // x8
__int64 v58; // x26
__int64 *v59; // x27
void *v60; // x0
void *v61; // x21
__int64 v62; // x22
float v63; // [xsp+0h] [xbp-1C0h] BYREF
__int64 v64; // [xsp+8h] [xbp-1B8h] BYREF
void *__p[2]; // [xsp+10h] [xbp-1B0h] BYREF
char v66; // [xsp+27h] [xbp-199h]
__int64 v67; // [xsp+28h] [xbp-198h] BYREF
void *v68[2]; // [xsp+30h] [xbp-190h] BYREF
__int64 (__fastcall *v69)(); // [xsp+40h] [xbp-180h]
_BYTE v70[112]; // [xsp+48h] [xbp-178h] BYREF
const char *v71; // [xsp+B8h] [xbp-108h]
const char *v72; // [xsp+C0h] [xbp-100h]
std::string v73; // [xsp+F8h] [xbp-C8h] BYREF
if ( !a2 )
return 0;
*(_QWORD *)(a1 + 1040) = a3;
*(_BYTE *)(a1 + 1056) = a4;
v6 = *(unsigned __int8 *)(a2 + 264);
if ( v6 == 1 )
{
v7 = 0;
if ( (a4 & 1) != 0 )
v8 = 1;
else
v8 = 5;
v12 = 0;
}
else
{
v10 = *(_DWORD *)(a2 + 200);
v11 = GJAccountManager::sharedState();
v7 = v10 == *(_DWORD *)(v11 + 352) - *(_DWORD *)(v11 + 356);
if ( (*(_BYTE *)(a1 + 1056) & 1) != 0 )
{
v12 = 0;
v8 = 1;
}
else
{
v20 = *(_DWORD *)(a2 + 268);
if ( v10 == *(_DWORD *)(v11 + 352) - *(_DWORD *)(v11 + 356) )
v8 = 6;
else
v8 = 5;
v12 = v20 == 8;
if ( v20 == 8 )
v8 = 2;
}
}
result = SetupTriggerPopup::init(a1, 0, 0, 1, 240.0, (float)((float)(v8 - 1) * 29.0) + 88.0, 0.0);
if ( (_DWORD)result )
{
*(_QWORD *)(a1 + 1032) = a2;
cocos2d::CCObject::retain(a2);
if ( !v6 )
goto LABEL_30;
v13 = GameLevelManager::sharedState();
v14 = sub_1000C6C44(v13, *(_DWORD *)(*(_QWORD *)(a1 + 1032) + 56LL));
v15 = 0;
if ( v14 )
goto LABEL_17;
LABEL_18:
for ( i = 0; v15 < i; i = sub_1002E757C(v14) )
{
v16 = sub_1002E75A0(v14, v15);
if ( *(_DWORD *)(v16 + 376) == *(_DWORD *)(*(_QWORD *)(a1 + 1032) + 60LL) )
*(_DWORD *)(a1 + 1052) = *(_DWORD *)(v16 + 456) > 0;
++v15;
if ( !v14 )
goto LABEL_18;
LABEL_17:
;
}
v18 = *(_QWORD *)(a1 + 1032);
if ( *(int *)(v18 + 288) <= 0 )
{
v21 = *(_DWORD *)(v18 + 268);
if ( !v21 )
goto LABEL_30;
v19 = v21 == 6;
}
else
{
v19 = 1;
}
*(_DWORD *)(a1 + 1052) = v19;
LABEL_30:
v22 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v22, &v67);
v23 = *(char **)(a1 + 1032);
if ( v6 )
{
v24 = v23 + 64;
if ( (v23[87] & 0x80000000) == 0 )
goto LABEL_35;
}
else
{
v24 = v23 + 88;
if ( (v23[111] & 0x80000000) == 0 )
goto LABEL_35;
}
v24 = *(char **)v24;
LABEL_35:
v25 = v67;
sub_100009900(__p, v24);
v26 = sub_1001ACA6C(a1, (__int64 *)__p);
if ( v66 < 0 )
operator delete(__p[0]);
cocos2d::CCLabelBMFont::limitLabelWidth(v26, 180.0, 0.5, 0.2);
if ( v6 )
{
v27 = sub_1000C705C(*(_QWORD *)(a1 + 1032), 16.0);
if ( v27 )
{
v28 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v26 + 224LL))(v26);
v29 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v26 + 328LL))(v26);
v30 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v26 + 168LL))(v26);
v31 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v26 + 240LL))(v26);
sub_1000262BC((float *)v68, (float)(v28 + (float)((float)(v29 * v30) * 0.5)) + 6.0, v31);
(*(void (__fastcall **)(__int64, void **))(*(_QWORD *)v27 + 184LL))(v27, v68);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(
*(_QWORD *)(a1 + 584),
v27,
1);
}
}
v32 = *(float *)&v25 * 0.5;
v33 = (float)((float)((float)((float)(v8 - 1) * 29.0) + 88.0) * 0.5) + (float)(*((float *)&v25 + 1) * 0.5);
v34 = *(_QWORD *)(*(_QWORD *)(a1 + 1032) + 280LL);
if ( v34 >= 1 )
{
sub_10004F000(v34, &v73);
v35 = std::string::insert(&v73, 0, "Created: ");
v36 = *(_OWORD *)&v35->__r_.__value_.__l.__data_;
v69 = (__int64 (__fastcall *)())v35->__r_.__value_.__r.__words[2];
*(_OWORD *)v68 = v36;
v35->__r_.__value_.__l.__size_ = 0;
v35->__r_.__value_.__r.__words[2] = 0;
v35->__r_.__value_.__r.__words[0] = 0;
if ( SHIBYTE(v73.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v73.__r_.__value_.__l.__data_);
if ( SHIBYTE(v69) >= 0 )
v37 = v68;
else
v37 = (void **)v68[0];
v38 = cocos2d::CCLabelBMFont::create_1((const char *)v37, "chatFont.fnt");
(*(void (__fastcall **)(void *, float))(*(_QWORD *)v38 + 160LL))(v38, 0.6);
(*(void (__fastcall **)(void *, void *))(*(_QWORD *)v38 + 1072LL))(v38, &unk_100770120);
(*(void (__fastcall **)(void *, __int64))(*(_QWORD *)v38 + 1024LL))(v38, 150);
sub_1000262BC((float *)&v73, *(float *)&v25 * 0.5, v33 + -33.0);
(*(void (__fastcall **)(void *, std::string *))(*(_QWORD *)v38 + 184LL))(v38, &v73);
(*(void (__fastcall **)(_QWORD, void *, __int64))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v38, 1);
if ( SHIBYTE(v69) < 0 )
operator delete(v68[0]);
}
v39 = cocos2d::CCSprite::createWithSpriteFrameName((__int64)"GJ_closeBtn_001.png");
(*(void (__fastcall **)(void *, float))(*(_QWORD *)v39 + 160LL))(v39, 0.8);
v40 = CCMenuItemSpriteExtra::create((__int64)v39, 0, a1, 1368, 1);
CCMenuItemSpriteExtra::setSizeMult((__int64)v40, 1.5);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v40);
v41 = *(_QWORD *)(a1 + 552);
sub_1000262BC((float *)&v73, (float)(v32 + -120.0) + 8.0, v33 + -12.0);
cocos2d::CCNode::convertToNodeSpace(v41, (__int64)&v73, v68);
(*(void (__fastcall **)(void *, void **))(*(_QWORD *)v40 + 184LL))(v40, v68);
if ( v12 )
{
v68[0] = sub_10050D0D0;
v68[1] = nullptr;
v73.__r_.__value_.__r.__words[0] = (std::string::size_type)"Report";
v73.__r_.__value_.__l.__size_ = (std::string::size_type)"Remove";
v71 = "GJ_button_05.png";
v72 = "GJ_button_06.png";
v42 = (void **)v70;
v43 = 2;
v69 = sub_10050D170;
goto LABEL_58;
}
if ( *(_BYTE *)(a1 + 1056) == 1 )
{
if ( *(_BYTE *)(*(_QWORD *)(a1 + 1032) + 272LL) )
v44 = "Unlock Conversation";
else
v44 = "Lock Conversation";
v73.__r_.__value_.__r.__words[0] = (std::string::size_type)v44;
v71 = "GJ_button_06.png";
v68[0] = sub_10050D240;
v42 = &v68[1];
}
else
{
if ( !v6 )
{
v73.__r_.__value_.__r.__words[0] = (std::string::size_type)"Members";
v71 = "GJ_button_01.png";
v68[0] = sub_10050D39C;
v68[1] = nullptr;
if ( !v7 )
{
v43 = 1;
goto LABEL_59;
}
v73.__r_.__value_.__l.__size_ = (std::string::size_type)"Rename";
v72 = "GJ_button_04.png";
v69 = sub_10050D3E4;
v42 = (void **)v70;
v43 = 2;
LABEL_58:
*v42 = nullptr;
LABEL_59:
v45 = *(_BYTE **)(a1 + 1032);
if ( v45[204] )
v46 = "Unmute";
else
v46 = "Mute";
v73.__r_.__value_.__r.__words[v43] = (std::string::size_type)v46;
(&v71)[v43] = "GJ_button_04.png";
v47 = v43 + 1;
v48 = &v68[2 * v43];
*v48 = sub_10050D428;
v48[1] = nullptr;
if ( v45[274] )
v49 = "Unpin";
else
v49 = "Pin";
v73.__r_.__value_.__r.__words[v47] = (std::string::size_type)v49;
(&v71)[v47] = "GJ_button_04.png";
v50 = v43 + 2;
v51 = &v68[2 * v47];
*v51 = sub_10050D4EC;
v51[1] = nullptr;
v73.__r_.__value_.__r.__words[v50] = (std::string::size_type)"Report";
(&v71)[v50] = "GJ_button_05.png";
v52 = v43 + 3;
v53 = &v68[2 * v43 + 4];
*v53 = sub_10050D0D0;
v53[1] = nullptr;
v54 = "Leave";
if ( v6 )
{
if ( (v45[265] & 1) != 0 )
{
v55 = sub_10050D5B0;
v54 = "Cancel Request";
}
else
{
if ( *(_DWORD *)(a1 + 1052) )
v54 = "Clear";
v55 = sub_10050D67C;
}
}
else
{
v55 = sub_10050D7D0;
}
v56 = 0;
v73.__r_.__value_.__r.__words[v52] = (std::string::size_type)v54;
(&v71)[v52] = "GJ_button_06.png";
v57 = &v68[2 * v52];
*v57 = v55;
v57[1] = nullptr;
v58 = v8;
v59 = (__int64 *)&v68[1];
do
{
v60 = ButtonSprite::create_1(
*((_QWORD *)&v73.__r_.__value_.__l.__data_ + v56),
130,
0,
1,
(__int64)"bigFont.fnt",
(__int64)(&v71)[v56],
0.5,
22.0);
v61 = CCMenuItemSpriteExtra::create((__int64)v60, 0, a1, *(v59 - 1), *v59);
CCMenuItemSpriteExtra::setSizeMult((__int64)v61, 1.1);
(*(void (__fastcall **)(_QWORD, void *))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v61);
v62 = *(_QWORD *)(a1 + 552);
sub_1000262BC(&v63, v32, (float)(v33 + -61.0) + (float)((float)(unsigned int)v56 * -29.0));
cocos2d::CCNode::convertToNodeSpace(v62, (__int64)&v63, &v64);
(*(void (__fastcall **)(void *, __int64 *))(*(_QWORD *)v61 + 184LL))(v61, &v64);
++v56;
v59 += 2;
}
while ( v58 != v56 );
return 1;
}
v42 = &v68[1];
v73.__r_.__value_.__r.__words[0] = (std::string::size_type)"View Profile";
v71 = "GJ_button_01.png";
v68[0] = sub_10050D340;
}
v43 = 1;
goto LABEL_58;
}
return result;
}