//
// MessageThreadsPage::applyThreadList from 0x1400d87b0 to 0x1400d8c88 (1240 bytes)
//
// 3 xrefs:
// > MessageThreadsPage::threadListFinished @ 0x1400d8788
// > ??> @ 0x1409147b0
// > ??> @ 0x1409147bc
//
// 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:27 +0000
//
// Hidden C++ exception states: #wind=1
void __fastcall MessageThreadsPage::applyThreadList(__int64 a1, cocos2d::CCArray *a2, int a3, int a4, int a5, char a6)
{
int v6; // esi
int v10; // ecx
int v11; // r15d
int v12; // edx
char v13; // r8
char v14; // r12
char v15; // di
__int64 v16; // rdi
__int64 v17; // rdi
__int64 v18; // rsi
__int64 v19; // rbx
float v20; // xmm6_4
float v21; // xmm7_4
__int64 v22; // rcx
int v23; // r12d
cocos2d::CCArray *v24; // rsi
signed int v25; // ebx
struct cocos2d::CCObject *v26; // rdi
struct cocos2d::CCObject *v27; // rax
__int64 v28; // rdx
__int64 v29; // rdx
__int64 v30; // rdx
cocos2d::CCObject *v31; // rcx
__int64 v32; // rbx
unsigned int v33; // eax
__int64 v34; // r8
__int64 v35; // r9
cocos2d::CCArray *v36; // rdx
__int64 v37; // rdx
__int64 v38; // rcx
__int64 v39; // rcx
__int64 v40; // rax
const char *v41; // rbx
size_t v42; // r8
void (__fastcall **v43)(__int64, const char *); // rdi
__int64 v44; // rbx
cocos2d::CCString *v45; // rax
const char *CString; // rax
__int64 v47; // rdx
__int128 v48; // [rsp+20h] [rbp-88h] BYREF
__int64 v49; // [rsp+30h] [rbp-78h]
__int64 v50; // [rsp+38h] [rbp-70h]
void *v51; // [rsp+B8h] [rbp+10h]
v6 = a4;
v10 = a5;
if ( a2 )
{
v11 = cocos2d::CCArray::count(a2);
if ( v11 )
goto LABEL_9;
v10 = a5;
}
else
{
v11 = 0;
}
if ( a3 > 0 && v6 >= a3 && v10 > 0 )
{
v12 = (a3 - 1) / v10;
v13 = 0;
LABEL_61:
MessageThreadsPage::loadPage(a1, v12, v13);
return;
}
LABEL_9:
v14 = 0;
v15 = a6;
if ( a6 )
{
v16 = *(_QWORD *)(a1 + 952);
if ( v16 && *(_QWORD *)(a1 + 800) && a2 )
{
v17 = *(_QWORD *)(v16 + 424);
v18 = *(_QWORD *)(v17 + 480);
v19 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v17 + 320LL))(v17);
v20 = (float)(*(float *)(v19 + 4)
- *(float *)((*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(v17 + 480) + 320LL))(*(_QWORD *)(v17 + 480))
+ 4))
- *(float *)(v17 + 496);
v21 = *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v18 + 200LL))(v18) + 4) - v20;
if ( v21 >= 24.0 )
{
v22 = *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 952) + 424LL) + 480LL);
(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v22 + 200LL))(v22);
v23 = (int)ceilf(v21 / *(float *)(*(_QWORD *)(a1 + 952) + 452LL));
v24 = *(cocos2d::CCArray **)(a1 + 800);
v25 = 0;
if ( v23 > 0 )
{
while ( v25 < (int)cocos2d::CCArray::count(v24) && v25 < (int)cocos2d::CCArray::count(a2) )
{
v26 = cocos2d::CCArray::objectAtIndex(v24, v25);
v27 = cocos2d::CCArray::objectAtIndex(a2, v25);
if ( *((_DWORD *)v26 + 14) != *((_DWORD *)v27 + 14)
|| *((_DWORD *)v26 + 32) != *((_DWORD *)v27 + 32)
|| *((_DWORD *)v26 + 33) != *((_DWORD *)v27 + 33) )
{
v14 = 1;
goto LABEL_22;
}
if ( ++v25 >= v23 )
break;
}
}
v14 = 0;
}
LABEL_22:
v6 = a4;
}
v15 = a6;
}
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 696) + 336LL))(*(_QWORD *)(a1 + 696), 0);
LOBYTE(v28) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 728) + 336LL))(*(_QWORD *)(a1 + 728), v28);
*(_DWORD *)(a1 + 852) = a3;
if ( a5 > 0 )
{
v29 = (unsigned int)(v6 >> 31);
LODWORD(v29) = v6 % a5;
*(_DWORD *)(a1 + 840) = v6 / a5;
}
LOBYTE(v29) = v6 > 0;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 712) + 336LL))(*(_QWORD *)(a1 + 712), v29);
LOBYTE(v30) = v11 + v6 < a3;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 720) + 336LL))(*(_QWORD *)(a1 + 720), v30);
if ( a2 )
cocos2d::CCObject::retain(a2);
v31 = *(cocos2d::CCObject **)(a1 + 800);
if ( v31 )
cocos2d::CCObject::release(v31);
*(_QWORD *)(a1 + 800) = a2;
if ( *(_QWORD *)(a1 + 752) )
{
v32 = *(_QWORD *)(a1 + 752);
v33 = MessageThreadsPage::selectedCount(a1);
GJSelectionStrip::setCount(v32, v33, v34, v35);
}
v36 = nullptr;
if ( v11 > 0 )
v36 = a2;
MessageThreadsPage::setupThreadBrowser(a1, v36);
if ( v14 )
{
v38 = *(_QWORD *)(a1 + 736);
if ( v38 )
{
LOBYTE(v37) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v38 + 336LL))(v38, v37);
}
cocos2d::CCNode::unschedule(a1, MessageThreadsPage::checkActivityAbove);
cocos2d::CCNode::schedule(a1, MessageThreadsPage::checkActivityAbove);
}
else if ( !v15 )
{
v39 = *(_QWORD *)(a1 + 736);
if ( v39 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v39 + 336LL))(v39, 0);
cocos2d::CCNode::unschedule(a1, MessageThreadsPage::checkActivityAbove);
}
LOBYTE(v37) = v11 == 0;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 704) + 336LL))(*(_QWORD *)(a1 + 704), v37);
if ( !v11 )
{
v40 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v51 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager(v51);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v40 = *(_QWORD *)&qword_14090BFB0;
}
v41 = "No messages yet\nYou have a pending request\nCheck the Invites button";
if ( *(int *)(v40 + 548) <= 0 )
v41 = "No messages yet\nOld messages are in Legacy\nPress New to start one";
if ( *(_QWORD *)(a1 + 824)
|| *(_DWORD *)(a1 + 856)
|| (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)(a1 + 680) + 16LL))(a1 + 680) )
{
v41 = "Nothing found";
}
v48 = 0;
v49 = 0;
v50 = 0;
v42 = -1;
do
++v42;
while ( v41[v42] );
sub_14003D230(&v48, v41, v42);
TextArea::setString(*(__int64 **)(a1 + 704), (__int64)&v48);
}
if ( a3 <= 0 || v11 <= 0 )
{
(**(void (__fastcall ***)(__int64, char *))(*(_QWORD *)(a1 + 792) + 360LL))(
*(_QWORD *)(a1 + 792) + 360LL,
&byte_1406ED6E0);
}
else
{
v43 = *(void (__fastcall ***)(__int64, const char *))(*(_QWORD *)(a1 + 792) + 360LL);
v44 = *(_QWORD *)(a1 + 792);
v45 = cocos2d::CCString::createWithFormat("%i to %i of %i", v6 + 1, v11 + v6, a3);
CString = cocos2d::CCString::getCString(v45);
(*v43)(v44 + 360, CString);
}
MessageThreadsPage::updateInviteButton(a1, v47);
if ( *(_BYTE *)(a1 + 946) )
{
*(_BYTE *)(a1 + 946) = 0;
v13 = *(_QWORD *)(a1 + 688) != 0;
v12 = *(_DWORD *)(a1 + 840);
goto LABEL_61;
}
}