//
// CCScrollLayerExt::doConstraintContent from 0x100300ecc to 0x100301054 (392 bytes)
//
// 6 xrefs:
// > CCScrollLayerExt::constraintContent @ 0x100300ec8
// > CCScrollLayerExt::setContentOffset @ 0x100301130
// > CCScrollLayerExt::ccTouchEnded @ 0x100301314
// > CCScrollLayerExt::ccTouchEnded @ 0x100301414
// > CCScrollLayerExt::ccTouchCancelled @ 0x1003014b8
// > sub_1003014D4 @ 0x1003014ec
//
// 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::doConstraintContent(CCScrollLayerExt *a1, bool a2)
{
_BOOL4 v2; // w20
float v4; // s8
float v5; // s10
float v6; // s11
__int64 v7; // x0
float m_scrollLimitBottom; // s9
__n128 v9; // q0
__n128 v10; // q1
CCScrollLayerExtDelegate *v11; // x0
cocos2d::CCMoveTo *v12; // x0
cocos2d::CCEaseInOut *v13; // x20
char v14; // w0
CCContentLayer *m_contentLayer; // x19
__int64 v16; // x1
__int64 v17; // x2
__int64 v18; // x3
__int64 v19; // x4
__int64 v20; // x5
__int64 v21; // x6
__int64 v22; // x7
cocos2d::CCSequence *v23; // x0
CCScrollLayerExtDelegate *m_delegate; // x0
cocos2d::CCPoint v25; // [xsp+18h] [xbp-38h] BYREF
cocos2d::SEL_CallFunc v26; // 0:x1.16
v2 = a2;
v4 = *(float *)((__int64 (__fastcall *)(CCContentLayer *))a1->m_contentLayer->getPosition)(a1->m_contentLayer);
v5 = *(float *)(((__int64 (__fastcall *)(CCContentLayer *))a1->m_contentLayer->getPosition)(a1->m_contentLayer) + 4);
v6 = *(float *)(((__int64 (__fastcall *)(CCScrollLayerExt *))a1->getContentSize)(a1) + 4);
v7 = ((__int64 (__fastcall *)(CCContentLayer *))a1->m_contentLayer->getContentSize)(a1->m_contentLayer);
m_scrollLimitBottom = a1->m_scrollLimitBottom;
if ( v5 <= m_scrollLimitBottom
&& (m_scrollLimitBottom = (float)(v6 - *(float *)(v7 + 4)) - a1->m_scrollLimitTop, v5 >= m_scrollLimitBottom) )
{
m_delegate = a1->m_delegate;
if ( m_delegate )
((void (__fastcall *)(CCScrollLayerExtDelegate *, CCScrollLayerExt *))m_delegate->scrollViewDidEndMoving)(
m_delegate,
a1);
}
else
{
cocos2d::CCNode::stopAllActions(a1->m_contentLayer);
if ( v2 )
{
((void (__fastcall *)(CCContentLayer *, float, float))a1->m_contentLayer->setPosition_0)(
a1->m_contentLayer,
v4,
m_scrollLimitBottom);
CCScrollLayerExt::scrollingEnd(a1);
}
else
{
v11 = a1->m_delegate;
if ( v11 )
v9 = ((__n128 (__fastcall *)(CCScrollLayerExtDelegate *, CCScrollLayerExt *))v11->scrllViewWillBeginDecelerating)(
v11,
a1);
v9.n128_f32[0] = v4;
v10.n128_f32[0] = m_scrollLimitBottom;
sub_100022980(v9, v10, &v25);
v12 = cocos2d::CCMoveTo::create(0.3, &v25);
v13 = cocos2d::CCEaseInOut::create(v12, 2.0);
v26.ptr = (void (*)(void))CCScrollLayerExt::scrollingEnd;
v26.adj = 0;
v14 = (unsigned __int8)cocos2d::CCCallFunc::create(a1, v26);
m_contentLayer = a1->m_contentLayer;
v23 = sub_10018A494(v13, v16, v17, v18, v19, v20, v21, v22, v14);
cocos2d::CCNode::runAction(m_contentLayer, v23);
}
}
}