//
// RenameThreadPopup::init from 0x1400f9db0 to 0x1400fa36c (1468 bytes)
//
// 2 xrefs:
// > ThreadOptionsPopup::onRename @ 0x1400f54ab
// > ??> @ 0x140915404
//
// 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:40 +0000
//
// Hidden C++ exception states: #wind=1
char __fastcall RenameThreadPopup::init(__int64 a1, cocos2d::CCObject *a2, __int64 a3, int a4)
{
__int64 v6; // rcx
__int64 v7; // rax
float v8; // xmm10_4
float v9; // xmm8_4
struct cocos2d::CCSprite *v10; // rax
int v11; // ebx
cocos2d::CCObject *v12; // rsi
__int64 v13; // rdi
__int64 v14; // rbx
__int64 v15; // rax
__int64 v16; // rax
struct cocos2d::CCLabelBMFont *v17; // rdi
__int64 v18; // rdx
void (__fastcall *v19)(char *, __int64); // r8
__int64 v20; // rbx
__int64 v21; // rax
__int64 v22; // rax
_QWORD *v23; // rsi
__int64 v24; // rbx
__int64 v25; // rax
__int64 v26; // rbx
__int64 v27; // rax
__int64 v28; // rdx
__int64 v29; // rcx
char *InputNode; // rdi
__int64 v31; // rbx
__int64 v32; // rax
_QWORD *v33; // rdx
size_t v34; // r8
cocos2d::CCObject *v35; // rbx
cocos2d::CCObject *v36; // rsi
__int64 v37; // rdi
__int64 v38; // rbx
__int64 v39; // rax
__int64 v40; // rax
__int128 v42; // [rsp+58h] [rbp-39h] BYREF
__int64 v43; // [rsp+68h] [rbp-29h]
__int64 v44; // [rsp+70h] [rbp-21h]
void *v45; // [rsp+100h] [rbp+6Fh] BYREF
float v46; // [rsp+110h] [rbp+7Fh] BYREF
float v47; // [rsp+114h] [rbp+83h]
if ( !a2 )
return 0;
*(_QWORD *)(a1 + 1016) = a3;
if ( !(unsigned __int8)SetupTriggerPopup::init(a1, 0, 0, a4, 1124859904, 1, 0) )
return 0;
*(_QWORD *)(a1 + 1008) = a2;
cocos2d::CCObject::retain(a2);
v7 = cocos2d::CCDirector::sharedDirector(v6);
cocos2d::CCDirector::getWinSize(v7, &v46);
v8 = v46 * 0.5;
v9 = (float)(v47 * 0.5) + 0.0;
v42 = 0;
*(_QWORD *)&v42 = sub_14003D460(0x20u);
v43 = 17;
v44 = 31;
strcpy((char *)v42, "Rename Group Chat");
SetupTriggerPopup::addTitle(a1, &v42);
v10 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
v11 = (int)v10;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v10 + 160LL))(v10);
v12 = CCMenuItemSpriteExtra::create(v11, 0, a1, (__int64)sub_14009D628);
*((_DWORD *)v12 + 93) = 1069547520;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v12);
v13 = *(_QWORD *)v12;
v14 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v45, (float)(v8 - 150.0) + 8.0, (float)(v9 + 70.0) - 12.0);
cocos2d::CCNode::convertToNodeSpace(v14, &v42, v15);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v13 + 184))(v12, v16);
v17 = cocos2d::CCLabelBMFont::create("Everyone sees this name", "chatFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(*(_QWORD *)v17 + 920LL))(v17, 1);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v17 + 160LL))(v17);
v18 = *((_QWORD *)v17 + 46);
v19 = *(void (__fastcall **)(char *, __int64))(v18 + 40);
LOBYTE(v18) = -96;
v19((char *)v17 + 368, v18);
v20 = *(_QWORD *)v17;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v45, v8, (float)(v9 + 70.0) - 38.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v20 + 184))(v17, v21);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v17,
1);
v22 = cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v42, 0.0, 0.0, 40.0, 40.0);
v23 = (_QWORD *)cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v22);
v24 = *v23;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v45, 250.0, 26.0);
(*(void (__fastcall **)(_QWORD *, __int64))(v24 + 312))(v23, v25);
LOWORD(v45) = 13405;
BYTE2(v45) = 31;
(*(void (__fastcall **)(_QWORD *, void **))v23[40])(v23 + 40, &v45);
v26 = *v23;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v45, v8, v9 + 2.0);
(*(void (__fastcall **)(_QWORD *, __int64))(v26 + 184))(v23, v27);
(*(void (__fastcall **)(_QWORD, _QWORD *, _QWORD))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v23, 0);
InputNode = GameToolbox::createInputNode(v29, v28, (__int64)"Group name", 20);
*(_QWORD *)(a1 + 1024) = InputNode;
v31 = *(_QWORD *)InputNode;
v32 = (*(__int64 (__fastcall **)(_QWORD *))(*v23 + 200LL))(v23);
(*(void (__fastcall **)(char *, __int64))(v31 + 184))(InputNode, v32);
v42 = 0;
v43 = 0;
v44 = 0;
*(_QWORD *)&v42 = sub_14003D460(0x70u);
v43 = 97;
v44 = 111;
strcpy(
(char *)v42,
" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,-!?:;)(/\\\"'`*=+-_%[]<>|@&^#{}%$~");
CCTextInputNode::setAllowedChars(*(_QWORD *)(a1 + 1024), (void **)&v42);
v33 = (_QWORD *)(*(_QWORD *)(a1 + 1008) + 96LL);
if ( *(_QWORD *)(*(_QWORD *)(a1 + 1008) + 120LL) > 0xFu )
v33 = (_QWORD *)*v33;
v42 = 0;
v43 = 0;
v44 = 0;
v34 = -1;
do
++v34;
while ( *((_BYTE *)v33 + v34) );
sub_14003D230(&v42, v33, v34);
CCTextInputNode::setString(*(_QWORD **)(a1 + 1024), &v42);
*(_QWORD *)(*(_QWORD *)(a1 + 1024) + 600LL) = a1 + 544;
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 1024),
5);
v45 = operator new(0x2C8u);
v35 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v45);
if ( v35 )
{
if ( ButtonSprite::init_1(
(__int64)v35,
(__int64)"Save",
70,
0,
1058642330,
1,
&qword_140704F78,
(__int64)"GJ_button_01.png",
1105199104) )
{
cocos2d::CCObject::autorelease(v35);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v35 + 8LL))(v35, 1);
LODWORD(v35) = 0;
}
}
v36 = CCMenuItemSpriteExtra::create((int)v35, 0, a1, (__int64)RenameThreadPopup::onSave);
*((_DWORD *)v36 + 93) = 1066192077;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v36);
v37 = *(_QWORD *)v36;
v38 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v45, v8, (float)(v9 - 70.0) + 22.0);
cocos2d::CCNode::convertToNodeSpace(v38, &v42, v39);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v37 + 184))(v36, v40);
return 1;
}