//
// cocos2d::CCTouchDispatcher::addStandardDelegate from 0x1004cbf20 to 0x1004cc03c (284 bytes)
//
// 1 xrefs:
// > cocos2d::CCLayer::registerWithTouchDispatcher @ 0x1004b07e5
//
// 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 cocos2d::CCTouchDispatcher::addStandardDelegate(
cocos2d::CCTouchDispatcher *a1,
cocos2d::CCTouchDelegate *a2,
int a3)
{
cocos2d::CCArray *m_pStandardHandlers; // rax
__int64 v4; // rdx
cocos2d::ccArray *data; // rax
cocos2d::CCTouchHandler **arr; // rbx
cocos2d::CCTouchHandler *v7; // r14
int Priority; // r12d
int v9; // r13d
cocos2d::CCTouchDelegate *Delegate; // r14
unsigned __int64 v11; // [rsp+8h] [rbp-48h]
cocos2d::CCArray *v12; // [rsp+10h] [rbp-40h]
int v13; // [rsp+1Ch] [rbp-34h]
cocos2d::CCStandardTouchHandler *v14; // [rsp+20h] [rbp-30h]
v14 = cocos2d::CCStandardTouchHandler::handlerWithDelegate(a2, a3);
if ( a1->m_bLocked )
{
if ( (unsigned __int8)sub_100668370(a1->m_pHandlersToRemove, a2) )
{
sub_1006686F0(a1->m_pHandlersToRemove, a2);
}
else
{
sub_10071FCD0(a1->m_pHandlersToAdd, v14);
a1->m_bToAdd = 1;
}
}
else
{
m_pStandardHandlers = a1->m_pStandardHandlers;
v4 = 0;
v12 = m_pStandardHandlers;
if ( m_pStandardHandlers )
{
data = m_pStandardHandlers->data;
if ( data->num )
{
arr = (cocos2d::CCTouchHandler **)data->arr;
v11 = (unsigned __int64)&arr[data->num - 1];
v4 = 0;
do
{
v7 = *arr;
if ( !*arr )
break;
v13 = v4;
Priority = cocos2d::CCTouchHandler::getPriority(v7);
v9 = cocos2d::CCTouchHandler::getPriority(v14);
Delegate = cocos2d::CCTouchHandler::getDelegate(v7);
if ( Delegate == cocos2d::CCTouchHandler::getDelegate(v14) )
return;
v4 = (unsigned int)(Priority < v9) + v13;
++arr;
}
while ( (unsigned __int64)arr <= v11 );
}
}
sub_1007201F0(v12, v14, v4);
}
}