//
// ThreadDescPopup::buildUI from 0x1400fc920 to 0x1400fd494 (2932 bytes)
//
// 2 xrefs:
// > ThreadViewPopup::onShowDescription @ 0x1400dd1a4
// > ??> @ 0x140915518
//
// 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:41 +0000
//
// Hidden C++ exception states: #wind=5
char __fastcall ThreadDescPopup::buildUI(__int64 a1, char a2, _QWORD *a3, size_t *a4)
{
char result; // al
__int64 v9; // rcx
__int64 v10; // rax
float v11; // xmm7_4
float v12; // xmm8_4
struct cocos2d::CCSprite *v13; // rax
int v14; // ebx
cocos2d::CCObject *v15; // rsi
__int64 v16; // rdi
__int64 v17; // rbx
__int64 v18; // rax
__int64 v19; // rax
__int64 v20; // rdx
__int64 v21; // rcx
__int64 v22; // r8
float v23; // xmm12_4
__int64 v24; // rax
__int64 v25; // rdi
__int64 v26; // rbx
__int64 v27; // rax
__int64 v28; // rbx
__int64 v29; // rax
__int64 v30; // rdx
__int64 v31; // rcx
char *v32; // rax
__int64 v33; // rdi
__int64 v34; // rbx
__int64 v35; // rax
__int64 v36; // rcx
__int64 v37; // rdx
__int64 v38; // rcx
__int64 v39; // r8
__int64 v40; // rcx
__int64 v41; // rdx
__int64 v42; // r8
__int64 v43; // rcx
float v44; // xmm6_4
const struct cocos2d::CCPoint *v45; // rax
char *v46; // rdi
__int64 v47; // rbx
__int64 v48; // rax
__int64 v49; // rbx
__int64 v50; // rax
size_t v51; // r8
cocos2d::CCObject *v52; // rbx
cocos2d::CCObject *v53; // rsi
__int64 v54; // rdi
float v55; // xmm8_4
__int64 v56; // rbx
__int64 v57; // rax
__int64 v58; // rax
void *v59; // rdx
struct cocos2d::CCLabelBMFont *v60; // r14
__int64 v61; // rbx
__int64 v62; // rax
__int64 v63; // rbx
float v64; // xmm11_4
__int64 v65; // rax
__int64 v66; // rax
__int64 *v67; // rdi
__int64 v68; // rbx
__int64 v69; // rax
cocos2d::CCObject *v70; // rax
__int64 v71; // rsi
float *v72; // rax
__int64 v73; // rbx
__int64 v74; // rdi
__int64 v75; // rax
__int64 v76; // rax
__int64 v77; // rdx
__int64 v78; // r8
__int64 v79; // rax
_QWORD *v80; // rbx
void *v81; // r8
cocos2d::CCObject *v82; // rsi
__int64 v83; // rdi
__int64 v84; // rbx
__int64 v85; // rax
__int64 v86; // rax
int v87; // ebx
const struct cocos2d::CCPoint *v88; // rax
char *v89; // rdi
__int64 v90; // rbx
__int64 v91; // rax
__int64 v92; // rax
int v93; // ebx
__int64 v94; // rax
void *v95; // rcx
__int64 v96; // rbx
__int64 v97; // rax
_DWORD v98[4]; // [rsp+58h] [rbp-B0h] BYREF
void **v99; // [rsp+68h] [rbp-A0h] BYREF
_BYTE v100[16]; // [rsp+70h] [rbp-98h] BYREF
float v101[2]; // [rsp+80h] [rbp-88h] BYREF
__int128 v102; // [rsp+88h] [rbp-80h] BYREF
__int64 v103; // [rsp+98h] [rbp-70h]
__int64 v104; // [rsp+A0h] [rbp-68h]
_BYTE v105[32]; // [rsp+A8h] [rbp-60h] BYREF
void *Block[2]; // [rsp+C8h] [rbp-40h] BYREF
__int64 v107; // [rsp+D8h] [rbp-30h]
unsigned __int64 v108; // [rsp+E0h] [rbp-28h]
_BYTE v109[32]; // [rsp+E8h] [rbp-20h] BYREF
v98[0] = 0;
result = SetupTriggerPopup::init(a1, 0, 0, (_DWORD)a4, 1128136704, 1, 0);
if ( result )
{
v10 = cocos2d::CCDirector::sharedDirector(v9);
cocos2d::CCDirector::getWinSize(v10, v101);
v11 = v101[0] * 0.5;
v12 = v101[1] * 0.5;
HIWORD(Block[1]) = 0;
v107 = 11;
v108 = 15;
qmemcpy(Block, "Descriptio", 10);
*(_DWORD *)((char *)&Block[1] + 2) = (unsigned __int8)aDescription[10];
SetupTriggerPopup::addTitle(a1, Block);
v13 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v14 = (int)v13;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v13 + 160LL))(v13);
v15 = CCMenuItemSpriteExtra::create(v14, 0, a1, (__int64)sub_14009D628);
*((_DWORD *)v15 + 93) = 1069547520;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v15);
v16 = *(_QWORD *)v15;
v17 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v100, (float)(v11 - 170.0) + 8.0, (float)(v12 + 95.0) - 12.0);
cocos2d::CCNode::convertToNodeSpace(v17, &v99, v18);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v16 + 184))(v15, v19);
v23 = v12 + 8.0;
if ( a2 )
{
v24 = cocos2d::CCRect::CCRect((cocos2d::CCRect *)v100, 0.0, 0.0, 40.0, 40.0);
v25 = cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v24);
v26 = *(_QWORD *)v25;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v99, 300.0, 92.0);
(*(void (__fastcall **)(__int64, __int64))(v26 + 312))(v25, v27);
LOWORD(v98[0]) = 13405;
BYTE2(v98[0]) = 31;
(**(void (__fastcall ***)(__int64, _DWORD *))(v25 + 320))(v25 + 320, v98);
v28 = *(_QWORD *)v25;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v99, v11, v23);
(*(void (__fastcall **)(__int64, __int64))(v28 + 184))(v25, v29);
(*(void (__fastcall **)(_QWORD, __int64, _QWORD))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v25, 0);
*(_DWORD *)(a1 + 1040) = 1133248512;
v32 = CCTextInputNode::create(v31, v30, (__int64)"Describe this group chat");
*(_QWORD *)(a1 + 1032) = v32;
v32[624] = 0;
v33 = **(_QWORD **)(a1 + 1032);
v34 = *(_QWORD *)(a1 + 1032);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v99, v11, v23);
(*(void (__fastcall **)(__int64, __int64))(v33 + 184))(v34, v35);
v36 = *(_QWORD *)(a1 + 1032);
*(_BYTE *)(v36 + 641) = 1;
sub_1400405A0((void **)(v36 + 480), &byte_1406ED6E0, 0);
ensureEmotesAreLoaded(v38, v37, v39, COERCE_DOUBLE(1109393408));
v40 = (unsigned int)(17 * dword_1408FE3A4 + 300);
*(_DWORD *)(*(_QWORD *)(a1 + 1032) + 608LL) = v40;
ensureEmotesAreLoaded(v40, v41, v42, COERCE_DOUBLE(1109393408));
CCTextInputNode::setParseEmotes(*(_QWORD *)(a1 + 1032), dword_1408FE3A4);
*(_QWORD *)(*(_QWORD *)(a1 + 1032) + 600LL) = a1 + 544;
LOWORD(v98[0]) = 27843;
v43 = *(_QWORD *)(a1 + 1032);
*(_WORD *)(v43 + 572) = 27843;
*(_BYTE *)(v43 + 574) = 65;
CCTextInputNode::refreshLabel(v43);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 1032),
5);
v99 = Block;
*(_OWORD *)Block = 0;
v107 = 0;
v108 = 15;
LOBYTE(Block[0]) = 0;
v44 = *(float *)(a1 + 1040);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v100, 0.0, 0.5);
v46 = TextArea::create((__int64)Block, "chatFont.fnt", 1.0, v44, v45, 1101004800, 1, 0);
v46[601] = 1;
v47 = *(_QWORD *)v46;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v99, 0.0, 0.5);
(*(void (__fastcall **)(char *, __int64))(v47 + 288))(v46, v48);
CCTextInputNode::addTextArea(*(_QWORD *)(a1 + 1032), (__int64)v46);
v49 = *(_QWORD *)v46;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v99, (float)-*(float *)(a1 + 1040) * 0.5, 0.0);
(*(void (__fastcall **)(char *, __int64))(v49 + 184))(v46, v50);
if ( a3[2] )
{
if ( a3[3] > 0xFu )
a3 = (_QWORD *)*a3;
*(_OWORD *)Block = 0;
v107 = 0;
v108 = 0;
v51 = -1;
do
++v51;
while ( *((_BYTE *)a3 + v51) );
sub_14003D230(Block, a3, v51);
CCTextInputNode::setString(*(_QWORD **)(a1 + 1032), Block);
}
v99 = (void **)operator new(0x2C8u);
v52 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v99);
if ( v52 )
{
if ( ButtonSprite::init_1(
(__int64)v52,
(__int64)"Save",
70,
0,
1058642330,
1,
&qword_140704F78,
(__int64)"GJ_button_01.png",
1105199104) )
{
cocos2d::CCObject::autorelease(v52);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v52 + 8LL))(v52, 1);
LODWORD(v52) = 0;
}
}
v53 = CCMenuItemSpriteExtra::create((int)v52, 0, a1, (__int64)ThreadDescPopup::onSave);
*((_DWORD *)v53 + 93) = 1066192077;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v53);
v54 = *(_QWORD *)v53;
v55 = (float)(v12 - 95.0) + 24.0;
v56 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v99, v11, v55);
cocos2d::CCNode::convertToNodeSpace(v56, v100, v57);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v54 + 184))(v53, v58);
if ( (size_t *)(a1 + 1080) != a4 )
{
v59 = a4;
if ( a4[3] > 0xF )
v59 = (void *)*a4;
sub_1400405A0((void **)(a1 + 1080), v59, a4[2]);
}
v60 = cocos2d::CCLabelBMFont::create("Icon:", "goldFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v60 + 160LL))(v60);
v61 = *(_QWORD *)v60;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v99, 0.0, 0.5);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v61 + 288))(v60, v62);
v63 = *(_QWORD *)v60;
v64 = (float)(v11 - 170.0) + 22.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v99, v64, v55);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v63 + 184))(v60, v65);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v60,
1);
v66 = cocos2d::CCRect::CCRect((cocos2d::CCRect *)v100, 0.0, 0.0, 40.0, 40.0);
v67 = (__int64 *)cocos2d::extension::CCScale9Sprite::create("GJ_button_04.png", v66);
v68 = *v67;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v99, 32.0, 32.0);
(*(void (__fastcall **)(__int64 *, __int64))(v68 + 312))(v67, v69);
*(_QWORD *)(a1 + 1120) = v67;
v70 = CCMenuItemSpriteExtra::create((int)v67, 0, a1, (__int64)ThreadDescPopup::onPickIcon);
*(_QWORD *)(a1 + 1128) = v70;
*((_DWORD *)v70 + 93) = 1067030938;
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
*(_QWORD *)(a1 + 1128));
v71 = **(_QWORD **)(a1 + 1128);
v72 = (float *)(*(__int64 (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v60 + 320LL))(v60);
v73 = *(_QWORD *)(a1 + 552);
v74 = *(_QWORD *)(a1 + 1128);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v99, (float)((float)(*v72 * 0.5) + v64) + 24.0, v55);
cocos2d::CCNode::convertToNodeSpace(v73, v100, v75);
(*(void (__fastcall **)(__int64, __int64))(v71 + 184))(v74, v76);
ThreadDescPopup::refreshIconSlot(a1);
*(_OWORD *)Block = 0;
v107 = 4;
v108 = 15;
strcpy((char *)Block, "easy");
v79 = EmoteSprite::defForName((__int64)Block, v77, v78, COERCE_DOUBLE(1109393408));
if ( v79 )
v80 = EmoteSprite::createWithDef(v79);
else
v80 = nullptr;
if ( v108 > 0xF )
{
v81 = Block[0];
if ( v108 + 1 >= 0x1000 )
{
v81 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v81 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v81);
}
EmoteSprite::fitToHeight(v80, 18.0, 0.0);
v82 = CCMenuItemSpriteExtra::create((int)v80, 0, a1, (__int64)ThreadDescPopup::onEmotes);
*((_DWORD *)v82 + 93) = 1068708659;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v82);
v83 = *(_QWORD *)v82;
v84 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v99, (float)(v11 + 170.0) - 30.0, v55);
cocos2d::CCNode::convertToNodeSpace(v84, v100, v85);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v83 + 184))(v82, v86);
}
else
{
v99 = (void **)&v102;
v102 = 0;
v103 = 0;
v104 = 15;
LOBYTE(v102) = 0;
ensureEmotesAreLoaded(v21, v20, v22, COERCE_DOUBLE(1135214592));
v87 = dword_1408FE3A4;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v100, 0.0, 0.5);
v89 = TextArea::create((__int64)&v102, "chatFont.fnt", 1.0, 280.0, v88, 1101004800, 1, v87);
v89[601] = 1;
v90 = *(_QWORD *)v89;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v99, 0.0, 0.5);
(*(void (__fastcall **)(char *, __int64))(v90 + 288))(v89, v91);
if ( a3[2] )
{
v92 = sub_14003F4F0((__int64)v109, (__int64)a3);
v93 = 2;
}
else
{
v107 = 14;
v108 = 15;
strcpy((char *)Block, "No description");
HIBYTE(Block[1]) = 0;
v92 = (__int64)Block;
v93 = 1;
}
v98[0] = v93;
v94 = sub_14003F4F0((__int64)v105, v92);
TextArea::fitString((float *)v89, v94, 280.0, COERCE_DOUBLE(1121714176), 0.34999999, 0.0);
if ( (v93 & 2) != 0 )
{
LOBYTE(v93) = v93 & 0xFD;
sub_14003D310((__int64)v109);
}
if ( (v93 & 1) != 0 && v108 > 0xF )
{
v95 = Block[0];
if ( v108 + 1 >= 0x1000 )
{
v95 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v95 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v95);
}
if ( !a3[2] )
{
LOWORD(v98[0]) = -26986;
BYTE2(v98[0]) = -106;
TextArea::colorAllCharactersTo((__int64)v89, (__int64)v98);
}
v96 = *(_QWORD *)v89;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v99, (float)(v11 - 140.0) - 10.0, v12 - 4.0);
(*(void (__fastcall **)(char *, __int64))(v96 + 184))(v89, v97);
(*(void (__fastcall **)(_QWORD, char *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v89, 1);
}
return 1;
}
return result;
}