//
// cocos2d::extension::CCScrollView::deaccelerateScrolling from 0xaa5bd0 to 0xaa5ee8 (792 bytes)
//
// 5 xrefs:
// > ??> @ 0x3d800
// > cocos2d::extension::CCScrollView::ccTouchEnded @ 0xaa5068
// > cocos2d::extension::CCScrollView::deaccelerateScrolling @ 0xaa5de4
// > cocos2d::extension::CCScrollView::deaccelerateScrolling @ 0xaa5e4c
// > ??> @ 0x1229f70
//
// 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 cocos2d::extension::CCScrollView::deaccelerateScrolling(cocos2d::extension::CCScrollView *a1, float a2)
{
cocos2d::CCNode *m_pContainer; // x23
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26
__int64 v5; // x0
float v6; // s0
float v7; // s1
const cocos2d::CCPoint *v8; // x0
const cocos2d::CCPoint *v9; // x0
float x; // s9
float y; // s8
float v12; // s0
cocos2d::CCNode *v13; // x0
__int128 v14; // q0
const cocos2d::CCPoint *(__fastcall *getPosition)(cocos2d::CCNode *__hidden); // x1
__int64 v16; // x0
float v17; // s0
float v18; // s1
float v19; // s0
float v20; // s1
float v21; // s0
float v22; // s1
__int64 v23; // [xsp+0h] [xbp+0h] BYREF
float v24[6]; // [xsp+60h] [xbp+60h]
cocos2d::CCPoint v25; // [xsp+78h] [xbp+78h] BYREF
cocos2d::CCPoint v26; // [xsp+80h] [xbp+80h] BYREF
__int64 v27; // [xsp+88h] [xbp+88h] BYREF
cocos2d::CCPoint v28; // [xsp+90h] [xbp+90h] BYREF
cocos2d::CCPoint v29; // 0:kr00_8.8
cocos2d::CCPoint v30; // 0:kr08_8.8
cocos2d::SEL_SCHEDULE v31; // 0:x1.16
cocos2d::SEL_SCHEDULE v32; // 0:x1.16
cocos2d::CCPoint v33; // 0:s0.4,4:s1.4
if ( a1->m_bDragging )
{
v32.adj = 0;
v32.ptr = (void (__cdecl *)(float))cocos2d::extension::CCScrollView::deaccelerateScrolling;
cocos2d::CCNode::unschedule(a1, v32);
}
else
{
cocos2d::CCPoint::CCPoint(&v25);
cocos2d::CCPoint::CCPoint(&v26);
m_pContainer = a1->m_pContainer;
setPosition = m_pContainer->setPosition;
v5 = (__int64)m_pContainer->getPosition(m_pContainer);
cocos2d::CCPoint::operator+(&v28, v5, &a1->m_tScrollDistance);
setPosition(m_pContainer, &v28);
if ( a1->m_bBounceable )
{
cocos2d::CCPoint::operator=(&v25, v6, v7);
cocos2d::CCPoint::operator=(&v26, v21, v22);
}
else
{
v29 = cocos2d::extension::CCScrollView::maxContainerOffset(a1);
cocos2d::CCPoint::operator=(&v25, v29.x, v29.y);
v30 = cocos2d::extension::CCScrollView::minContainerOffset(a1);
cocos2d::CCPoint::operator=(&v26, v30.x, v30.y);
}
v8 = a1->m_pContainer->getPosition(a1->m_pContainer);
if ( v8->x <= v25.x )
((void (__fastcall *)(cocos2d::CCNode *, float, float))a1->m_pContainer->getPosition)(
a1->m_pContainer,
v25.x,
v8->x);
v9 = a1->m_pContainer->getPosition(a1->m_pContainer);
if ( v9->y <= v25.y )
a1->m_pContainer->getPosition(a1->m_pContainer);
x = a1->m_pContainer->getPosition(a1->m_pContainer)->x;
y = a1->m_pContainer->getPosition(a1->m_pContainer)->y;
v12 = a1->m_pContainer->getPosition(a1->m_pContainer)->x;
v13 = a1->m_pContainer;
*(float *)&v14 = x - v12;
getPosition = v13->getPosition;
*(_OWORD *)v24 = v14;
v16 = (__int64)getPosition(v13);
cocos2d::CCPoint::CCPoint(&v28, v24[0], y - *(float *)(v16 + 4));
cocos2d::CCPoint::operator-(&v27, &a1->m_tScrollDistance, &v28);
cocos2d::CCPoint::operator=(&a1->m_tScrollDistance, v17, v18);
LODWORD(v19) = cocos2d::CCPoint::operator*(&a1->m_tScrollDistance, 0.95).n128_u32[0];
cocos2d::CCPoint::operator=(&a1->m_tScrollDistance, v19, v20);
cocos2d::CCPoint::CCPoint(&v28, x, y);
cocos2d::extension::CCScrollView::setContentOffset(a1, v33, (unsigned __int8)&v23 - 112);
if ( fabsf(a1->m_tScrollDistance.x) <= 1.0 && fabsf(a1->m_tScrollDistance.y) <= 1.0
|| y > v25.y
|| y < v26.y
|| x > v25.x
|| x < v26.x
|| y == v26.y
|| y == v25.y
|| x == v25.x
|| x == v26.x )
{
v31.adj = 0;
v31.ptr = (void (__cdecl *)(float))cocos2d::extension::CCScrollView::deaccelerateScrolling;
cocos2d::CCNode::unschedule(a1, v31);
cocos2d::extension::CCScrollView::relocateContainer(a1, 1);
}
}
}