//
// CCScrollLayerExt::ccTouchEnded from 0x579ebc to 0x57a0fc (576 bytes)
//
// 4 xrefs:
// > `non-virtual thunk to'CCScrollLayerExt::ccTouchEnded @ 0x57a108
// > TableView::ccTouchEnded @ 0x57cdbc
// > ??> @ 0x9c978
// > ??> @ 0x113a7d0
//
// 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; // x0
float v6; // s0
float v7; // s1
float v8; // s8
float v9; // s0
float MinY; // s0
float m_peekLimitTop; // s10
float v12; // s9
float v13; // s8
const cocos2d::CCPoint *v14; // x0
float v15; // s10
CCScrollLayerExtDelegate *m_delegate; // x0
cocos2d::CCMoveBy *v17; // x0
cocos2d::CCEaseOut *v18; // x22
cocos2d::CCFiniteTimeAction *v19; // x0
CCContentLayer *m_contentLayer; // x21
cocos2d::CCAction *v21; // x0
float v22; // s9
cocos2d::CCPoint v23; // [xsp+50h] [xbp+50h] BYREF
cocos2d::CCPoint v24; // [xsp+58h] [xbp+58h] BYREF
cocos2d::CCPoint v25; // [xsp+60h] [xbp+60h] BYREF
cocos2d::cc_timeval v26; // [xsp+68h] [xbp+68h] BYREF
cocos2d::CCPoint v27; // 0:kr08_8.8
cocos2d::CCTouch::getLocationInView(a2);
v5 = cocos2d::CCDirector::sharedDirector();
v27 = cocos2d::CCDirector::convertToGL(v5, &v23);
cocos2d::CCPoint::operator=(&v23, v27.x, v27.y);
if ( a1->m_touch == a2 )
{
cocos2d::CCTime::gettimeofdayCocos2d(&v26, nullptr);
v8 = cocos2d::ccpDistance(&v23, &a1->m_touchStartPosition);
v9 = cocos2d::CCTime::timersubCocos2d(&a1->m_timeValue, &v26);
if ( (float)(v8 / v9) < 0.5 )
{
CCScrollLayerExt::constraintContent(a1);
}
else
{
cocos2d::CCNode::stopAllActions(a1->m_contentLayer);
cocos2d::CCPoint::operator-(&v24, &v23, &a1->m_touchStartPosition);
if ( a1->m_disableVertical )
{
v24.y = 0.0;
}
else if ( a1->m_disableHorizontal )
{
v24.x = 0.0;
}
MinY = CCScrollLayerExt::getMinY(a1);
m_peekLimitTop = a1->m_peekLimitTop;
v12 = MinY;
v13 = CCScrollLayerExt::getMaxY(a1) + a1->m_peekLimitBottom;
v14 = a1->m_contentLayer->getPosition(a1->m_contentLayer);
cocos2d::CCPoint::CCPoint(&v25, v14);
if ( v13 >= (float)(v25.y + v24.y) )
{
v22 = v12 - m_peekLimitTop;
if ( v22 <= (float)(v25.y + v24.y) )
{
v15 = 0.3;
}
else
{
v15 = 0.1;
v24.y = v22 - v25.y;
}
}
else
{
v15 = 0.1;
v24.y = v13 - v25.y;
}
m_delegate = a1->m_delegate;
if ( m_delegate )
m_delegate->scrllViewWillBeginDecelerating(m_delegate, a1);
CCScrollLayerExt::constraintContent(a1);
v17 = cocos2d::CCMoveBy::create(v15, &v24);
v18 = cocos2d::CCEaseOut::create(v17, 2.0);
v19 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(a1, CCScrollLayerExt::constraintContent, 0);
m_contentLayer = a1->m_contentLayer;
v21 = (cocos2d::CCAction *)cocos2d::CCSequence::create((cocos2d::CCSequence *)v18, v19, 0);
cocos2d::CCNode::runAction(m_contentLayer, v21);
a1->m_notAtEndOfScroll = 1;
}
}
a1->m_touchDown = 0;
cocos2d::CCPoint::operator=(&a1->m_touchPosition, v6, v7);
}