//
// cocos2d::CCMouseDispatcher::dispatchScrollMSG from 0x100570ea0 to 0x100571084 (484 bytes)
//
// 2 xrefs:
// > -[AppController updateMousePosition] @ 0x100008610
// > -[EAGLView scrollWheelExec:] @ 0x100666c21
//
// 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
//
bool __fastcall cocos2d::CCMouseDispatcher::dispatchScrollMSG(cocos2d::CCMouseDispatcher *a1, float a2, float a3)
{
cocos2d::CCMouseDispatcher *v3; // rbx
cocos2d::CCArray *m_pMouseHandlers; // r14
int v5; // eax
cocos2d::CCMouseHandler *v6; // rax
cocos2d::CCMouseDelegate *Delegate; // rax
cocos2d::CCArray *v8; // r14
int v9; // eax
cocos2d::ccCArray *m_pHandlersToRemove; // rdi
cocos2d::CCArray *v11; // rax
unsigned __int64 v12; // r15
cocos2d::ccArray *data; // rax
cocos2d::CCMouseDelegate *v14; // r12
cocos2d::CCMouseHandler **arr; // r13
cocos2d::CCMouseHandler **v16; // rbx
cocos2d::CCMouseHandler *v17; // r14
cocos2d::ccCArray *m_pHandlersToAdd; // rdi
unsigned __int64 v19; // r14
cocos2d::CCMouseHandler *v20; // rax
cocos2d::CCMouseDispatcher *v22; // [rsp+10h] [rbp-30h]
v3 = a1;
a1->m_bLocked = 1;
if ( (unsigned int)sub_100720070(a1->m_pMouseHandlers) )
{
if ( (unsigned int)sub_100720070(a1->m_pMouseHandlers) )
{
m_pMouseHandlers = a1->m_pMouseHandlers;
v5 = sub_100720070(m_pMouseHandlers);
v6 = (cocos2d::CCMouseHandler *)sub_1007200C0(m_pMouseHandlers, (unsigned int)(v5 - 1));
if ( v6 )
{
Delegate = cocos2d::CCMouseHandler::getDelegate(v6);
((void (__fastcall *)(cocos2d::CCMouseDelegate *, float, float))Delegate->scrollWheel)(Delegate, a2, a3);
if ( (unsigned int)sub_100720070(a1->m_pMouseHandlers) >= 2 )
{
v8 = a1->m_pMouseHandlers;
v9 = sub_100720070(v8);
sub_1007200C0(v8, (unsigned int)(v9 - 2));
}
}
}
}
a1->m_bLocked = 0;
if ( a1->m_bToRemove )
{
a1->m_bToRemove = 0;
m_pHandlersToRemove = a1->m_pHandlersToRemove;
if ( m_pHandlersToRemove->num )
{
v11 = v3->m_pMouseHandlers;
if ( v11 )
{
v22 = v3;
v12 = 0;
LABEL_10:
data = v11->data;
if ( !data->num )
goto LABEL_17;
v14 = (cocos2d::CCMouseDelegate *)m_pHandlersToRemove->arr[v12];
arr = (cocos2d::CCMouseHandler **)data->arr;
v16 = &arr[data->num - 1];
do
{
v17 = *arr;
if ( !*arr )
break;
if ( cocos2d::CCMouseHandler::getDelegate(*arr) == v14 )
{
sub_100720220(v22->m_pMouseHandlers, v17, 1);
break;
}
++arr;
}
while ( arr <= v16 );
LABEL_17:
while ( 1 )
{
++v12;
v3 = v22;
m_pHandlersToRemove = v22->m_pHandlersToRemove;
if ( v12 >= m_pHandlersToRemove->num )
break;
v11 = v22->m_pMouseHandlers;
if ( v11 )
goto LABEL_10;
}
}
}
sub_1006682A0();
}
if ( v3->m_bToAdd )
{
v3->m_bToAdd = 0;
m_pHandlersToAdd = v3->m_pHandlersToAdd;
if ( m_pHandlersToAdd->num )
{
v19 = 0;
do
{
v20 = cocos2d::CCMouseHandler::handlerWithDelegate((cocos2d::CCMouseDelegate *)m_pHandlersToAdd->arr[v19]);
if ( v20 )
sub_10071FCD0(v3->m_pMouseHandlers, v20);
++v19;
m_pHandlersToAdd = v3->m_pHandlersToAdd;
}
while ( v19 < m_pHandlersToAdd->num );
}
sub_1006682A0();
}
return 1;
}