//
// TableView::checkLastCell from 0x57c04c to 0x57c584 (1336 bytes)
//
// 3 xrefs:
// > TableView::checkBoundaryOfContent @ 0x57c608
// > TableView::checkBoundaryOfContent @ 0x57cc14
// > ??> @ 0x38df0
//
// 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 TableView::checkLastCell(TableView *a1, TableViewCell *a2)
{
const cocos2d::CCPoint *v4; // x0
float y; // s8
float v6; // s8
int m_section; // w24
int v8; // w23
__int64 v9; // x22
float v10; // s9
TableViewCell *v11; // x26
const cocos2d::CCPoint *v12; // x0
float v13; // s10
void (__fastcall *setAnchorPoint)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
void (__fastcall *v15)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x23
const cocos2d::CCSize *v16; // x0
int v17; // w15
int v18; // w14
unsigned int v19; // w13
unsigned int v20; // w12
cocos2d::CCObjectType v21; // w11
int v22; // w10
int v23; // w9
int v24; // w8
int v25; // w7
int v26; // w6
int v27; // w5
int v28; // w4
int v29; // w3
cocos2d::CCArray *m_cellArray; // x0
TableViewDelegate *m_tableDelegate; // x0
TableViewDelegate *v32; // x0
const cocos2d::CCSize *v33; // x0
CCContentLayer *m_contentLayer; // x24
void (__fastcall *setContentSize)(cocos2d::CCLayerColor *__hidden, const cocos2d::CCSize *); // x25
CCContentLayer *v36; // x0
__int64 v37; // x24
const cocos2d::CCSize *v38; // x0
signed int v39; // w23
float v40; // s8
__int64 v41; // x0
float v42; // s0
float v43; // s1
__int64 v44; // x28
bool v45; // zf
__int64 (*v46)(void); // x1
const cocos2d::CCPoint *v47; // x0
float v48; // s0
float v49; // s1
float *v50; // x0
float v51; // s0
float v52; // s1
float v53; // [xsp+90h] [xbp+90h]
float v54; // [xsp+90h] [xbp+90h]
float v55; // [xsp+90h] [xbp+90h]
cocos2d::CCPoint v56; // [xsp+A0h] [xbp+A0h] BYREF
cocos2d::CCPoint v57; // [xsp+A8h] [xbp+A8h] BYREF
cocos2d::CCSize v58; // [xsp+B0h] [xbp+B0h] BYREF
cocos2d::CCPoint v59; // [xsp+B8h] [xbp+B8h] BYREF
cocos2d::CCPoint v60; // [xsp+C0h] [xbp+C0h] BYREF
if ( (unsigned int)TableView::checkBoundaryOfCell(a1, a2) != 1 )
{
v4 = a2->getPosition(a2);
cocos2d::CCPoint::CCPoint(&v56, v4);
y = v56.y;
v6 = y - a1->m_contentLayer->getContentSize(a1->m_contentLayer)->height;
if ( (float)(v6 + a1->m_contentLayer->getPosition(a1->m_contentLayer)->y) > 0.0 )
{
m_section = a2->m_indexPath.m_section;
v8 = a2->m_indexPath.m_row + 1;
v9 = operator new(0x40u);
cocos2d::CCObject::CCObject((cocos2d::CCObject *)v9);
*(_DWORD *)(v9 + 56) = v8;
*(_DWORD *)(v9 + 60) = m_section;
*(_QWORD *)v9 = &off_113AA70;
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v9);
if ( ((__int64 (__fastcall *)(TableViewDataSource *, _QWORD, TableView *))a1->m_dataSource->numberOfRowsInSection)(
a1->m_dataSource,
(unsigned int)a2->m_indexPath.m_section,
a1) > *(_DWORD *)(v9 + 56)
&& !TableView::isDuplicateInVisibleCellArray(a1, (CCIndexPath *)v9) )
{
v10 = a1->m_tableDelegate->cellHeightForRowAtIndexPath(a1->m_tableDelegate, (CCIndexPath *)v9, a1);
v11 = a1->m_dataSource->cellForRowAtIndexPath(a1->m_dataSource, v9, a1);
v53 = a1->getContentSize(a1)->width * -0.5;
v12 = a2->getPosition(a2);
cocos2d::CCPoint::CCPoint(&v57, v53, v12->y - v10);
v13 = v57.y;
if ( v57.y < 0.0 && !TableView::isDuplicateIndexPath(a1, (CCIndexPath *)v9) )
{
v33 = a1->m_contentLayer->getContentSize(a1->m_contentLayer);
cocos2d::CCSize::CCSize(&v58, v33);
m_contentLayer = a1->m_contentLayer;
setContentSize = m_contentLayer->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v60, v58.width, v58.height - v13);
v36 = m_contentLayer;
v37 = 0;
setContentSize(v36, (const cocos2d::CCSize *)&v60);
v38 = a1->m_contentLayer->getContentSize(a1->m_contentLayer);
cocos2d::CCSize::operator=(&v58, v38);
v39 = cocos2d::CCArray::count(a1->m_cellArray) - 1;
if ( v39 >= 0 )
{
do
{
v44 = cocos2d::CCArray::objectAtIndex(a1->m_cellArray, v39);
cocos2d::CCPoint::CCPoint(&v59);
v45 = v39 == (unsigned int)cocos2d::CCArray::count(a1->m_cellArray) - 1;
v46 = *(__int64 (**)(void))(*(_QWORD *)v44 + 192LL);
if ( v45 )
{
v55 = *(float *)((__int64 (__fastcall *)(__int64))v46)(v44);
v47 = a2->getPosition(a2);
cocos2d::CCPoint::CCPoint(&v60, v55, v47->y - v13);
cocos2d::CCPoint::operator=(&v59, v48, v49);
v50 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v44 + 192LL))(v44);
cocos2d::CCPoint::CCPoint(&v60, *v50, v59.y - v10);
cocos2d::CCPoint::operator=(&v57, v51, v52);
}
else
{
v54 = *(float *)v46();
v40 = *(float *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v37 + 192LL))(v37) + 4);
v41 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v37 + 312LL))(v37);
cocos2d::CCPoint::CCPoint(&v60, v54, v40 + *(float *)(v41 + 4));
cocos2d::CCPoint::operator=(&v59, v42, v43);
}
--v39;
v37 = v44;
(*(void (__fastcall **)(__int64, cocos2d::CCPoint *))(*(_QWORD *)v44 + 184LL))(v44, &v59);
}
while ( v39 != -1 );
}
}
if ( v11 )
{
setAnchorPoint = v11->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v60, 0.0, 1.0);
setAnchorPoint(v11, &v60);
v15 = v11->setContentSize;
v16 = a1->getContentSize(a1);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v60, v16->width, v10);
v15(v11, (const cocos2d::CCSize *)&v60);
v11->setPosition(v11, &v57);
v17 = *(_DWORD *)(v9 + 12);
v18 = *(_DWORD *)(v9 + 16);
v19 = *(_DWORD *)(v9 + 20);
v20 = *(_DWORD *)(v9 + 24);
v21 = *(_DWORD *)(v9 + 28);
v22 = *(_DWORD *)(v9 + 32);
v23 = *(_DWORD *)(v9 + 36);
v24 = *(_DWORD *)(v9 + 40);
v25 = *(_DWORD *)(v9 + 44);
v26 = *(_DWORD *)(v9 + 48);
v27 = *(_DWORD *)(v9 + 52);
v28 = *(_DWORD *)(v9 + 56);
v29 = *(_DWORD *)(v9 + 60);
m_cellArray = a1->m_cellArray;
v11->m_indexPath.m_uID = *(_DWORD *)(v9 + 8);
v11->m_indexPath.m_nLuaID = v17;
v11->m_indexPath.m_nTag = v18;
v11->m_indexPath.m_uReference = v19;
v11->m_indexPath.m_uAutoReleaseCount = v20;
v11->m_indexPath.m_eObjType = v21;
v11->m_indexPath.m_uIndexInArray = v22;
v11->m_indexPath.m_uUnknown = v23;
v11->m_indexPath.m_unknown2 = v24;
v11->m_indexPath.m_nZOrder = v25;
v11->m_indexPath.m_uOrderOfArrival = v26;
v11->m_indexPath.m_unknown5 = v27;
v11->m_indexPath.m_row = v28;
v11->m_indexPath.m_section = v29;
cocos2d::CCArray::addObject(m_cellArray, v11);
if ( !TableView::isDuplicateIndexPath(a1, (CCIndexPath *)v9) )
cocos2d::CCArray::addObject(a1->m_indexPathArray, (cocos2d::CCObject *)v9);
m_tableDelegate = a1->m_tableDelegate;
if ( m_tableDelegate )
m_tableDelegate->TableViewWillDisplayCellForRowAtIndexPath(m_tableDelegate, (CCIndexPath *)v9, v11, a1);
a1->m_contentLayer->addChild(a1->m_contentLayer, v11);
v32 = a1->m_tableDelegate;
if ( v32 )
v32->TableViewDidDisplayCellForRowAtIndexPath(v32, (CCIndexPath *)v9, v11, a1);
}
}
}
}
}