//
// cocos2d::CCTouchDispatcher::addStandardDelegate from 0x1004c79e0 to 0x1004c7afc (284 bytes)
//
// 1 xrefs:
// > cocos2d::CCLayer::registerWithTouchDispatcher @ 0x1004a99c5
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:31:08 +0000
//
__int64 __fastcall cocos2d::CCTouchDispatcher::addStandardDelegate(__int64 a1, void *a2, int a3)
{
__int64 result; // rax
__int64 v4; // rax
__int64 v5; // rdx
unsigned int *v6; // rax
__int64 *v7; // rbx
__int64 v8; // r14
int Priority; // r12d
int v10; // r13d
__int64 Delegate; // r14
unsigned __int64 v12; // [rsp+8h] [rbp-48h]
__int64 v13; // [rsp+10h] [rbp-40h]
int v14; // [rsp+1Ch] [rbp-34h]
_OWORD *v15; // [rsp+20h] [rbp-30h]
v15 = cocos2d::CCStandardTouchHandler::handlerWithDelegate(a2, a3);
if ( *(_BYTE *)(a1 + 80) )
{
if ( (unsigned __int8)sub_1007478A0(*(_QWORD *)(a1 + 96), a2) )
{
return sub_100747C20(*(_QWORD *)(a1 + 96), a2);
}
else
{
result = sub_1007FEBF0(*(_QWORD *)(a1 + 88), v15);
*(_BYTE *)(a1 + 81) = 1;
}
}
else
{
v4 = *(_QWORD *)(a1 + 72);
v5 = 0;
v13 = v4;
if ( v4 )
{
v6 = *(unsigned int **)(v4 + 56);
if ( *v6 )
{
v7 = *((__int64 **)v6 + 2);
v12 = (unsigned __int64)&v7[*v6 - 1];
v5 = 0;
do
{
v8 = *v7;
if ( !*v7 )
break;
v14 = v5;
Priority = cocos2d::CCTouchHandler::getPriority(v8);
v10 = cocos2d::CCTouchHandler::getPriority((__int64)v15);
Delegate = cocos2d::CCTouchHandler::getDelegate(v8);
result = cocos2d::CCTouchHandler::getDelegate((__int64)v15);
if ( Delegate == result )
return result;
v5 = (unsigned int)(Priority < v10) + v14;
++v7;
}
while ( (unsigned __int64)v7 <= v12 );
}
}
return sub_1007FF110(v13, v15, v5);
}
return result;
}