//
// CCScrollLayerExt::ccTouchEnded from 0x100301274 to 0x10030149c (552 bytes)
//
// 3 xrefs:
// > TableView::ccTouchEnded @ 0x1002ffba8
// > sub_10030149C @ 0x1003014a0
// > ??> @ 0x1007eb998
//
// 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 CCScrollLayerExt::ccTouchEnded(CCScrollLayerExt *a1, cocos2d::CCTouch *a2, cocos2d::CCEvent *a3)
{
cocos2d::CCDirector *v5; // x0
float v6; // s8
float v7; // s0
__n128 v8; // q0
float v9; // s8
float v10; // s9
float m_scrollLimitTop; // s10
float m_peekLimitTop; // s11
float v13; // s12
__int64 *v14; // x0
float v15; // s8
CCScrollLayerExtDelegate *m_delegate; // x0
cocos2d::CCMoveBy *v17; // x0
cocos2d::CCEaseOut *v18; // x20
char v19; // w0
CCContentLayer *m_contentLayer; // x21
__int64 v21; // x1
__int64 v22; // x2
__int64 v23; // x3
__int64 v24; // x4
__int64 v25; // x5
__int64 v26; // x6
__int64 v27; // x7
cocos2d::CCSequence *v28; // x0
__int64 v29; // [xsp+18h] [xbp-78h] BYREF
float32x2_t v30; // [xsp+20h] [xbp-70h] BYREF
cocos2d::cc_timeval v31; // [xsp+28h] [xbp-68h] BYREF
float32x2_t v32; // [xsp+38h] [xbp-58h] BYREF
cocos2d::SEL_CallFunc v33; // 0:x1.16
cocos2d::CCTouch::getLocationInView(a2);
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::convertToGL(v5, (const cocos2d::CCPoint *)&v32);
sub_1000229D0(&v32, (double *)&v31.tv_sec);
if ( a1->m_touch == a2 )
{
cocos2d::CCTime::gettimeofdayCocos2d(&v31, nullptr);
v6 = cocos2d::ccpDistance((const cocos2d::CCPoint *)&v32, &a1->m_touchStartPosition);
v7 = cocos2d::CCTime::timersubCocos2d(&a1->m_timeValue, &v31);
if ( (float)(v6 / v7) >= 0.5 )
{
cocos2d::CCNode::stopAllActions(a1->m_contentLayer);
v8.n128_u64[0] = (unsigned __int64)sub_1000229F0(&v32, (float32x2_t *)&a1->m_touchStartPosition, &v30);
if ( a1->m_disableVertical )
{
v30.i32[1] = 0;
}
else if ( a1->m_disableHorizontal )
{
v30.i32[0] = 0;
}
v9 = *(float *)(((__int64 (__fastcall *)(CCScrollLayerExt *, __n128))a1->getContentSize)(a1, v8) + 4);
v10 = *(float *)(((__int64 (__fastcall *)(CCContentLayer *))a1->m_contentLayer->getContentSize)(a1->m_contentLayer)
+ 4);
m_scrollLimitTop = a1->m_scrollLimitTop;
m_peekLimitTop = a1->m_peekLimitTop;
v13 = a1->m_scrollLimitBottom + a1->m_peekLimitBottom;
v14 = (__int64 *)((__int64 (__fastcall *)(CCContentLayer *))a1->m_contentLayer->getPosition)(a1->m_contentLayer);
sub_1000229B8(&v29, v14);
if ( (float)(*((float *)&v29 + 1) + v30.f32[1]) <= v13
&& (v13 = (float)((float)(v9 - v10) - m_scrollLimitTop) - m_peekLimitTop,
(float)(*((float *)&v29 + 1) + v30.f32[1]) >= v13) )
{
v15 = 0.3;
}
else
{
v30.f32[1] = v13 - *((float *)&v29 + 1);
v15 = 0.1;
}
m_delegate = a1->m_delegate;
if ( m_delegate )
((void (__fastcall *)(CCScrollLayerExtDelegate *, CCScrollLayerExt *))m_delegate->scrllViewWillBeginDecelerating)(
m_delegate,
a1);
CCScrollLayerExt::doConstraintContent(a1, 0);
v17 = cocos2d::CCMoveBy::create(v15, (const cocos2d::CCPoint *)&v30);
v18 = cocos2d::CCEaseOut::create(v17, 2.0);
v33.ptr = (void (*)(void))CCScrollLayerExt::constraintContent;
v33.adj = 0;
v19 = (unsigned __int8)cocos2d::CCCallFunc::create(a1, v33);
m_contentLayer = a1->m_contentLayer;
v28 = sub_10018A494(v18, v21, v22, v23, v24, v25, v26, v27, v19);
cocos2d::CCNode::runAction(m_contentLayer, v28);
a1->m_notAtEndOfScroll = 1;
}
else
{
CCScrollLayerExt::doConstraintContent(a1, 0);
}
}
a1->m_touchDown = 0;
sub_1000229D0(&a1->m_touchPosition, &dbl_10086DEE0);
}