//
// ThreadViewPopup::threadSearchFinished from 0x1400dbf60 to 0x1400dc580 (1568 bytes)
//
// 2 xrefs:
// > ??> @ 0x14072a1c0
// > ??> @ 0x140914948
//
// 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:29 +0000
//
// Hidden C++ exception states: #wind=2
__int64 __fastcall ThreadViewPopup::threadSearchFinished(__int64 a1, int a2, cocos2d::CCArray *a3, char a4)
{
__int64 result; // rax
__int64 v7; // rcx
__int64 v8; // r15
signed int v9; // ebp
__int64 v10; // rax
__int64 v11; // r12
const char *v12; // r13
__int64 v13; // rcx
cocos2d::CCObject *v14; // rax
__int64 v15; // rcx
__int64 v16; // rdx
__int64 v17; // rcx
__int64 v18; // rcx
__int64 v19; // rcx
__int64 v20; // rcx
__int64 v21; // rcx
__int64 v22; // rcx
__int64 v23; // rdx
struct cocos2d::CCLabelBMFont *v24; // rdi
__int64 v25; // rbx
__int64 v26; // rax
cocos2d::CCObject *v27; // rbx
cocos2d::CCObject *v28; // rax
__int64 v29; // rcx
__int64 v30; // rax
__int64 v31; // rdx
__int64 v32; // rdx
__int64 v33; // rcx
cocos2d::CCArray *v34; // rdi
signed int j; // ebx
struct cocos2d::CCObject *v36; // rax
__int64 v37; // rcx
signed int k; // ebx
struct cocos2d::CCObject *v39; // rax
signed int m; // ebp
cocos2d::CCArray *v41; // rbx
struct cocos2d::CCObject *v42; // rax
__int64 v43; // rdx
int v44; // ebp
signed int i; // edi
cocos2d::CCArray *v46; // rbx
struct cocos2d::CCObject *v47; // rax
__int64 v48; // rdi
const char *v49; // rcx
void (__fastcall **v50)(__int64, const char *); // rdi
__int64 v51; // rbx
const char *v52; // r9
cocos2d::CCString *v53; // rax
const char *CString; // rax
__int64 v55; // rcx
void *v56; // [rsp+90h] [rbp+8h]
void *v57; // [rsp+90h] [rbp+8h]
result = *(_QWORD *)(a1 + 72);
if ( a2 != *(_DWORD *)(result + 56) || !*(_QWORD *)(a1 + 456) )
return result;
v7 = *(_QWORD *)(a1 + 152);
if ( v7 )
LoadingCircle::fadeAndRemove(v7);
v8 = 0;
if ( a3 )
v9 = cocos2d::CCArray::count(a3);
else
v9 = 0;
v10 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v56 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager(v56);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v10 = *(_QWORD *)&qword_14090BFB0;
}
v11 = *(_QWORD *)(v10 + 608);
v12 = &byte_1406ED6E0;
if ( !*(_BYTE *)(a1 + 432) )
{
*(_BYTE *)(a1 + 432) = 1;
*(_QWORD *)(a1 + 472) = *(_QWORD *)(a1 + 80);
*(_QWORD *)(a1 + 480) = *(_QWORD *)(a1 + 88);
*(_QWORD *)(a1 + 488) = *(_QWORD *)(a1 + 96);
*(_BYTE *)(a1 + 496) = *(_BYTE *)(a1 + 108);
v13 = *(unsigned int *)(*(_QWORD *)(a1 + 144) + 436LL);
*(_DWORD *)(a1 + 500) = v13;
v14 = (cocos2d::CCObject *)cocos2d::CCArray::create(v13);
*(_QWORD *)(a1 + 80) = v14;
cocos2d::CCObject::retain(v14);
ThreadViewPopup::setPollInterval(a1 - 672, 0.0);
v15 = *(_QWORD *)(a1 + 352);
if ( v15 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v15 + 336LL))(v15, 0);
cocos2d::CCNode::unschedule(a1 - 672, ThreadViewPopup::checkUnseenBelow);
v17 = *(_QWORD *)(a1 + 240);
if ( v17 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v17 + 1104LL))(v17, 0);
v18 = *(_QWORD *)(a1 + 248);
if ( v18 )
{
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v18 + 1032LL))(v18, 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 248) + 336LL))(*(_QWORD *)(a1 + 248), 0);
}
v19 = *(_QWORD *)(a1 + 344);
if ( v19 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v19 + 336LL))(v19, 0);
v20 = *(_QWORD *)(a1 + 552);
if ( v20 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v20 + 336LL))(v20, 0);
v21 = *(_QWORD *)(a1 + 560);
if ( v21 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v21 + 336LL))(v21, 0);
v22 = *(_QWORD *)(a1 + 232);
if ( v22 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v22 + 336LL))(v22, 0);
LOBYTE(v16) = 1;
ThreadViewPopup::setSendPending(a1 - 672, v16);
if ( !*(_QWORD *)(a1 + 536) )
{
v24 = cocos2d::CCLabelBMFont::create(&byte_1406ED6E0, (const char *)&qword_140704F78);
*(_QWORD *)(a1 + 536) = v24;
v25 = *(_QWORD *)v24;
v26 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 336) + 200LL))(*(_QWORD *)(a1 + 336));
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v25 + 184))(v24, v26);
(*(void (__fastcall **)(_QWORD, _QWORD, __int64))(**(_QWORD **)(a1 - 88) + 456LL))(
*(_QWORD *)(a1 - 88),
*(_QWORD *)(a1 + 536),
6);
v57 = operator new(0x2C8u);
v27 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v57);
if ( v27 )
{
if ( ButtonSprite::init_1(
(__int64)v27,
(__int64)"Clear",
45,
0,
1057803469,
1,
&qword_140704F78,
(__int64)"GJ_button_04.png",
1105199104) )
{
cocos2d::CCObject::autorelease(v27);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v27 + 8LL))(v27, 1);
LODWORD(v27) = 0;
}
}
v28 = CCMenuItemSpriteExtra::create((int)v27, 0, (int)a1 - 672, (__int64)ThreadViewPopup::onClearSearch);
*(_QWORD *)(a1 + 544) = v28;
*((_DWORD *)v28 + 93) = 1066192077;
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 - 120) + 464LL))(
*(_QWORD *)(a1 - 120),
*(_QWORD *)(a1 + 544));
v29 = *(_QWORD *)(a1 + 232);
if ( !v29 )
v29 = *(_QWORD *)(a1 + 336);
v30 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v29 + 200LL))(v29);
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 544) + 184LL))(*(_QWORD *)(a1 + 544), v30);
}
LOBYTE(v23) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 536) + 336LL))(*(_QWORD *)(a1 + 536), v23);
LOBYTE(v31) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 544) + 336LL))(*(_QWORD *)(a1 + 544), v31);
LOBYTE(v32) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 544) + 936LL))(*(_QWORD *)(a1 + 544), v32);
v33 = *(_QWORD *)(a1 + 120);
if ( v33 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v33 + 336LL))(v33, 0);
v7 = *(_QWORD *)(a1 + 128);
if ( v7 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v7 + 336LL))(v7, 0);
v12 = &byte_1406ED6E0;
if ( v11 > 0 )
goto LABEL_38;
LABEL_51:
for ( i = 0; i < v9; ++i )
{
v46 = *(cocos2d::CCArray **)(a1 + 80);
v47 = cocos2d::CCArray::objectAtIndex(a3, i);
cocos2d::CCArray::addObject(v46, v47);
}
goto LABEL_47;
}
if ( v11 <= 0 )
{
cocos2d::CCArray::removeAllObjects(*(cocos2d::CCArray **)(a1 + 80));
goto LABEL_51;
}
LABEL_38:
v34 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
for ( j = 0; j < v9; ++j )
{
v36 = cocos2d::CCArray::objectAtIndex(a3, j);
v37 = *(_QWORD *)(a1 + 88);
if ( !v37 || *((_QWORD *)v36 + 7) < v37 )
cocos2d::CCArray::addObject(v34, v36);
}
for ( k = 0; k < (int)cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 80)); ++k )
{
v39 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 80), k);
cocos2d::CCArray::addObject(v34, v39);
}
cocos2d::CCArray::removeAllObjects(*(cocos2d::CCArray **)(a1 + 80));
for ( m = 0; m < (int)cocos2d::CCArray::count(v34); ++m )
{
v41 = *(cocos2d::CCArray **)(a1 + 80);
v42 = cocos2d::CCArray::objectAtIndex(v34, m);
cocos2d::CCArray::addObject(v41, v42);
}
LABEL_47:
*(_BYTE *)(a1 + 108) = a4;
v44 = cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 80));
if ( v44 <= 0 )
{
*(_QWORD *)(a1 + 88) = 0;
}
else
{
*(_QWORD *)(a1 + 88) = *((_QWORD *)cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 80), 0) + 7);
v8 = *((_QWORD *)cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 80), v44 - 1) + 7);
}
*(_QWORD *)(a1 + 96) = v8;
v48 = *(_QWORD *)(a1 + 536);
if ( v48 )
{
v49 = (const char *)(a1 + 440);
if ( *(_QWORD *)(a1 + 464) > 0xFu )
v49 = *(const char **)v49;
v50 = *(void (__fastcall ***)(__int64, const char *))(v48 + 360);
v51 = *(_QWORD *)(a1 + 536);
v52 = (const char *)&unk_14070D03C;
if ( v44 == 1 )
v52 = &byte_1406ED6E0;
if ( *(_BYTE *)(a1 + 108) )
v12 = "+";
v53 = cocos2d::CCString::createWithFormat("%i%s result%s for \"%s\"", v44, v12, v52, v49);
CString = cocos2d::CCString::getCString(v53);
(*v50)(v51 + 360, CString);
cocos2d::CCLabelBMFont::limitLabelWidth(
*(cocos2d::CCLabelBMFont **)(a1 + 536),
*(float *)(a1 + 392) - 8.0,
0.40000001,
0.2);
}
LOBYTE(v43) = v11 <= 0;
result = ThreadViewPopup::buildRows(a1 - 672, v43);
if ( !v44 )
{
v55 = *(_QWORD *)(a1 + 176);
if ( v55 )
return (**(__int64 (__fastcall ***)(__int64, const char *))(v55 + 360))(v55 + 360, "No results");
}
return result;
}