//
// CCScrollLayerExt::ccTouchEnded from 0x2e88e0 to 0x2e8a84 (420 bytes)
//
// 2 xrefs:
// > `non-virtual thunk to'CCScrollLayerExt::ccTouchEnded @ 0x2e8a9c
// > TableView::ccTouchEnded @ 0x2ea59a
//
// 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 CCScrollLayerExt::ccTouchEnded(CCScrollLayerExt *a1, cocos2d::CCTouch *a2, cocos2d::CCEvent *a3)
{
cocos2d::CCDirector *v5; // r0
float v6; // s16
float v7; // s15
float MinY; // r0
float m_peekLimitTop; // s18
float v10; // s16
float v11; // s17
const cocos2d::CCPoint *v12; // r0
float v13; // r5
CCScrollLayerExtDelegate *m_delegate; // r0
cocos2d::CCMoveBy *v15; // r0
cocos2d::CCEaseOut *v16; // r0
cocos2d::CCSequence *v17; // r8
cocos2d::CCFiniteTimeAction *v18; // r0
CCContentLayer *m_contentLayer; // r7
cocos2d::CCAction *v20; // r0
cocos2d::CCPoint v21; // [sp+4h] [bp-20h] BYREF
cocos2d::cc_timeval v22; // [sp+Ch] [bp-18h] BYREF
cocos2d::CCPoint v23; // [sp+14h] [bp-10h] BYREF
cocos2d::CCPoint v24; // [sp+1Ch] [bp-8h] BYREF
cocos2d::CCPoint v25; // [sp+24h] [bp+0h] BYREF
cocos2d::CCTouch::getLocationInView(&v21, a2);
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::convertToGL(&v25, v5, &v21);
cocos2d::CCPoint::operator=(&v21, &v25);
if ( a2 != a1->m_touch )
goto LABEL_17;
cocos2d::CCTime::gettimeofdayCocos2d(&v22, nullptr);
v6 = cocos2d::ccpDistance(&v21, &a1->m_touchStartPosition);
v7 = cocos2d::CCTime::timersubCocos2d(&a1->m_timeValue, &v22);
if ( (float)(v6 / v7) < 0.5 )
{
CCScrollLayerExt::constraintContent(a1);
goto LABEL_17;
}
cocos2d::CCNode::stopAllActions(a1->m_contentLayer);
cocos2d::CCPoint::operator-(&v23, &v21, &a1->m_touchStartPosition);
if ( a1->m_disableVertical )
{
v23.y = 0.0;
}
else if ( a1->m_disableHorizontal )
{
v23.x = 0.0;
}
MinY = CCScrollLayerExt::getMinY(a1);
m_peekLimitTop = a1->m_peekLimitTop;
v10 = MinY;
v11 = CCScrollLayerExt::getMaxY(a1) + a1->m_peekLimitBottom;
v12 = a1->m_contentLayer->getPosition(a1->m_contentLayer);
cocos2d::CCPoint::CCPoint(&v24, v12);
if ( (float)(v24.y + v23.y) <= v11 )
{
if ( (float)(v24.y + v23.y) >= (float)(v10 - m_peekLimitTop) )
{
v13 = 0.3;
goto LABEL_13;
}
v23.y = (float)(v10 - m_peekLimitTop) - v24.y;
}
else
{
v23.y = v11 - v24.y;
}
v13 = 0.1;
LABEL_13:
m_delegate = a1->m_delegate;
if ( m_delegate )
m_delegate->scrllViewWillBeginDecelerating(m_delegate, a1);
CCScrollLayerExt::constraintContent(a1);
v15 = cocos2d::CCMoveBy::create(v13, &v23);
v16 = cocos2d::CCEaseOut::create(v15, 2.0);
v25.y = 0.0;
LODWORD(v25.x) = CCScrollLayerExt::constraintContent;
v17 = (cocos2d::CCSequence *)v16;
v18 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(a1, CCScrollLayerExt::constraintContent, 0);
m_contentLayer = a1->m_contentLayer;
v20 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v17, v18, 0);
cocos2d::CCNode::runAction(m_contentLayer, v20);
a1->m_notAtEndOfScroll = 1;
LABEL_17:
a1->m_touchDown = 0;
cocos2d::CCPoint::operator=(&a1->m_touchPosition, &stru_AC53F0);
}