//
// TableView::checkBoundaryOfContent from 0x100622d60 to 0x10062352e (1998 bytes)
//
// 5 xrefs:
// > TableView::ccTouchBegan @ 0x100622d19
// > TableView::ccTouchEnded @ 0x1006235c6
// > sub_1006236C0 @ 0x1006236f3
// > TableView::ccTouchCancelled @ 0x10062374f
// > sub_100623770 @ 0x1006237ac
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall TableView::checkBoundaryOfContent(TableView *a1, float a2)
{
int v3; // r12d
cocos2d::CCArray *m_cellArray; // rdi
__int64 v5; // r14
TableViewCell *v6; // r15
int v7; // r12d
int v8; // r12d
int v9; // eax
int v10; // r15d
double *v11; // rsi
__int64 v12; // rax
__int64 v13; // rax
char *v14; // r14
cocos2d::CCArray *v15; // rdi
unsigned int v16; // r15d
__int64 v17; // rax
char *v18; // r14
cocos2d::CCArray *v19; // rdi
unsigned int v20; // r12d
__int64 v21; // rax
__int64 v22; // rax
__int64 v23; // rax
__int64 v24; // rax
__int64 v25; // rax
__int64 v26; // rax
__int64 v27; // r12
float *v28; // rax
double v29; // xmm0_8
__int128 v30; // xmm0
__int128 v31; // xmm1
cocos2d::CCArray *v32; // rdi
__int64 v33; // rax
__int64 v34; // r15
float *v35; // rax
__int64 v36; // rax
__int128 v37; // xmm0
__int128 v38; // xmm1
TableViewDelegate *m_tableDelegate; // rdi
TableViewDelegate *v40; // rdi
TableViewDelegate_vtbl *v41; // rax
char *v42; // rsi
__int64 v43; // rdx
TableViewDelegate *v44; // rdi
cocos2d::CCObject v45; // [rsp+8h] [rbp-C8h] BYREF
int v46; // [rsp+40h] [rbp-90h]
int v47; // [rsp+44h] [rbp-8Ch]
cocos2d::CCObject v48; // [rsp+48h] [rbp-88h] BYREF
__int64 v49; // [rsp+80h] [rbp-50h]
__int64 v50; // [rsp+88h] [rbp-48h] BYREF
float v51; // [rsp+90h] [rbp-40h]
float v52; // [rsp+94h] [rbp-3Ch]
float v53; // [rsp+98h] [rbp-38h]
float v54; // [rsp+9Ch] [rbp-34h]
double *p_m_lastCellPos; // [rsp+A0h] [rbp-30h]
v3 = sub_100720070(a1->m_cellArray);
m_cellArray = a1->m_cellArray;
if ( m_cellArray != nullptr && v3 > 0 )
{
v5 = sub_1007200C0(m_cellArray, 0);
v6 = (TableViewCell *)sub_1007200C0(a1->m_cellArray, (unsigned int)(v3 - 1));
if ( v3 == 1 )
{
v7 = ((__int64 (__fastcall *)(TableViewDataSource *, _QWORD, TableView *, float))a1->m_dataSource->numberOfRowsInSection)(
a1->m_dataSource,
*(unsigned int *)(v5 + 484),
a1,
a2);
cocos2d::CCObject::CCObject((__int64)&v48);
v48.__vftable = (cocos2d::CCObject_vtbl *)off_1009829A8;
v49 = 0;
cocos2d::CCObject::CCObject((__int64)&v45);
v8 = v7 - 1;
v45.__vftable = (cocos2d::CCObject_vtbl *)off_1009829A8;
v46 = v8;
v47 = 0;
if ( *(_QWORD *)(v5 + 480) == v49 )
{
TableView::checkLastCell(a1, v6);
}
else if ( !v6->m_indexPath.m_section && v6->m_indexPath.m_row == v8 )
{
TableView::checkFirstCell(a1, (TableViewCell *)v5);
}
cocos2d::CCObject::dCCObject(&v45);
cocos2d::CCObject::dCCObject(&v48);
}
else
{
TableView::checkFirstCell(a1, (TableViewCell *)v5);
TableView::checkLastCell(a1, v6);
}
return;
}
v9 = ((__int64 (__fastcall *)(TableViewDataSource *, _QWORD, TableView *, float))a1->m_dataSource->numberOfRowsInSection)(
a1->m_dataSource,
0,
a1,
a2);
if ( !v9 )
return;
v10 = v9;
v11 = (double *)((__int64 (__fastcall *)(CCContentLayer *))a1->m_contentLayer->getPosition)(a1->m_contentLayer);
sub_10028CC60(&v45, v11);
LODWORD(p_m_lastCellPos) = HIDWORD(v45.__vftable);
v12 = ((__int64 (__fastcall *)(CCContentLayer *))a1->m_contentLayer->getContentSize)(a1->m_contentLayer);
if ( (float)(*(float *)&p_m_lastCellPos - *(float *)(v12 + 4)) < 0.0 )
{
LODWORD(p_m_lastCellPos) = HIDWORD(v45.__vftable);
v13 = ((__int64 (__fastcall *)(TableView *))a1->getContentSize)(a1);
if ( *(float *)(v13 + 4) < *(float *)&p_m_lastCellPos )
return;
v14 = (char *)operator new(0x40u);
cocos2d::CCObject::CCObject((__int64)v14);
*(_QWORD *)v14 = off_1009829A8;
*((_QWORD *)v14 + 7) = 0;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v14);
if ( *((int *)v14 + 14) < 0 || *((_DWORD *)v14 + 14) >= v10 )
return;
v15 = a1->m_cellArray;
if ( v15 && (unsigned int)sub_100720070(v15) && (unsigned int)sub_100720070(a1->m_cellArray) )
{
v16 = 0;
do
{
v17 = sub_1007200C0(a1->m_cellArray, v16);
if ( *(_DWORD *)(v17 + 484) == *((_DWORD *)v14 + 15) && *(_DWORD *)(v17 + 480) == *((_DWORD *)v14 + 14) )
return;
}
while ( ++v16 < (unsigned int)sub_100720070(a1->m_cellArray) );
}
LODWORD(p_m_lastCellPos) = ((float (__fastcall *)(TableViewDelegate *, char *, TableView *))a1->m_tableDelegate->cellHeightForRowAtIndexPath)(
a1->m_tableDelegate,
v14,
a1);
sub_10028CC60(&v48, (double *)&a1->m_lastCellPos);
if ( TableView::checkBoundaryOfCell(a1, (cocos2d::CCPoint *)&v48, *(float *)&p_m_lastCellPos) == 1 )
return;
v33 = ((__int64 (__fastcall *)(TableViewDataSource *, char *, TableView *))a1->m_dataSource->cellForRowAtIndexPath)(
a1->m_dataSource,
v14,
a1);
if ( !v33 )
return;
v34 = v33;
sub_10028CBE0((float *)&v50, 0.0, 1.0);
(*(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v34 + 280LL))(v34, &v50);
v35 = (float *)((__int64 (__fastcall *)(TableView *))a1->getContentSize)(a1);
sub_10028CBF0((float *)&v50, *v35, *(float *)&p_m_lastCellPos);
(*(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v34 + 304LL))(v34, &v50);
v36 = ((__int64 (__fastcall *)(CCContentLayer *))a1->m_contentLayer->getContentSize)(a1->m_contentLayer);
sub_10028CBE0((float *)&v50, 0.0, *(float *)(v36 + 4) - *(float *)&p_m_lastCellPos);
(*(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v34 + 184LL))(v34, &v50);
v37 = *(_OWORD *)(v14 + 8);
v38 = *(_OWORD *)(v14 + 24);
*(_OWORD *)(v34 + 464) = *(_OWORD *)(v14 + 40);
*(_OWORD *)(v34 + 448) = v38;
*(_OWORD *)(v34 + 432) = v37;
*(_QWORD *)(v34 + 480) = *((_QWORD *)v14 + 7);
sub_1007201F0(a1->m_cellArray, v34, 0);
if ( !TableView::isDuplicateIndexPath(a1, (CCIndexPath *)v14) )
sub_1007201F0(a1->m_indexPathArray, v14, 0);
m_tableDelegate = a1->m_tableDelegate;
if ( m_tableDelegate )
((void (__fastcall *)(TableViewDelegate *, char *, __int64, TableView *))m_tableDelegate->TableViewWillDisplayCellForRowAtIndexPath)(
m_tableDelegate,
v14,
v34,
a1);
((void (__fastcall *)(CCContentLayer *, __int64))a1->m_contentLayer->addChild)(a1->m_contentLayer, v34);
v40 = a1->m_tableDelegate;
if ( !v40 )
return;
v41 = v40->__vftable;
v42 = v14;
v43 = v34;
LABEL_53:
((void (__fastcall *)(TableViewDelegate *, char *, __int64, TableView *))v41->TableViewDidDisplayCellForRowAtIndexPath)(
v40,
v42,
v43,
a1);
return;
}
v18 = (char *)operator new(0x40u);
cocos2d::CCObject::CCObject((__int64)v18);
*(_QWORD *)v18 = off_1009829A8;
*((_QWORD *)v18 + 7) = (unsigned int)(v10 - 1);
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v18);
if ( *((_DWORD *)v18 + 14) >= v10 )
return;
v19 = a1->m_cellArray;
if ( !v19 || !(unsigned int)sub_100720070(v19) || !(unsigned int)sub_100720070(a1->m_cellArray) )
{
LABEL_31:
v53 = ((float (__fastcall *)(TableViewDelegate *, char *, TableView *))a1->m_tableDelegate->cellHeightForRowAtIndexPath)(
a1->m_tableDelegate,
v18,
a1);
sub_10028CC60(&v50, (double *)&a1->m_lastCellPos);
sub_10028CC60(&v48, (double *)&v50);
*(float *)&p_m_lastCellPos = *((float *)&v48.__vftable + 1) + v53;
v22 = ((__int64 (__fastcall *)(CCContentLayer *))a1->m_contentLayer->getContentSize)(a1->m_contentLayer);
*(float *)&p_m_lastCellPos = *(float *)&p_m_lastCellPos - *(float *)(v22 + 4);
v23 = ((__int64 (__fastcall *)(CCContentLayer *))a1->m_contentLayer->getPosition)(a1->m_contentLayer);
*(float *)&p_m_lastCellPos = *(float *)&p_m_lastCellPos + *(float *)(v23 + 4);
v54 = *((float *)&v48.__vftable + 1);
v51 = *(float *)(((__int64 (__fastcall *)(CCContentLayer *))a1->m_contentLayer->getContentSize)(a1->m_contentLayer)
+ 4);
v52 = *(float *)(((__int64 (__fastcall *)(CCContentLayer *))a1->m_contentLayer->getPosition)(a1->m_contentLayer) + 4);
v24 = ((__int64 (__fastcall *)(TableView *))a1->getContentSize)(a1);
if ( *(float *)&p_m_lastCellPos < 0.0 || *(float *)(v24 + 4) < *(float *)&p_m_lastCellPos )
{
v54 = (float)(v54 - v51) + v52;
v25 = ((__int64 (__fastcall *)(TableView *))a1->getContentSize)(a1);
if ( v54 < 0.0 || *(float *)(v25 + 4) < v54 )
return;
}
v26 = ((__int64 (__fastcall *)(TableViewDataSource *, char *, TableView *))a1->m_dataSource->cellForRowAtIndexPath)(
a1->m_dataSource,
v18,
a1);
if ( !v26 )
return;
v27 = v26;
p_m_lastCellPos = (double *)&a1->m_lastCellPos;
sub_10028CBE0((float *)&v48, 0.0, 1.0);
(*(void (__fastcall **)(__int64, cocos2d::CCObject *))(*(_QWORD *)v27 + 280LL))(v27, &v48);
v28 = (float *)((__int64 (__fastcall *)(TableView *))a1->getContentSize)(a1);
sub_10028CBF0((float *)&v48, *v28 * 0.5, v53);
(*(void (__fastcall **)(__int64, cocos2d::CCObject *))(*(_QWORD *)v27 + 304LL))(v27, &v48);
v29 = sub_10028CC60(&v48, p_m_lastCellPos);
(*(void (__fastcall **)(__int64, cocos2d::CCObject *, double))(*(_QWORD *)v27 + 184LL))(v27, &v48, v29);
v30 = *(_OWORD *)(v18 + 8);
v31 = *(_OWORD *)(v18 + 24);
*(_OWORD *)(v27 + 464) = *(_OWORD *)(v18 + 40);
*(_OWORD *)(v27 + 448) = v31;
*(_OWORD *)(v27 + 432) = v30;
*(_QWORD *)(v27 + 480) = *((_QWORD *)v18 + 7);
v32 = a1->m_cellArray;
if ( v10 == 1 )
{
sub_1007201F0(v32, v27, 0);
if ( !TableView::isDuplicateIndexPath(a1, (CCIndexPath *)v18) )
sub_1007201F0(a1->m_indexPathArray, v18, 0);
}
else
{
sub_10071FCD0(v32, v27);
if ( !TableView::isDuplicateIndexPath(a1, (CCIndexPath *)v18) )
sub_10071FCD0(a1->m_indexPathArray, v18);
}
v44 = a1->m_tableDelegate;
if ( v44 )
((void (__fastcall *)(TableViewDelegate *, char *, __int64, TableView *))v44->TableViewWillDisplayCellForRowAtIndexPath)(
v44,
v18,
v27,
a1);
((void (__fastcall *)(CCContentLayer *, __int64))a1->m_contentLayer->addChild)(a1->m_contentLayer, v27);
v40 = a1->m_tableDelegate;
if ( !v40 )
return;
v41 = v40->__vftable;
v42 = v18;
v43 = v27;
goto LABEL_53;
}
v20 = 0;
while ( 1 )
{
v21 = sub_1007200C0(a1->m_cellArray, v20);
if ( *(_DWORD *)(v21 + 484) == *((_DWORD *)v18 + 15) && *(_DWORD *)(v21 + 480) == *((_DWORD *)v18 + 14) )
break;
if ( ++v20 >= (unsigned int)sub_100720070(a1->m_cellArray) )
goto LABEL_31;
}
}