//
// CCScrollLayerExt::ccTouchEnded from 0x140047710 to 0x14004798d (637 bytes)
//
// 5 xrefs:
// > TableView::ccTouchEnded @ 0x140075445
// > ??> @ 0x1405304b8
// > ??> @ 0x140662dd4
// > ??> @ 0x140662e34
// > ??> @ 0x1406c4908
//
// 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)
{
float v3; // xmm3_4
cocos2d::CCDirector *v6; // rax
struct cocos2d::CCPoint v7; // rax
const struct cocos2d::CCPoint *v8; // r8
float v9; // xmm6_4
float v10; // xmm1_4
float v11; // xmm8_4
__int64 v12; // rbx
__int64 v13; // rax
float v14; // xmm7_4
float v15; // xmm6_4
const struct cocos2d::CCPoint *v16; // rax
void (__fastcall ***v17)(_QWORD, float *); // rcx
struct cocos2d::CCMoveBy *v18; // rax
struct cocos2d::CCEaseOut *v19; // rbx
__int64 v20; // rax
struct cocos2d::CCSequence *v21; // rax
cocos2d::ccColor3B *v22; // r8
cocos2d::CCPoint v23; // [rsp+20h] [rbp-58h] BYREF
struct cocos2d::CCPoint v24; // [rsp+80h] [rbp+8h] BYREF
char v25; // [rsp+88h] [rbp+10h] BYREF
struct cocos2d::cc_timeval v26; // [rsp+98h] [rbp+20h] BYREF
cocos2d::CCTouch::getLocationInView(a2);
v6 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector();
v7 = cocos2d::CCDirector::convertToGL(v6, &v24);
((void (__fastcall *)(_QWORD, _QWORD))cocos2d::CCPoint::operator=)(&v25, v7);
if ( a2 != *(cocos2d::CCTouch **)&a1->m_fSkewY )
goto LABEL_16;
cocos2d::CCTime::gettimeofdayCocos2d(&v26, nullptr);
v9 = cocos2d::ccpDistance((cocos2d *)&v25, (const struct cocos2d::CCPoint *)&a1->m_obAnchorPoint.y, v8);
v10 = cocos2d::CCTime::timersubCocos2d((struct cocos2d::cc_timeval *)&a1->m_obContentSize.height, &v26);
if ( (float)(v9 / v10) < 0.5 )
{
CCScrollLayerExt::doConstraintContent((CCScrollLayerExt *)((char *)a1 - 320), 0);
goto LABEL_16;
}
cocos2d::CCNode::stopAllActions(*(cocos2d::CCNode **)&a1->m_sTransform.d);
cocos2d::CCPoint::operator-(&v25, &v24, &a1->m_obAnchorPoint.y);
if ( LOBYTE(a1->m_sInverse.a) )
{
v24.y = 0.0;
}
else if ( HIBYTE(a1->m_sTransform.ty) )
{
v24.x = 0.0;
}
v11 = 0.30000001;
v12 = (*(__int64 (__fastcall **)(float *))(*(_QWORD *)&a1[-1].m_sInverse.ty + 304LL))(&a1[-1].m_sInverse.ty);
v13 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)((char *)&a1[-1].m_sInverse + 492) + 304LL))(*(_QWORD *)((char *)&a1[-1].m_sInverse + 492));
v14 = a1->m_sInverse.tx + a1->m_sInverse.c;
v15 = (float)((float)(*(float *)(v12 + 4) - *(float *)(v13 + 4)) - *((float *)&a1[-1].m_sInverse + 127))
- a1->m_sInverse.d;
v16 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)&a1->m_sTransform.d + 200LL))(*(_QWORD *)&a1->m_sTransform.d);
cocos2d::CCPoint::CCPoint(&v23, v16);
if ( (float)(v23.y + v24.y) > v14 )
{
v24.y = v14 - v23.y;
LABEL_11:
v11 = 0.1;
goto LABEL_12;
}
if ( v15 > (float)(v23.y + v24.y) )
{
v24.y = v15 - v23.y;
goto LABEL_11;
}
LABEL_12:
v17 = *(void (__fastcall ****)(_QWORD, float *))&a1->m_sTransform.b;
if ( v17 )
(**v17)(v17, &a1[-1].m_sInverse.ty);
CCScrollLayerExt::doConstraintContent((CCScrollLayerExt *)((char *)a1 - 320), 0);
v18 = cocos2d::CCMoveBy::create(v11, &v24);
v19 = cocos2d::CCEaseOut::create(v18, 2.0);
v20 = cocos2d::CCCallFunc::create(&a1[-1].m_sInverse.ty, CCScrollLayerExt::constraintContent);
v21 = cocos2d::CCSequence::create(v19, v20, 0);
cocos2d::CCNode::runAction(*(CCLightFlash **)&a1->m_sTransform.d, (cocos2d::CCPoint)v21, v22, v3, v23.x);
BYTE1(a1->m_sAdditionalTransform.b) = 1;
LABEL_16:
LOBYTE(a1->m_sAdditionalTransform.b) = 0;
cocos2d::CCPoint::operator=(&a1->m_obAnchorPointInPoints.y, &stru_1406C13A8);
}