//
// TableView::checkLastCell from 0x2e9e18 to 0x2ea134 (796 bytes)
//
// 2 xrefs:
// > TableView::checkBoundaryOfContent @ 0x2ea1e8
// > TableView::checkBoundaryOfContent @ 0x2ea2b2
//
// 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; // r0
float y; // s16
float height; // s15
CCIndexPath *v7; // r7
float v8; // s17
TableViewCell *v9; // r5
float width; // s15
const cocos2d::CCPoint *v11; // r0
float v12; // s16
int *v13; // r10
int v14; // r0
int v15; // r1
float v16; // r11
const cocos2d::CCPoint *v17; // r0
float *v18; // r0
cocos2d::CCPoint *v19; // r0
void (__fastcall *setAnchorPoint)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // r8
const cocos2d::CCSize *v22; // r0
TableViewDelegate *m_tableDelegate; // r0
TableViewDelegate *v24; // r0
const cocos2d::CCSize *v25; // r0
void (__fastcall *v26)(cocos2d::CCPoint *, cocos2d::CCPoint *); // r11
int *v27; // r11
const cocos2d::CCSize *v28; // r0
signed int v29; // r9
float v30; // s18
int v31; // r0
cocos2d::CCPoint *m_contentLayer; // [sp+0h] [bp-44h]
float v33; // [sp+Ch] [bp-38h]
cocos2d::CCPoint v34; // [sp+14h] [bp-30h] BYREF
cocos2d::CCPoint v35; // [sp+1Ch] [bp-28h] BYREF
cocos2d::CCSize v36; // [sp+24h] [bp-20h] BYREF
cocos2d::CCPoint v37; // [sp+2Ch] [bp-18h] BYREF
cocos2d::CCPoint v38; // [sp+34h] [bp-10h] BYREF
if ( TableView::checkBoundaryOfCell(a1, a2) != 1 )
{
v4 = a2->getPosition(a2);
cocos2d::CCPoint::CCPoint(&v34, v4);
y = v34.y;
height = a1->m_contentLayer->getContentSize(a1->m_contentLayer)->height;
if ( (float)((float)(y - height) + a1->m_contentLayer->getPosition(a1->m_contentLayer)->y) > 0.0 )
{
v7 = CCIndexPath::CCIndexPathWithSectionRow(a2->m_indexPath.m_section, a2->m_indexPath.m_row + 1);
if ( v7->m_row < a1->m_dataSource->numberOfRowsInSection(a1->m_dataSource, a2->m_indexPath.m_section, a1)
&& !TableView::isDuplicateInVisibleCellArray(a1, v7) )
{
v8 = COERCE_FLOAT(
((int (__fastcall *)(TableViewDelegate *, CCIndexPath *, TableView *))a1->m_tableDelegate->cellHeightForRowAtIndexPath)(
a1->m_tableDelegate,
v7,
a1));
v9 = a1->m_dataSource->cellForRowAtIndexPath(a1->m_dataSource, v7, a1);
width = a1->getContentSize(a1)->width;
v11 = a2->getPosition(a2);
cocos2d::CCPoint::CCPoint(&v35, -(float)(width * 0.5), v11->y - v8);
v12 = v35.y;
if ( v35.y < 0.0 && !TableView::isDuplicateIndexPath(a1, v7) )
{
v25 = a1->m_contentLayer->getContentSize(a1->m_contentLayer);
cocos2d::CCSize::CCSize(&v36, v25);
m_contentLayer = (cocos2d::CCPoint *)a1->m_contentLayer;
v26 = *(void (__fastcall **)(cocos2d::CCPoint *, cocos2d::CCPoint *))(LODWORD(m_contentLayer->x) + 152);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v38, v36.width, v36.height - v12);
v26(m_contentLayer, &v38);
v27 = nullptr;
v28 = a1->m_contentLayer->getContentSize(a1->m_contentLayer);
cocos2d::CCSize::operator=(&v36, v28);
v29 = cocos2d::CCArray::count(a1->m_cellArray) - 1;
while ( v29 >= 0 )
{
v13 = (int *)cocos2d::CCArray::objectAtIndex(a1->m_cellArray, v29);
cocos2d::CCPoint::CCPoint(&v37);
v14 = cocos2d::CCArray::count(a1->m_cellArray);
v15 = *v13;
if ( v29 == v14 - 1 )
{
v16 = *(float *)(*(int (__fastcall **)(int *))(v15 + 96))(v13);
v17 = a2->getPosition(a2);
cocos2d::CCPoint::CCPoint(&v38, v16, v17->y - v12);
cocos2d::CCPoint::operator=(&v37, &v38);
v18 = (float *)(*(int (__fastcall **)(int *))(*v13 + 96))(v13);
cocos2d::CCPoint::CCPoint(&v38, *v18, v37.y - v8);
v19 = &v35;
}
else
{
v33 = *(float *)(*(int (__fastcall **)(int *))(v15 + 96))(v13);
v30 = *(float *)((*(int (__fastcall **)(int *))(*v27 + 96))(v27) + 4);
v31 = (*(int (__fastcall **)(int *))(*v27 + 156))(v27);
cocos2d::CCPoint::CCPoint(&v38, v33, v30 + *(float *)(v31 + 4));
v19 = &v37;
}
--v29;
cocos2d::CCPoint::operator=(v19, &v38);
v27 = v13;
(*(void (__fastcall **)(int *, cocos2d::CCPoint *))(*v13 + 92))(v13, &v37);
}
}
if ( v9 )
{
setAnchorPoint = v9->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v38, 0.0, 1.0);
setAnchorPoint(v9, &v38);
setContentSize = v9->setContentSize;
v22 = a1->getContentSize(a1);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v38, v22->width, v8);
setContentSize(v9, (const cocos2d::CCSize *)&v38);
v9->setPosition(v9, &v35);
CCIndexPath::operator=(&v9->m_indexPath.__vftable, v7);
cocos2d::CCArray::addObject(a1->m_cellArray, v9);
if ( !TableView::isDuplicateIndexPath(a1, v7) )
cocos2d::CCArray::addObject(a1->m_indexPathArray, v7);
m_tableDelegate = a1->m_tableDelegate;
if ( m_tableDelegate )
m_tableDelegate->TableViewWillDisplayCellForRowAtIndexPath(m_tableDelegate, v7, v9, a1);
a1->m_contentLayer->addChild(a1->m_contentLayer, v9);
v24 = a1->m_tableDelegate;
if ( v24 )
v24->TableViewDidDisplayCellForRowAtIndexPath(v24, v7, v9, a1);
}
}
}
}
}