//
// ThreadSearchPopup::init from 0x1400faff0 to 0x1400fb9de (2542 bytes)
//
// 2 xrefs:
// > ThreadViewPopup::onSearch @ 0x1400dba31
// > ??> @ 0x140915494
//
// 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=2
char __fastcall ThreadSearchPopup::init(__int64 a1, __int64 a2, __int64 a3, int a4)
{
__int64 v5; // rcx
__int64 v6; // rax
float v7; // xmm7_4
float v8; // xmm13_4
__int64 v9; // r12
struct cocos2d::CCSprite *v10; // rax
int v11; // ebx
cocos2d::CCObject *v12; // rsi
__int64 v13; // rdi
__int64 v14; // rbx
__int64 v15; // rax
__int64 v16; // rax
float v17; // xmm8_4
float v18; // xmm7_4
float v19; // xmm6_4
float v20; // xmm13_4
__int64 v21; // rax
_QWORD *v22; // rsi
__int64 v23; // rbx
__int64 v24; // rax
__int64 v25; // rbx
__int64 v26; // rax
__int64 v27; // rdx
__int64 v28; // rcx
char *InputNode; // rdi
__int64 v30; // rbx
__int64 v31; // rax
__int64 v32; // rcx
cocos2d::CCObject *v33; // rbx
cocos2d::CCObject *v34; // rsi
__int64 v35; // rdi
__int64 v36; // rbx
__int64 v37; // rax
__int64 v38; // rax
struct tm *v39; // rax
int v40; // ecx
float v41; // xmm8_4
int v42; // r15d
__int64 v43; // r13
float v44; // xmm6_4
float v45; // xmm7_4
__int64 v46; // rax
_QWORD *v47; // rdi
__int64 v48; // rbx
__int64 v49; // rax
__int64 v50; // rbx
__int64 v51; // rax
__int64 v52; // rdx
__int64 v53; // rcx
char *v54; // rsi
int v55; // eax
__int64 v56; // rbx
__int64 v57; // rax
cocos2d::CCString *v58; // rax
const char *CString; // rax
size_t v60; // r8
struct cocos2d::CCLabelBMFont *v61; // rdi
__int64 v62; // rdx
void (__fastcall *v63)(char *, __int64); // r8
__int64 v64; // rbx
__int64 v65; // rax
__int64 v66; // rdx
float v67; // xmm0_4
__int64 v68; // rax
cocos2d::CCObject *v69; // rbx
cocos2d::CCObject *v70; // rsi
__int64 v71; // rdi
__int64 v72; // rbx
__int64 v73; // rax
__int64 v74; // rax
__int16 v76; // [rsp+58h] [rbp-B0h] BYREF
char v77; // [rsp+5Ah] [rbp-AEh]
__int16 v78; // [rsp+5Ch] [rbp-ACh] BYREF
char v79; // [rsp+5Eh] [rbp-AAh]
__int64 v80; // [rsp+60h] [rbp-A8h]
void *v81; // [rsp+68h] [rbp-A0h] BYREF
float v82; // [rsp+70h] [rbp-98h] BYREF
__int128 v83; // [rsp+78h] [rbp-90h] BYREF
__int64 v84; // [rsp+88h] [rbp-80h]
__int64 v85; // [rsp+90h] [rbp-78h]
float v86[2]; // [rsp+98h] [rbp-70h] BYREF
char v87[8]; // [rsp+A0h] [rbp-68h] BYREF
void *v88; // [rsp+A8h] [rbp-60h] BYREF
__int128 v89; // [rsp+B0h] [rbp-58h] BYREF
__int64 v90; // [rsp+C0h] [rbp-48h]
__int64 v91; // [rsp+C8h] [rbp-40h]
_DWORD v92[4]; // [rsp+D0h] [rbp-38h]
_DWORD v93[4]; // [rsp+E0h] [rbp-28h] BYREF
__time64_t Time; // [rsp+F0h] [rbp-18h] BYREF
char v95[8]; // [rsp+F8h] [rbp-10h] BYREF
_QWORD v96[3]; // [rsp+100h] [rbp-8h]
char v97[176]; // [rsp+118h] [rbp+10h] BYREF
if ( !a2 )
return 0;
*(_QWORD *)(a1 + 1000) = a2;
if ( !(unsigned __int8)SetupTriggerPopup::init(a1, 0, 0, a4, 1126170624, 1, 0) )
return 0;
v6 = cocos2d::CCDirector::sharedDirector(v5);
cocos2d::CCDirector::getWinSize(v6, v86);
v7 = v86[0] * 0.5;
v8 = (float)(v86[1] * 0.5) + 0.0;
v89 = 0;
v9 = 0;
v90 = 0;
v91 = 0;
*(_QWORD *)&v89 = sub_14003D460(0x20u);
v90 = 19;
v91 = 31;
strcpy((char *)v89, "Search Conversation");
SetupTriggerPopup::addTitle(a1, &v89);
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 *)&v82, (float)(v7 - 160.0) + 8.0, (float)(v8 + 80.0) - 12.0);
cocos2d::CCNode::convertToNodeSpace(v14, &v81, v15);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v13 + 184))(v12, v16);
v17 = v7 - 38.0;
v18 = (float)(v7 + 160.0) - 52.0;
v82 = v18;
v19 = v8 + 16.0;
v20 = v8 - 30.0;
v21 = cocos2d::CCRect::CCRect((cocos2d::CCRect *)v93, 0.0, 0.0, 40.0, 40.0);
v22 = (_QWORD *)cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v21);
v23 = *v22;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v81, 180.0, 26.0);
(*(void (__fastcall **)(_QWORD *, __int64))(v23 + 312))(v22, v24);
v76 = 13405;
v77 = 31;
(*(void (__fastcall **)(_QWORD *, __int16 *))v22[40])(v22 + 40, &v76);
v25 = *v22;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v81, v17, v19);
(*(void (__fastcall **)(_QWORD *, __int64))(v25 + 184))(v22, v26);
(*(void (__fastcall **)(_QWORD, _QWORD *, _QWORD))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v22, 0);
InputNode = GameToolbox::createInputNode(v28, v27, (__int64)"Search term", 64);
*(_QWORD *)(a1 + 1008) = InputNode;
v30 = *(_QWORD *)InputNode;
v31 = (*(__int64 (__fastcall **)(_QWORD *))(*v22 + 200LL))(v22);
(*(void (__fastcall **)(char *, __int64))(v30 + 184))(InputNode, v31);
v32 = *(_QWORD *)(a1 + 1008);
*(_BYTE *)(v32 + 641) = 1;
sub_1400405A0((void **)(v32 + 480), &byte_1406ED6E0, 0);
*(_QWORD *)(*(_QWORD *)(a1 + 1008) + 600LL) = a1 + 544;
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
*(_QWORD *)(a1 + 1008),
5);
v81 = operator new(0x2C8u);
v33 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v81);
if ( v33 )
{
if ( ButtonSprite::init_1(
(__int64)v33,
(__int64)"Search",
70,
0,
1057803469,
1,
&qword_140704F78,
(__int64)"GJ_button_01.png",
1105199104) )
{
cocos2d::CCObject::autorelease(v33);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v33 + 8LL))(v33, 1);
LODWORD(v33) = 0;
}
}
v34 = CCMenuItemSpriteExtra::create((int)v33, 0, a1, (__int64)ThreadSearchPopup::onSearch);
*((_DWORD *)v34 + 93) = 1066192077;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v34);
v35 = *(_QWORD *)v34;
v36 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v81, v18, v19);
cocos2d::CCNode::convertToNodeSpace(v36, v95, v37);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v35 + 184))(v34, v38);
Time = time64(nullptr);
v39 = localtime64(&Time);
v40 = v39->tm_year + 1900;
*(_DWORD *)(a1 + 1040) = v40;
v93[0] = v40;
v93[1] = v39->tm_mon + 1;
v93[2] = v39->tm_mday;
v96[0] = "Year";
v96[1] = "Month";
v96[2] = "Day";
v92[0] = 1113063424;
v92[1] = 1109393408;
v92[2] = 1109393408;
v41 = v17 - 90.0;
v42 = 0;
v76 = 13405;
LOWORD(v80) = 27843;
v43 = 0;
do
{
v44 = *(float *)&v92[v43];
v45 = (float)(v44 * 0.5) + v41;
v46 = cocos2d::CCRect::CCRect((cocos2d::CCRect *)v97, 0.0, 0.0, 40.0, 40.0);
v47 = (_QWORD *)cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v46);
v48 = *v47;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v95, v44, 26.0);
(*(void (__fastcall **)(_QWORD *, __int64))(v48 + 312))(v47, v49);
v78 = v76;
v79 = 31;
(*(void (__fastcall **)(_QWORD *, __int16 *))v47[40])(v47 + 40, &v78);
v50 = *v47;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v81, v45, v20);
(*(void (__fastcall **)(_QWORD *, __int64))(v50 + 184))(v47, v51);
(*(void (__fastcall **)(_QWORD, _QWORD *, _QWORD))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v47, 0);
v54 = CCTextInputNode::create(v53, v52, v96[v9]);
*((_DWORD *)v54 + 141) = 1056964608;
CCTextInputNode::refreshLabel((__int64)v54);
*((float *)v54 + 140) = v44 - 14.0;
CCTextInputNode::refreshLabel((__int64)v54);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)v54 + 74) + 336LL))(*((_QWORD *)v54 + 74), 0);
v55 = 2;
if ( !v42 )
v55 = 4;
*((_DWORD *)v54 + 152) = v55;
*((_WORD *)v54 + 286) = v80;
v54[574] = 65;
CCTextInputNode::refreshLabel((__int64)v54);
*((_DWORD *)v54 + 142) = 1056964608;
CCTextInputNode::refreshLabel((__int64)v54);
v56 = *(_QWORD *)v54;
v57 = (*(__int64 (__fastcall **)(_QWORD *))(*v47 + 200LL))(v47);
(*(void (__fastcall **)(char *, __int64))(v56 + 184))(v54, v57);
v84 = 10;
v85 = 15;
*(_QWORD *)&v83 = *(_QWORD *)"0123456789";
*((_QWORD *)&v83 + 1) = *(unsigned __int16 *)"89";
BYTE10(v83) = 0;
CCTextInputNode::setAllowedChars((__int64)v54, (void **)&v83);
*((_DWORD *)v54 + 179) = 3;
v58 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, (unsigned int)v93[v43]);
CString = cocos2d::CCString::getCString(v58);
v83 = 0;
v84 = 0;
v85 = 0;
v60 = -1;
do
++v60;
while ( CString[v60] );
sub_14003D230(&v83, CString, v60);
CCTextInputNode::setString(v54, &v83);
*((_QWORD *)v54 + 75) = a1 + 544;
(*(void (__fastcall **)(_QWORD, char *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v54, 5);
*(_QWORD *)((char *)&v89 + v9 * 8) = v54;
v61 = cocos2d::CCLabelBMFont::create((const char *)v96[v9], "chatFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v61 + 160LL))(v61);
v62 = *((_QWORD *)v61 + 46);
v63 = *(void (__fastcall **)(char *, __int64))(v62 + 40);
LOBYTE(v62) = -96;
v63((char *)v61 + 368, v62);
v64 = *(_QWORD *)v61;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v88, v45, v20 + 20.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v64 + 184))(v61, v65);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(
*(_QWORD *)(a1 + 584),
v61,
1);
v41 = v41 + (float)(v44 + 6.0);
++v42;
++v43;
++v9;
}
while ( v42 < 3 );
v66 = v89;
*(_OWORD *)(a1 + 1016) = v89;
*(_QWORD *)(a1 + 1032) = v90;
v67 = (float)*(int *)(a1 + 1040);
*(_BYTE *)(v66 + 676) = 1;
*(_DWORD *)(v66 + 680) = 1157234688;
*(float *)(v66 + 684) = v67;
v68 = *(_QWORD *)(a1 + 1024);
*(_BYTE *)(v68 + 676) = 1;
*(_DWORD *)(v68 + 680) = 1065353216;
*(_DWORD *)(v68 + 684) = 1094713344;
ThreadSearchPopup::clampDayField(a1);
v88 = operator new(0x2C8u);
v69 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v88);
if ( v69 )
{
if ( ButtonSprite::init_1(
(__int64)v69,
(__int64)"Go",
70,
0,
1057803469,
1,
&qword_140704F78,
(__int64)"GJ_button_01.png",
1105199104) )
{
cocos2d::CCObject::autorelease(v69);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v69 + 8LL))(v69, 1);
LODWORD(v69) = 0;
}
}
v70 = CCMenuItemSpriteExtra::create((int)v69, 0, a1, (__int64)ThreadSearchPopup::onGoToDate);
*((_DWORD *)v70 + 93) = 1066192077;
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v70);
v71 = *(_QWORD *)v70;
v72 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v88, v82, v20);
cocos2d::CCNode::convertToNodeSpace(v72, v87, v73);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v71 + 184))(v70, v74);
return 1;
}